diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientdetails/ClientDetailsFragment.java b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientdetails/ClientDetailsFragment.java index 16ab6af906b..92dac9c655d 100755 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientdetails/ClientDetailsFragment.java +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/clientdetails/ClientDetailsFragment.java @@ -228,7 +228,7 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { public void onPrepareOptionsMenu(Menu menu) { menu.clear(); if (isClientActive) { - menu.addSubMenu(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants + menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants .DATA_TABLE_CLIENTS_NAME); menu.add(Menu.NONE, MENU_ITEM_PIN_POINT, Menu.NONE, getString(R.string.pinpoint)); menu.add(Menu.NONE, MENU_ITEM_CLIENT_CHARGES, Menu.NONE, getString(R.string.charges)); diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsFragment.java b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsFragment.java index 11197381905..5cf13e71c3b 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsFragment.java +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsFragment.java @@ -28,19 +28,17 @@ import com.mifos.mifosxdroid.core.MifosBaseActivity; import com.mifos.mifosxdroid.core.MifosBaseFragment; import com.mifos.mifosxdroid.online.activate.ActivateFragment; +import com.mifos.mifosxdroid.online.datatable.DataTableFragment; import com.mifos.mifosxdroid.online.documentlist.DocumentListFragment; import com.mifos.mifosxdroid.online.grouploanaccount.GroupLoanAccountFragment; import com.mifos.objects.accounts.GroupAccounts; import com.mifos.objects.accounts.savings.DepositType; import com.mifos.objects.client.Client; import com.mifos.objects.group.Group; -import com.mifos.objects.noncore.DataTable; import com.mifos.utils.Constants; import com.mifos.utils.FragmentConstants; import com.mifos.utils.Utils; -import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import javax.inject.Inject; @@ -105,7 +103,6 @@ public class GroupDetailsFragment extends MifosBaseFragment implements GroupDeta private int groupId; private AccountAccordion accountAccordion; private OnFragmentInteractionListener mListener; - public List clientDataTables = new ArrayList<>(); public static GroupDetailsFragment newInstance(int groupId) { GroupDetailsFragment fragment = new GroupDetailsFragment(); @@ -134,7 +131,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle mGroupDetailsPresenter.attachView(this); mGroupDetailsPresenter.loadGroupDetailsAndAccounts(groupId); - mGroupDetailsPresenter.loadClientDataTable(); return rootView; } @@ -170,6 +166,16 @@ public void addGroupLoanAccount() { fragmentTransaction.commit(); } + public void loadGroupDataTables() { + DataTableFragment dataTableFragment = DataTableFragment.newInstance(Constants + .DATA_TABLE_NAME_GROUP, groupId); + FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager() + .beginTransaction(); + fragmentTransaction.addToBackStack(FragmentConstants.FRAG_GROUP_DETAILS); + fragmentTransaction.replace(R.id.container, dataTableFragment); + fragmentTransaction.commit(); + } + @Override public void showProgressbar(boolean show) { if (show) { @@ -267,17 +273,6 @@ public void onItemClick(AdapterView adapterView, View view, int i, } } - @Override - public void showGroupDataTable(List dataTables) { - if (dataTables != null) { - Iterator dataTableIterator = dataTables.iterator(); - clientDataTables.clear(); - while (dataTableIterator.hasNext()) { - clientDataTables.add(dataTableIterator.next()); - } - } - } - @Override public void showFetchingError(int errorMessage) { Toast.makeText(getActivity(), getStringMessage(errorMessage), Toast.LENGTH_SHORT).show(); @@ -297,13 +292,16 @@ public void onAttach(Activity activity) { @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - inflater.inflate(R.menu.group, menu); + inflater.inflate(R.menu.menu_group, menu); super.onCreateOptionsMenu(menu, inflater); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { + case R.id.more_group_info: + loadGroupDataTables(); + break; case R.id.documents: loadDocuments(); break; diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsMvpView.java b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsMvpView.java index 30dec25ecfd..c0e333a9730 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsMvpView.java +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsMvpView.java @@ -4,7 +4,6 @@ import com.mifos.objects.accounts.GroupAccounts; import com.mifos.objects.client.Client; import com.mifos.objects.group.Group; -import com.mifos.objects.noncore.DataTable; import java.util.List; @@ -20,7 +19,5 @@ public interface GroupDetailsMvpView extends MvpView { void showGroupAccounts(GroupAccounts groupAccounts); - void showGroupDataTable(List dataTables); - void showFetchingError(int errorMessage); } diff --git a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsPresenter.java b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsPresenter.java index e8032c9c65c..2cb9c18d134 100644 --- a/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsPresenter.java +++ b/mifosng-android/src/main/java/com/mifos/mifosxdroid/online/groupdetails/GroupDetailsPresenter.java @@ -1,17 +1,12 @@ package com.mifos.mifosxdroid.online.groupdetails; -import com.mifos.api.datamanager.DataManagerDataTable; import com.mifos.api.datamanager.DataManagerGroups; import com.mifos.mifosxdroid.R; import com.mifos.mifosxdroid.base.BasePresenter; import com.mifos.objects.accounts.GroupAccounts; import com.mifos.objects.group.Group; import com.mifos.objects.group.GroupWithAssociations; -import com.mifos.objects.noncore.DataTable; import com.mifos.objects.zipmodels.GroupAndGroupAccounts; -import com.mifos.utils.Constants; - -import java.util.List; import javax.inject.Inject; @@ -28,14 +23,11 @@ public class GroupDetailsPresenter extends BasePresenter { private final DataManagerGroups mDataManagerGroups; - private final DataManagerDataTable mDataManagerDataTable; private CompositeSubscription mSubscriptions; @Inject - public GroupDetailsPresenter(DataManagerGroups dataManagerGroups, - DataManagerDataTable dataManagerDataTable) { + public GroupDetailsPresenter(DataManagerGroups dataManagerGroups) { mDataManagerGroups = dataManagerGroups; - mDataManagerDataTable = dataManagerDataTable; mSubscriptions = new CompositeSubscription(); } @@ -112,27 +104,4 @@ public void onNext(GroupWithAssociations groupWithAssociations) { ); } - - public void loadClientDataTable() { - checkViewAttached(); - mSubscriptions.add(mDataManagerDataTable.getDataTable(Constants.DATA_TABLE_NAME_GROUP) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(new Subscriber>() { - @Override - public void onCompleted() { - } - - @Override - public void onError(Throwable e) { - getMvpView().showFetchingError(R.string.failed_to_fetch_datatable); - } - - @Override - public void onNext(List dataTables) { - getMvpView().showGroupDataTable(dataTables); - } - })); - } - } diff --git a/mifosng-android/src/main/res/layout/item_data_table.xml b/mifosng-android/src/main/res/layout/item_data_table.xml index c0230ecaced..5f601a9d6a8 100644 --- a/mifosng-android/src/main/res/layout/item_data_table.xml +++ b/mifosng-android/src/main/res/layout/item_data_table.xml @@ -8,7 +8,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="wrap_content" android:background="@color/white" android:foreground="?android:attr/selectableItemBackground" app:cardUseCompatPadding="true"> diff --git a/mifosng-android/src/main/res/menu/group.xml b/mifosng-android/src/main/res/menu/menu_group.xml similarity index 66% rename from mifosng-android/src/main/res/menu/group.xml rename to mifosng-android/src/main/res/menu/menu_group.xml index 5fa7641e7a2..2b995de8a86 100644 --- a/mifosng-android/src/main/res/menu/group.xml +++ b/mifosng-android/src/main/res/menu/menu_group.xml @@ -4,9 +4,16 @@ --> + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + tools:context="com.mifos.mifosxdroid.online.GroupsActivity"> + + + Savings Account Closed Savings Account Activated More client info + More group Info Pinpoint location Charges Add Loan Account