diff --git a/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/balance/list/view/PezkuwiDashboardAdapter.kt b/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/balance/list/view/PezkuwiDashboardAdapter.kt
index 8352e3b1..d869ad42 100644
--- a/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/balance/list/view/PezkuwiDashboardAdapter.kt
+++ b/feature-assets/src/main/java/io/novafoundation/nova/feature_assets/presentation/balance/list/view/PezkuwiDashboardAdapter.kt
@@ -2,6 +2,8 @@ package io.novafoundation.nova.feature_assets.presentation.balance.list.view
import android.content.res.ColorStateList
import android.graphics.Color
+import android.transition.AutoTransition
+import android.transition.TransitionManager
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
@@ -29,6 +31,10 @@ class PezkuwiDashboardAdapter(
private var model: PezkuwiDashboardModel? = null
private var trackingLoading: Boolean = false
+ // Survives ViewHolder recycling (scroll) within the process, but not process restart —
+ // resets to collapsed (false) whenever the app is freshly opened, by design.
+ private var isExpanded: Boolean = false
+
fun setModel(model: PezkuwiDashboardModel) {
this.model = model
notifyChangedIfShown()
@@ -41,11 +47,11 @@ class PezkuwiDashboardAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PezkuwiDashboardHolder {
val binding = ItemPezkuwiDashboardBinding.inflate(parent.inflater(), parent, false)
- return PezkuwiDashboardHolder(binding, handler)
+ return PezkuwiDashboardHolder(binding, handler) { expanded -> isExpanded = expanded }
}
override fun onBindViewHolder(holder: PezkuwiDashboardHolder, position: Int) {
- model?.let { holder.bind(it, trackingLoading) }
+ model?.let { holder.bind(it, trackingLoading, isExpanded) }
}
override fun getItemViewType(position: Int): Int {
@@ -55,7 +61,8 @@ class PezkuwiDashboardAdapter(
class PezkuwiDashboardHolder(
private val binder: ItemPezkuwiDashboardBinding,
- handler: PezkuwiDashboardAdapter.Handler
+ handler: PezkuwiDashboardAdapter.Handler,
+ private val onExpandedChanged: (Boolean) -> Unit
) : RecyclerView.ViewHolder(binder.root) {
companion object : WithViewType {
@@ -67,14 +74,30 @@ class PezkuwiDashboardHolder(
binder.pezkuwiDashboardSignButton.setOnClickListener { handler.onSignClicked() }
binder.pezkuwiDashboardShareButton.setOnClickListener { handler.onShareReferralClicked() }
binder.pezkuwiDashboardStartTrackingButton.setOnClickListener { handler.onStartTrackingClicked() }
+
+ binder.pezkuwiDashboardCollapsedBar.setOnClickListener { setExpanded(true) }
+ binder.pezkuwiDashboardCollapseButton.setOnClickListener { setExpanded(false) }
}
- fun bind(model: PezkuwiDashboardModel, trackingLoading: Boolean = false) {
+ private fun setExpanded(expanded: Boolean) {
+ TransitionManager.beginDelayedTransition(binder.pezkuwiDashboardRoot, AutoTransition().apply { duration = 200 })
+ binder.pezkuwiDashboardCollapsedBar.visibility = if (expanded) View.GONE else View.VISIBLE
+ binder.pezkuwiDashboardExpandedContent.visibility = if (expanded) View.VISIBLE else View.GONE
+ onExpandedChanged(expanded)
+ }
+
+ fun bind(model: PezkuwiDashboardModel, trackingLoading: Boolean = false, isExpanded: Boolean = false) {
bindRoles(model.roles)
binder.pezkuwiDashboardTrustValue.text = model.trustScore
+ binder.pezkuwiDashboardTrustValueCollapsed.text = model.trustScore
binder.pezkuwiDashboardWelatiCount.text = model.welatiCount
bindButtons(model.citizenshipStatus)
+ // Reflect current expand state without animating (this runs on every bind/rebind,
+ // e.g. after RecyclerView recycling — animation is only for user-initiated toggles).
+ binder.pezkuwiDashboardCollapsedBar.visibility = if (isExpanded) View.GONE else View.VISIBLE
+ binder.pezkuwiDashboardExpandedContent.visibility = if (isExpanded) View.VISIBLE else View.GONE
+
val showTracking = !model.isTrackingScore && model.citizenshipStatus == CitizenshipStatus.APPROVED
binder.pezkuwiDashboardStartTrackingButton.visibility = if (showTracking) View.VISIBLE else View.GONE
diff --git a/feature-assets/src/main/res/drawable/bg_pezkuwi_dashboard_collapsed.xml b/feature-assets/src/main/res/drawable/bg_pezkuwi_dashboard_collapsed.xml
new file mode 100644
index 00000000..eb131abc
--- /dev/null
+++ b/feature-assets/src/main/res/drawable/bg_pezkuwi_dashboard_collapsed.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
diff --git a/feature-assets/src/main/res/layout/item_pezkuwi_dashboard.xml b/feature-assets/src/main/res/layout/item_pezkuwi_dashboard.xml
index 53d795b9..ad70aa25 100644
--- a/feature-assets/src/main/res/layout/item_pezkuwi_dashboard.xml
+++ b/feature-assets/src/main/res/layout/item_pezkuwi_dashboard.xml
@@ -10,151 +10,218 @@
app:strokeWidth="0dp">
+ android:orientation="vertical">
-
+
+ android:orientation="horizontal"
+ android:paddingHorizontal="16dp">
-
+ android:text="@string/pezkuwi_dashboard_trust_score"
+ android:textColor="@android:color/white"
+ android:textSize="13sp"
+ android:textStyle="bold" />
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:gravity="end"
+ android:orientation="vertical">
-
+
+
+
+
+
+
+
+ android:layout_marginTop="14dp"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
+
+
-
+ android:layout_height="32dp"
+ android:layout_marginStart="8dp"
+ android:minWidth="0dp"
+ android:paddingHorizontal="10dp"
+ android:text="@string/pezkuwi_dashboard_start_tracking"
+ android:textAllCaps="false"
+ android:textColor="@android:color/white"
+ android:textSize="11sp"
+ android:visibility="gone"
+ app:backgroundTint="#009639"
+ app:cornerRadius="8dp" />
-
-
-
-
-
-
-
-
+
+ app:cornerRadius="14dp" />
+
+
+
+
-
-
-
-
-
-
-