aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-01-05 18:56:44 -0600
committerIván Ávalos <avalos@disroot.org>2023-01-05 18:56:44 -0600
commit7b9e081d6323a89870d4787592f1ec2930b9fe14 (patch)
tree7ab57a99cab90f8b762b635dbfd11af4bed0b09c
parent6f45cd9e9f4e25df5048854cc421178f1cd66a59 (diff)
downloadtaler-android-bug-7478.tar.gz
taler-android-bug-7478.tar.bz2
taler-android-bug-7478.zip
[wallet] Transactions background changes when selecting with a long pressbug-7478
#0007478
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt6
-rw-r--r--wallet/src/main/res/layout/list_item_transaction.xml1
-rw-r--r--wallet/src/main/res/values/colors.xml1
3 files changed, 8 insertions, 0 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
index b8bf9af..300c1ff 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
@@ -25,6 +25,7 @@ import android.view.View.VISIBLE
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
+import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat.getColor
import androidx.recyclerview.selection.ItemDetailsLookup
import androidx.recyclerview.selection.ItemKeyProvider
@@ -74,6 +75,7 @@ internal class TransactionAdapter(
internal inner class TransactionViewHolder(private val v: View) : ViewHolder(v) {
private val context: Context = v.context
+ private val root: ConstraintLayout = v.findViewById(R.id.root)
private val icon: ImageView = v.findViewById(R.id.icon)
private val title: TextView = v.findViewById(R.id.title)
private val extraInfoView: TextView = v.findViewById(R.id.extraInfoView)
@@ -98,6 +100,10 @@ internal class TransactionAdapter(
time.text = transaction.timestamp.ms.toRelativeTime(context)
bindAmount(transaction)
pendingView.visibility = if (transaction.pending) VISIBLE else GONE
+ val bgColor = getColor(context,
+ if (selected) R.color.selectedBackground
+ else R.color.transparent)
+ root.setBackgroundColor(bgColor)
}
private fun bindExtraInfo(transaction: Transaction) {
diff --git a/wallet/src/main/res/layout/list_item_transaction.xml b/wallet/src/main/res/layout/list_item_transaction.xml
index ed031c3..64d9045 100644
--- a/wallet/src/main/res/layout/list_item_transaction.xml
+++ b/wallet/src/main/res/layout/list_item_transaction.xml
@@ -17,6 +17,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
diff --git a/wallet/src/main/res/values/colors.xml b/wallet/src/main/res/values/colors.xml
index ba2804e..3069e3d 100644
--- a/wallet/src/main/res/values/colors.xml
+++ b/wallet/src/main/res/values/colors.xml
@@ -18,4 +18,5 @@
<color name="colorPrimary">#3047a3</color>
<color name="colorPrimaryDark">#152238</color>
<color name="colorAccent">#BB1D24</color>
+ <color name="transparent">#00000000</color>
</resources>