Skip to content

Commit

Permalink
teams: smoother finances default (fixes #5007) (#5035)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
deeppp15 and dogi authored Jan 15, 2025
1 parent dcc1b1d commit ebb287b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -191,11 +190,19 @@ class FinanceFragment : BaseTeamFragment() {

private fun updatedFinanceList(results: RealmResults<RealmMyTeam>) {
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

}
}
}

}
5 changes: 1 addition & 4 deletions app/src/main/res/layout/fragment_finance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
tools:context=".ui.enterprises.FinanceFragment">

<LinearLayout
android:id="@+id/data_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
Expand Down Expand Up @@ -104,7 +105,6 @@
android:textColor="@color/daynight_textColor"
android:textSize="@dimen/text_size_mid"
android:textStyle="bold" />

<TextView
android:id="@+id/credit"
android:layout_width="0dp"
Expand All @@ -115,7 +115,6 @@
android:textColor="@color/daynight_textColor"
android:textSize="@dimen/text_size_mid"
android:textStyle="bold" />

<TextView
android:id="@+id/debit"
android:layout_width="0dp"
Expand All @@ -126,8 +125,6 @@
android:textColor="@color/daynight_textColor"
android:textSize="@dimen/text_size_mid"
android:textStyle="bold" />


<TextView
android:id="@+id/balance"
android:layout_width="0dp"
Expand Down

0 comments on commit ebb287b

Please sign in to comment.