Skip to content

Commit

Permalink
refactor #2516: migrated loan account details screen to compose
Browse files Browse the repository at this point in the history
  • Loading branch information
AvneetSingh2001 authored and therajanmaurya committed Feb 22, 2024
1 parent 761f5ef commit d0f198d
Show file tree
Hide file tree
Showing 21 changed files with 770 additions and 462 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package org.mifos.mobile.ui.activities

import android.os.Bundle
import android.view.View
import org.mifos.mobile.R
import org.mifos.mobile.databinding.ActivityContainerBinding
import org.mifos.mobile.ui.activities.base.BaseActivity
import org.mifos.mobile.ui.fragments.LoanAccountsDetailFragment
import org.mifos.mobile.ui.loan_account.LoanAccountsDetailFragment
import org.mifos.mobile.utils.Constants

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ class SavingsAccountContainerActivity : BaseActivity() {
}
}

fun hideToolbar() {
binding.apply {
toolbar?.visibility = View.GONE
}
}

fun showToolbar() {
binding.apply {
toolbar?.visibility = View.VISIBLE
}
}

companion object {
var transferSuccess = false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ open class BaseActivity : BasePassCodeActivity(), BaseActivityCallback {
}
}

fun showToolbar() {
toolbar = findViewById(R.id.toolbar)
toolbar?.visibility = View.VISIBLE
}

fun hideToolbar() {
toolbar = findViewById(R.id.toolbar)
toolbar?.visibility = View.GONE
}

/**
* Used for removing elevation from toolbar
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.mifos.mobile.R
import org.mifos.mobile.databinding.FragmentClientChargeBinding
import org.mifos.mobile.models.Charge
import org.mifos.mobile.ui.activities.SavingsAccountContainerActivity
import org.mifos.mobile.ui.activities.base.BaseActivity
import org.mifos.mobile.ui.adapters.ClientChargeAdapter
import org.mifos.mobile.ui.enums.ChargeType
import org.mifos.mobile.ui.fragments.base.BaseFragment
Expand Down Expand Up @@ -49,7 +50,7 @@ class ClientChargeFragment : BaseFragment() {
private var sweetUIErrorHandler: SweetUIErrorHandler? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activity as? SavingsAccountContainerActivity)?.showToolbar()
(activity as? BaseActivity)?.showToolbar()
if (arguments != null) {
id = arguments?.getLong(Constants.CLIENT_ID)
chargeType = arguments?.getCheckedSerializable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class GuarantorListFragment : BaseFragment() {
private var disposableDeleteGuarantor: Disposable? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activity as? BaseActivity)?.showToolbar()
if (arguments != null) loanId = requireArguments().getLong(Constants.LOAN_ID)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dagger.hilt.android.AndroidEntryPoint
import org.mifos.mobile.R
import org.mifos.mobile.databinding.FragmentLoanAccountSummaryBinding
import org.mifos.mobile.models.accounts.loan.LoanWithAssociations
import org.mifos.mobile.ui.activities.base.BaseActivity
import org.mifos.mobile.ui.fragments.base.BaseFragment
import org.mifos.mobile.utils.Constants
import org.mifos.mobile.utils.CurrencyUtil
Expand All @@ -26,6 +27,7 @@ class LoanAccountSummaryFragment : BaseFragment() {
private var loanWithAssociations: LoanWithAssociations? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activity as? BaseActivity)?.showToolbar()
if (arguments != null) {
loanWithAssociations = arguments?.getCheckedParcelable(LoanWithAssociations::class.java, Constants.LOAN_ACCOUNT)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import kotlinx.coroutines.launch
import org.mifos.mobile.R
import org.mifos.mobile.databinding.FragmentLoanAccountTransactionsBinding
import org.mifos.mobile.models.accounts.loan.LoanWithAssociations
import org.mifos.mobile.ui.activities.base.BaseActivity
import org.mifos.mobile.ui.adapters.RecentTransactionListAdapter
import org.mifos.mobile.ui.fragments.base.BaseFragment
import org.mifos.mobile.utils.Constants
Expand Down Expand Up @@ -50,6 +51,7 @@ class LoanAccountTransactionFragment : BaseFragment() {
private var sweetUIErrorHandler: SweetUIErrorHandler? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activity as? BaseActivity)?.showToolbar()
if (arguments != null) {
loanId = arguments?.getLong(Constants.LOAN_ID)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.mifos.mobile.R
import org.mifos.mobile.databinding.FragmentLoanWithdrawBinding
import org.mifos.mobile.models.accounts.loan.LoanWithAssociations
import org.mifos.mobile.models.accounts.loan.LoanWithdraw
import org.mifos.mobile.ui.activities.base.BaseActivity
import org.mifos.mobile.ui.fragments.base.BaseFragment
import org.mifos.mobile.utils.Constants
import org.mifos.mobile.utils.DateHelper
Expand All @@ -36,6 +37,7 @@ class LoanAccountWithdrawFragment : BaseFragment() {
private var loanWithAssociations: LoanWithAssociations? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
(activity as? BaseActivity)?.showToolbar()
if (arguments != null) {
loanWithAssociations = arguments?.getCheckedParcelable(LoanWithAssociations::class.java, Constants.LOAN_ACCOUNT)
}
Expand Down
Loading

0 comments on commit d0f198d

Please sign in to comment.