aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-05-14 15:38:36 -0300
committerTorsten Grote <t@grobox.de>2020-05-15 14:26:43 -0300
commitdfc0db1432b181723e20efc01d46335ffd53115d (patch)
treef58fd9c067467c138fadbdf59292188f5bc3282d
parent7f36a54e5781c56d538f007f5565d79e1a2285fc (diff)
downloadtaler-android-dfc0db1432b181723e20efc01d46335ffd53115d.tar.gz
taler-android-dfc0db1432b181723e20efc01d46335ffd53115d.tar.bz2
taler-android-dfc0db1432b181723e20efc01d46335ffd53115d.zip
[wallet] provide extra info in transactions when withdrawal requires confirmation
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt27
-rw-r--r--wallet/src/main/res/layout/list_item_transaction.xml43
-rw-r--r--wallet/src/main/res/values/strings.xml1
3 files changed, 46 insertions, 25 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 a2cd2e8..f93dd66 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionAdapter.kt
@@ -70,12 +70,12 @@ internal class TransactionAdapter(
tracker.select(it.transactionId)
}
- internal open inner class TransactionViewHolder(private val v: View) : ViewHolder(v) {
-
- protected val context: Context = v.context
+ internal inner class TransactionViewHolder(private val v: View) : ViewHolder(v) {
+ private val context: Context = v.context
private val icon: ImageView = v.findViewById(R.id.icon)
- protected val title: TextView = v.findViewById(R.id.title)
+ private val title: TextView = v.findViewById(R.id.title)
+ private val extraInfoView: TextView = v.findViewById(R.id.extraInfoView)
private val time: TextView = v.findViewById(R.id.time)
private val amount: TextView = v.findViewById(R.id.amount)
private val pendingView: TextView = v.findViewById(R.id.pendingView)
@@ -85,18 +85,19 @@ internal class TransactionAdapter(
private val red = context.getColor(R.color.red)
private val green = context.getColor(R.color.green)
- open fun bind(transaction: Transaction, selected: Boolean) {
- if (transaction.detailPageLayout != 0) {
- v.foreground = selectableForeground
- v.setOnClickListener { listener.onTransactionClicked(transaction) }
- } else {
- v.foreground = null
- v.setOnClickListener(null)
- }
+ fun bind(transaction: Transaction, selected: Boolean) {
+ v.foreground = selectableForeground
+ v.setOnClickListener { listener.onTransactionClicked(transaction) }
v.isActivated = selected
- icon.setImageResource(transaction.icon)
+ icon.setImageResource(transaction.icon)
title.text = transaction.getTitle(context)
+ if (transaction is TransactionWithdrawal && !transaction.confirmed) {
+ extraInfoView.setText(R.string.withdraw_waiting_confirm)
+ extraInfoView.visibility = VISIBLE
+ } else {
+ extraInfoView.visibility = GONE
+ }
time.text = transaction.timestamp.ms.toRelativeTime(context)
bindAmount(transaction)
pendingView.visibility = if (transaction.pending) VISIBLE else GONE
diff --git a/wallet/src/main/res/layout/list_item_transaction.xml b/wallet/src/main/res/layout/list_item_transaction.xml
index 058b170..a35ac30 100644
--- a/wallet/src/main/res/layout/list_item_transaction.xml
+++ b/wallet/src/main/res/layout/list_item_transaction.xml
@@ -44,20 +44,24 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="8dp"
- app:layout_constraintEnd_toStartOf="@+id/amount"
+ app:layout_constraintEnd_toStartOf="@+id/barrier"
app:layout_constraintStart_toEndOf="@+id/icon"
app:layout_constraintTop_toTopOf="parent"
tools:text="@string/transaction_payment" />
<TextView
- android:id="@+id/amount"
- android:layout_width="wrap_content"
+ android:id="@+id/extraInfoView"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
- android:textSize="24sp"
- app:layout_constraintBottom_toTopOf="@+id/pendingView"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- tools:text="- 1337.23" />
+ android:layout_marginTop="8dp"
+ android:layout_marginEnd="8dp"
+ android:textSize="14sp"
+ android:visibility="gone"
+ app:layout_constraintEnd_toStartOf="@+id/barrier"
+ app:layout_constraintStart_toStartOf="@+id/title"
+ app:layout_constraintTop_toBottomOf="@+id/title"
+ tools:text="@string/withdraw_waiting_confirm"
+ tools:visibility="visible" />
<TextView
android:id="@+id/time"
@@ -67,11 +71,28 @@
android:layout_marginEnd="8dp"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/amount"
+ app:layout_constraintEnd_toStartOf="@+id/barrier"
app:layout_constraintStart_toStartOf="@+id/title"
- app:layout_constraintTop_toBottomOf="@+id/title"
+ app:layout_constraintTop_toBottomOf="@+id/extraInfoView"
tools:text="23 min ago" />
+ <androidx.constraintlayout.widget.Barrier
+ android:id="@+id/barrier"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:barrierDirection="start"
+ app:constraint_referenced_ids="amount,pendingView" />
+
+ <TextView
+ android:id="@+id/amount"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="24sp"
+ app:layout_constraintBottom_toTopOf="@+id/pendingView"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ tools:text="- 1337.23" />
+
<TextView
android:id="@+id/pendingView"
android:layout_width="wrap_content"
@@ -81,8 +102,6 @@
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintHorizontal_bias="1.0"
- app:layout_constraintStart_toEndOf="@+id/time"
app:layout_constraintTop_toBottomOf="@+id/amount"
tools:visibility="visible" />
diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml
index 1f2d80c..e408365 100644
--- a/wallet/src/main/res/values/strings.xml
+++ b/wallet/src/main/res/values/strings.xml
@@ -114,6 +114,7 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card
<string name="withdraw_button_confirm">Confirm Withdraw</string>
<string name="withdraw_button_confirm_bank">Confirm with bank</string>
<string name="withdraw_button_tos">Review Terms</string>
+ <string name="withdraw_waiting_confirm">Waiting for confirmation</string>
<string name="withdraw_error_title">Withdrawal Error</string>
<string name="withdraw_error_message">Withdrawing is currently not possible. Please try again later!</string>