From fa4df91f7a8b730b82db2bebf057dd23157d39b6 Mon Sep 17 00:00:00 2001 From: BryanGazali <46581520+BryanGazali@users.noreply.github.com> Date: Tue, 14 Nov 2023 00:59:34 +0800 Subject: [PATCH] community: add date reset to finance (fixes #1982) (#2699) Co-authored-by: dogi --- app/build.gradle | 4 +-- .../ui/enterprises/FinanceFragment.java | 8 +++++ app/src/main/res/layout/fragment_finance.xml | 33 ++++++++++++++----- app/src/main/res/values-ar/strings.xml | 3 +- app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-ne/strings.xml | 1 + app/src/main/res/values-so/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 9 files changed, 42 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f5237eaafe..2aa7a37c33 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1143 - versionName "0.11.43" + versionCode 1144 + versionName "0.11.44" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/enterprises/FinanceFragment.java b/app/src/main/java/org/ole/planet/myplanet/ui/enterprises/FinanceFragment.java index 190b3494cd..b9bfa15d7c 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/enterprises/FinanceFragment.java +++ b/app/src/main/java/org/ole/planet/myplanet/ui/enterprises/FinanceFragment.java @@ -62,6 +62,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa fragmentFinanceBinding.rvFinance.setAdapter(adapterFinance); isAsc = !isAsc; }); + fragmentFinanceBinding.btnReset.setOnClickListener(view -> { + list = mRealm.where(RealmMyTeam.class).notEqualTo("status", "archived").equalTo("teamId", teamId).equalTo("docType", "transaction").sort("date", Sort.DESCENDING).findAll(); + adapterFinance = new AdapterFinance(getActivity(), list); + fragmentFinanceBinding.rvFinance.setLayoutManager(new LinearLayoutManager(getActivity())); + fragmentFinanceBinding.rvFinance.setAdapter(adapterFinance); + calculateTotal(list); + }); return fragmentFinanceBinding.getRoot(); } @@ -78,6 +85,7 @@ private void showDatePickerDialog() { fragmentFinanceBinding.rvFinance.setAdapter(adapterFinance); calculateTotal(list); }, now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH)).show(getActivity().getFragmentManager(), ""); + } @Override diff --git a/app/src/main/res/layout/fragment_finance.xml b/app/src/main/res/layout/fragment_finance.xml index 26146b23f2..cd5630a9f3 100644 --- a/app/src/main/res/layout/fragment_finance.xml +++ b/app/src/main/res/layout/fragment_finance.xml @@ -11,15 +11,32 @@ android:layout_height="match_parent" android:orientation="vertical"> -