diff options
author | Iván Ávalos <avalos@disroot.org> | 2024-04-22 08:43:57 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2024-04-23 13:16:06 -0600 |
commit | 0a9d62ae374e72db8d958a1bbe265decc1a69da9 (patch) | |
tree | dc1b330d94c14c5b38d09f859aa18413a5bc570a | |
parent | 2b2416cc54bf0659927a64818e92ad99cae6916f (diff) | |
download | taler-android-0a9d62ae374e72db8d958a1bbe265decc1a69da9.tar.gz taler-android-0a9d62ae374e72db8d958a1bbe265decc1a69da9.tar.bz2 taler-android-0a9d62ae374e72db8d958a1bbe265decc1a69da9.zip |
[wallet] DD53: address balance-list issues
bug 0008726
4 files changed, 22 insertions, 53 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt b/wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt index f40def4..aabef4b 100644 --- a/wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt +++ b/wallet/src/main/java/net/taler/wallet/balances/BalanceAdapter.kt @@ -61,8 +61,7 @@ class BalanceAdapter(private val listener: BalanceClickListener) : Adapter<Balan private val amountView: TextView = v.findViewById(R.id.balanceAmountView) private val scopeView: TextView = v.findViewById(R.id.scopeView) private val balanceInboundAmount: TextView = v.findViewById(R.id.balanceInboundAmount) - private val balanceInboundLabel: TextView = v.findViewById(R.id.balanceInboundLabel) - private val pendingView: TextView = v.findViewById(R.id.pendingView) + private val balanceOutboundAmount: TextView = v.findViewById(R.id.balanceOutboundAmount) fun bind(item: BalanceItem) { v.setOnClickListener { listener.onBalanceClick(item.scopeInfo) } @@ -71,11 +70,17 @@ class BalanceAdapter(private val listener: BalanceClickListener) : Adapter<Balan val amountIncoming = item.pendingIncoming if (amountIncoming.isZero()) { balanceInboundAmount.visibility = GONE - balanceInboundLabel.visibility = GONE } else { balanceInboundAmount.visibility = VISIBLE - balanceInboundLabel.visibility = VISIBLE - balanceInboundAmount.text = v.context.getString(R.string.amount_positive, amountIncoming.toString(showSymbol = false)) + balanceInboundAmount.text = v.context.getString(R.string.balances_inbound_amount, amountIncoming.toString(showSymbol = false)) + } + + val amountOutgoing = item.pendingOutgoing + if (amountOutgoing.isZero()) { + balanceOutboundAmount.visibility = GONE + } else { + balanceOutboundAmount.visibility = VISIBLE + balanceOutboundAmount.text = v.context.getString(R.string.balances_outbound_amount, amountOutgoing.toString(showSymbol = false)) } val scopeInfo = item.scopeInfo @@ -90,8 +95,6 @@ class BalanceAdapter(private val listener: BalanceClickListener) : Adapter<Balan VISIBLE } } - - pendingView.visibility = if (item.hasPending) VISIBLE else GONE } } diff --git a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt index cd11591..49e88a1 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt @@ -158,9 +158,7 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode. super.onStart() requireActivity().title = getString(R.string.transactions_detail_title_currency, scopeInfo.currency) (requireActivity() as AppCompatActivity).supportActionBar?.subtitle = - (scopeInfo as? ScopeInfo.Exchange)?.url?.let { - getString(R.string.balance_scope_exchange, cleanExchange(it)) - } + (scopeInfo as? ScopeInfo.Exchange)?.url?.let { cleanExchange(it) } } private fun setupSearch(item: MenuItem) { diff --git a/wallet/src/main/res/layout/list_item_balance.xml b/wallet/src/main/res/layout/list_item_balance.xml index 53e3d89..6e5e440 100644 --- a/wallet/src/main/res/layout/list_item_balance.xml +++ b/wallet/src/main/res/layout/list_item_balance.xml @@ -14,9 +14,9 @@ ~ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> --> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/selectableItemBackground" @@ -26,26 +26,16 @@ android:id="@+id/balanceAmountView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginEnd="8dp" style="?textAppearanceDisplaySmall" - app:layout_constraintEnd_toStartOf="@+id/pendingView" - app:layout_constraintHorizontal_bias="0.0" - app:layout_constraintHorizontal_chainStyle="packed" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" tools:text="100.50" /> <TextView android:id="@+id/scopeView" - android:layout_width="0dp" + android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" style="?textAppearanceBodyMedium" android:visibility="gone" - app:layout_constraintTop_toBottomOf="@id/balanceAmountView" - app:layout_constraintBottom_toTopOf="@id/balanceInboundAmount" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintEnd_toStartOf="@id/pendingView" tools:text="@string/balance_scope_exchange" tools:visibility="visible"/> @@ -54,40 +44,17 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/green" - android:textSize="20sp" style="?textAppearanceBodyLarge" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toStartOf="@+id/balanceInboundLabel" - app:layout_constraintHorizontal_bias="0.0" - app:layout_constraintHorizontal_chainStyle="packed" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@+id/scopeView" - tools:text="+10 TESTKUDOS" + tools:text="+10 TESTKUDOS inbound" tools:visibility="visible" /> <TextView - android:id="@+id/balanceInboundLabel" + android:id="@+id/balanceOutboundAmount" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:text="@string/balances_inbound_label" - android:textColor="@color/green" - style="?textAppearanceBodyMedium" - app:layout_constraintBottom_toBottomOf="@+id/balanceInboundAmount" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toEndOf="@+id/balanceInboundAmount" - app:layout_constraintTop_toTopOf="@+id/balanceInboundAmount" + android:textColor="?colorError" + style="?textAppearanceBodyLarge" + tools:text="-10 TESTKUDOS outbound" tools:visibility="visible" /> - <TextView - android:id="@+id/pendingView" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:background="@drawable/badge" - android:text="@string/transaction_pending" - android:textColor="?android:textColorPrimaryInverse" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - -</androidx.constraintlayout.widget.ConstraintLayout> +</LinearLayout> diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml index 2336357..ff19474 100644 --- a/wallet/src/main/res/values/strings.xml +++ b/wallet/src/main/res/values/strings.xml @@ -81,7 +81,8 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="amount_chosen">Chosen Amount</string> <string name="amount_sent">Amount sent</string> <string name="amount_received">Amount received</string> - <string name="balances_inbound_label">inbound</string> + <string name="balances_inbound_amount">+%1$s inbound</string> + <string name="balances_outbound_amount">-%1$s outbound</string> <string name="balances_empty_state">There is no digital cash in your wallet.\n\nYou can get test money from the demo bank:\n\nhttps://bank.demo.taler.net</string> <string name="balance_scope_exchange">From %1$s</string> <string name="balance_scope_auditor">Auditor: %1$s</string> |