From ebb287b366ebbd923ed970d55121e04eb00a56d5 Mon Sep 17 00:00:00 2001 From: Deep Vora <70479785+deeppp15@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:36:01 -0500 Subject: [PATCH] teams: smoother finances default (fixes #5007) (#5035) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../ui/enterprises/FinanceFragment.kt | 19 +++++++++++++------ app/src/main/res/layout/fragment_finance.xml | 5 +---- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 97458029b9..170a165ae7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 26 targetSdkVersion 34 - versionCode 2202 - versionName "0.22.2" + versionCode 2203 + versionName "0.22.3" 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.kt b/app/src/main/java/org/ole/planet/myplanet/ui/enterprises/FinanceFragment.kt index e2be64e8bc..ee06e2e013 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/enterprises/FinanceFragment.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/enterprises/FinanceFragment.kt @@ -53,7 +53,6 @@ class FinanceFragment : BaseTeamFragment() { list = fRealm.where(RealmMyTeam::class.java).notEqualTo("status", "archived") .equalTo("teamId", teamId).equalTo("docType", "transaction") .sort("date", Sort.DESCENDING).findAllAsync() - list?.addChangeListener { results -> updatedFinanceList(results) } @@ -191,11 +190,19 @@ class FinanceFragment : BaseTeamFragment() { private fun updatedFinanceList(results: RealmResults) { activity?.runOnUiThread { - adapterFinance = AdapterFinance(requireActivity(), results) - fragmentFinanceBinding.rvFinance.layoutManager = LinearLayoutManager(activity) - fragmentFinanceBinding.rvFinance.adapter = adapterFinance - adapterFinance?.notifyDataSetChanged() - calculateTotal(results) + if (!results.isEmpty()) { + adapterFinance = AdapterFinance(requireActivity(), results) + fragmentFinanceBinding.rvFinance.layoutManager = LinearLayoutManager(activity) + fragmentFinanceBinding.rvFinance.adapter = adapterFinance + adapterFinance?.notifyDataSetChanged() + calculateTotal(results) + } else { + fragmentFinanceBinding.rvFinance.adapter = null + fragmentFinanceBinding.dataLayout.visibility= View.GONE + fragmentFinanceBinding.tvNodata.visibility= View.VISIBLE + + } } } + } diff --git a/app/src/main/res/layout/fragment_finance.xml b/app/src/main/res/layout/fragment_finance.xml index b95c5ad3e5..9dffc7f659 100644 --- a/app/src/main/res/layout/fragment_finance.xml +++ b/app/src/main/res/layout/fragment_finance.xml @@ -7,6 +7,7 @@ tools:context=".ui.enterprises.FinanceFragment"> @@ -104,7 +105,6 @@ android:textColor="@color/daynight_textColor" android:textSize="@dimen/text_size_mid" android:textStyle="bold" /> - - - -