Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion: Groups related fragments #1535

Merged
merged 1 commit into from
Feb 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -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