Skip to content

Commit

Permalink
Conversion: Groups related fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
iamsh4shank committed Aug 13, 2020
1 parent fb77683 commit 9f9bc1d
Show file tree
Hide file tree
Showing 34 changed files with 2,438 additions and 3,025 deletions.
2 changes: 1 addition & 1 deletion mifosng-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ dependencies {

implementation fileTree(dir: 'src/main/libs', include: ['*.jar'])

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

//DBFlow dependencies
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import com.mifos.objects.client.Client;
import com.mifos.utils.Constants;

import org.jetbrains.annotations.Nullable;

import java.util.List;

public class CentersActivity extends MifosBaseActivity implements
Expand Down Expand Up @@ -43,12 +45,13 @@ public void loadGroupsOfCenter(int centerId) {
}

@Override
public void loadClientsOfGroup(List<Client> clientList) {
replaceFragment(ClientListFragment.newInstance(clientList, true), true, R.id.container);
public void addCenterSavingAccount(int centerId) {
replaceFragment(SavingsAccountFragment.newInstance(centerId, true), true, R.id.container);
}

@Override
public void addCenterSavingAccount(int centerId) {
replaceFragment(SavingsAccountFragment.newInstance(centerId, true), true, R.id.container);
public void loadClientsOfGroup(@Nullable List<? extends Client> clientList) {
replaceFragment(ClientListFragment.newInstance((List<Client>) clientList
, true), true, R.id.container);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_dashboard);

ButterKnife.bind(this);
runJobs();
//runJobs();
replaceFragment(new SearchFragment(), false, R.id.container);

// setup navigation drawer and Navigation Toggle click and Offline Mode SwitchButton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,122 +1,110 @@
package com.mifos.mifosxdroid.online;
package com.mifos.mifosxdroid.online

import android.os.Bundle;

import com.mifos.mifosxdroid.R;
import com.mifos.mifosxdroid.core.MifosBaseActivity;
import com.mifos.mifosxdroid.online.clientlist.ClientListFragment;
import com.mifos.mifosxdroid.online.groupdetails.GroupDetailsFragment;
import com.mifos.mifosxdroid.online.loanaccountsummary.LoanAccountSummaryFragment;
import com.mifos.mifosxdroid.online.loanrepayment.LoanRepaymentFragment;
import com.mifos.mifosxdroid.online.loanrepaymentschedule.LoanRepaymentScheduleFragment;
import com.mifos.mifosxdroid.online.loantransactions.LoanTransactionsFragment;
import com.mifos.mifosxdroid.online.savingaccountsummary.SavingsAccountSummaryFragment;
import com.mifos.mifosxdroid.online.savingaccounttransaction.SavingsAccountTransactionFragment;
import com.mifos.objects.accounts.loan.LoanWithAssociations;
import com.mifos.objects.accounts.savings.DepositType;
import com.mifos.objects.accounts.savings.SavingsAccountWithAssociations;
import com.mifos.objects.client.Client;
import com.mifos.utils.Constants;

import java.util.List;

import butterknife.ButterKnife;
import android.os.Bundle
import butterknife.ButterKnife
import com.mifos.mifosxdroid.R
import com.mifos.mifosxdroid.core.MifosBaseActivity
import com.mifos.mifosxdroid.online.clientlist.ClientListFragment
import com.mifos.mifosxdroid.online.groupdetails.GroupDetailsFragment
import com.mifos.mifosxdroid.online.groupdetails.GroupDetailsFragment.Companion.newInstance
import com.mifos.mifosxdroid.online.loanaccountsummary.LoanAccountSummaryFragment
import com.mifos.mifosxdroid.online.loanrepayment.LoanRepaymentFragment
import com.mifos.mifosxdroid.online.loanrepaymentschedule.LoanRepaymentScheduleFragment
import com.mifos.mifosxdroid.online.loantransactions.LoanTransactionsFragment
import com.mifos.mifosxdroid.online.savingaccountsummary.SavingsAccountSummaryFragment
import com.mifos.mifosxdroid.online.savingaccounttransaction.SavingsAccountTransactionFragment
import com.mifos.objects.accounts.loan.LoanWithAssociations
import com.mifos.objects.accounts.savings.DepositType
import com.mifos.objects.accounts.savings.SavingsAccountWithAssociations
import com.mifos.objects.client.Client
import com.mifos.utils.Constants

/**
* Created by nellyk on 2/27/2016.
*/
public class GroupsActivity extends MifosBaseActivity implements GroupDetailsFragment
.OnFragmentInteractionListener, LoanAccountSummaryFragment.OnFragmentInteractionListener,
LoanRepaymentFragment.OnFragmentInteractionListener,
SavingsAccountSummaryFragment.OnFragmentInteractionListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_toolbar_container);
ButterKnife.bind(this);
showBackButton();
int groupId = getIntent().getExtras().getInt(Constants.GROUP_ID);
replaceFragment(GroupDetailsFragment.newInstance(groupId), false, R.id.container);
class GroupsActivity : MifosBaseActivity(), GroupDetailsFragment.OnFragmentInteractionListener, LoanAccountSummaryFragment.OnFragmentInteractionListener, LoanRepaymentFragment.OnFragmentInteractionListener, SavingsAccountSummaryFragment.OnFragmentInteractionListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_toolbar_container)
ButterKnife.bind(this)
showBackButton()
val groupId = intent.extras.getInt(Constants.GROUP_ID)
replaceFragment(newInstance(groupId), false, R.id.container)
}

/**
* Called when a Loan Account is Selected
* from the list of Loan Accounts on Client Details Fragment
* It displays the summary of the Selected Loan Account
*/
@Override
public void loadLoanAccountSummary(int loanAccountNumber) {
override fun loadLoanAccountSummary(loanAccountNumber: Int) {
replaceFragment(LoanAccountSummaryFragment.newInstance(loanAccountNumber, true), true,
R.id.container);
R.id.container)
}

/**
* Called when a Savings Account is Selected
* from the list of Savings Accounts on Client Details Fragment
* <p/>
*
*
* It displays the summary of the Selected Savings Account
*/
@Override
public void loadSavingsAccountSummary(int savingsAccountNumber, DepositType accountType) {
override fun loadSavingsAccountSummary(savingsAccountNumber: Int, accountType: DepositType?) {
replaceFragment(SavingsAccountSummaryFragment.newInstance(savingsAccountNumber,
accountType, true), true, R.id.container);
}

@Override
public void loadGroupClients(List<Client> clients) {
replaceFragment(ClientListFragment.newInstance(clients, true), true, R.id.container);
accountType, true), true, R.id.container)
}

/**
* Called when the make the make repayment button is clicked
* in the Loan Account Summary Fragment.
* <p/>
*
*
* It will display the Loan Repayment Fragment where
* the Information of the repayment has to be filled in.
*/
@Override
public void makeRepayment(LoanWithAssociations loan) {
replaceFragment(LoanRepaymentFragment.newInstance(loan), true, R.id.container);
override fun makeRepayment(loan: LoanWithAssociations) {
replaceFragment(LoanRepaymentFragment.newInstance(loan), true, R.id.container)
}

/**
* Called when the Repayment Schedule option from the Menu is
* clicked
* <p/>
*
*
* It will display the Complete Loan Repayment Schedule.
*/
@Override
public void loadRepaymentSchedule(int loanId) {
replaceFragment(LoanRepaymentScheduleFragment.newInstance(loanId), true, R.id.container);
override fun loadRepaymentSchedule(loanId: Int) {
replaceFragment(LoanRepaymentScheduleFragment.newInstance(loanId), true, R.id.container)
}

/**
* Called when the Transactions option from the Menu is clicked
* <p/>
*
*
* It will display all the Transactions associated with the Loan
* and also their details
*/

@Override
public void loadLoanTransactions(int loanId) {
replaceFragment(LoanTransactionsFragment.newInstance(loanId), true, R.id.container);
override fun loadLoanTransactions(loanId: Int) {
replaceFragment(LoanTransactionsFragment.newInstance(loanId), true, R.id.container)
}

/**
* Called when the make the make deposit button is clicked
* in the Savings Account Summary Fragment.
* <p/>
*
*
* It will display the Transaction Fragment where the information
* of the transaction has to be filled in.
* <p/>
*
*
* The transactionType defines if the transaction is a Deposit or a Withdrawal
*/
@Override
public void doTransaction(SavingsAccountWithAssociations savingsAccountWithAssociations,
String transactionType, DepositType accountType) {
replaceFragment(SavingsAccountTransactionFragment.newInstance
(savingsAccountWithAssociations, transactionType, accountType), true, R.id
.container);
override fun doTransaction(savingsAccountWithAssociations: SavingsAccountWithAssociations,
transactionType: String, accountType: DepositType) {
replaceFragment(SavingsAccountTransactionFragment.newInstance(savingsAccountWithAssociations, transactionType, accountType), true, R.id.container)
}

override fun loadGroupClients(clients: List<Client>?) {
replaceFragment(ClientListFragment.newInstance(clients, true), true, R.id.container)
}
}
}
Loading

0 comments on commit 9f9bc1d

Please sign in to comment.