aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2022-08-23 14:20:21 -0300
committerTorsten Grote <t@grobox.de>2022-08-23 14:42:24 -0300
commit07098f6660b19320bed36d24758464c662c74531 (patch)
tree1790f6389a192957b49544fe2038544bd5458a49
parent2fbda24d2205ace0ede93faa824f7836d0ece445 (diff)
downloadtaler-android-07098f6660b19320bed36d24758464c662c74531.tar.gz
taler-android-07098f6660b19320bed36d24758464c662c74531.tar.bz2
taler-android-07098f6660b19320bed36d24758464c662c74531.zip
[wallet] Move balance down in transaction list
and show new buttons for sending/receiving (not functional yet)
-rw-r--r--wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt8
-rw-r--r--wallet/src/main/res/layout/fragment_transactions.xml90
-rw-r--r--wallet/src/main/res/values/strings.xml5
3 files changed, 96 insertions, 7 deletions
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 dd0af84..f5840ab 100644
--- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt
@@ -106,8 +106,7 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode.
// hide extra fab when in single currency mode (uses MainFragment's FAB)
if (balances.size == 1) ui.mainFab.visibility = INVISIBLE
balances.find { it.currency == currency }?.available?.let { amount: Amount ->
- requireActivity().title =
- getString(R.string.transactions_detail_title_balance, amount)
+ ui.amount.text = amount.amountStr
}
}
transactionManager.progress.observe(viewLifecycleOwner) { show ->
@@ -136,6 +135,11 @@ class TransactionsFragment : Fragment(), OnTransactionClickListener, ActionMode.
setupSearch(menu.findItem(R.id.action_search))
}
+ override fun onStart() {
+ super.onStart()
+ requireActivity().title = getString(R.string.transactions_detail_title_currency, currency)
+ }
+
private fun setupSearch(item: MenuItem) {
item.setOnActionExpandListener(object : MenuItem.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem) = true
diff --git a/wallet/src/main/res/layout/fragment_transactions.xml b/wallet/src/main/res/layout/fragment_transactions.xml
index 22d6d48..60675bb 100644
--- a/wallet/src/main/res/layout/fragment_transactions.xml
+++ b/wallet/src/main/res/layout/fragment_transactions.xml
@@ -14,19 +14,91 @@
~ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<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:layout_width="match_parent"
android:layout_height="match_parent">
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/sendButton"
+ style="@style/Widget.MaterialComponents.Button.TextButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/transactions_send_funds"
+ app:layout_constraintBottom_toTopOf="@+id/divider"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/receiveButton"
+ style="@style/Widget.MaterialComponents.Button.TextButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/transactions_receive_funds"
+ app:layout_constraintBottom_toTopOf="@+id/divider"
+ app:layout_constraintEnd_toStartOf="@+id/amount"
+ app:layout_constraintHorizontal_chainStyle="spread_inside"
+ app:layout_constraintStart_toEndOf="@+id/sendButton"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/balanceLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="8dp"
+ android:layout_marginEnd="16dp"
+ android:text="@string/transactions_balance"
+ android:textSize="14sp"
+ app:layout_constraintBottom_toTopOf="@+id/amount"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="1.0"
+ app:layout_constraintStart_toEndOf="@+id/receiveButton"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/amount"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="16dp"
+ android:layout_marginBottom="8dp"
+ android:textSize="24sp"
+ android:textStyle="bold"
+ app:layout_constrainedWidth="true"
+ app:layout_constraintBottom_toTopOf="@+id/divider"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/receiveButton"
+ app:layout_constraintTop_toBottomOf="@+id/balanceLabel"
+ tools:text="23.42"
+ tools:visibility="visible" />
+
+ <androidx.constraintlayout.widget.Barrier
+ android:id="@+id/topBarrier"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ app:barrierDirection="bottom"
+ app:constraint_referenced_ids="sendButton,receiveButton,amount" />
+
+ <com.google.android.material.divider.MaterialDivider
+ android:id="@+id/divider"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/topBarrier" />
+
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="0dp"
android:scrollbars="vertical"
android:visibility="invisible"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/divider"
tools:listitem="@layout/list_item_transaction"
tools:visibility="visible" />
@@ -37,6 +109,10 @@
android:layout_gravity="center"
android:text="@string/transactions_empty"
android:visibility="invisible"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/divider"
tools:visibility="visible" />
<ProgressBar
@@ -46,6 +122,10 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/divider"
tools:visibility="visible" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
@@ -55,6 +135,8 @@
android:layout_height="wrap_content"
android:contentDescription="@string/button_scan_qr_code"
android:src="@drawable/ic_scan_qr"
- app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior" />
+ app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
-</FrameLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml
index d1a0c78..d9c4792 100644
--- a/wallet/src/main/res/values/strings.xml
+++ b/wallet/src/main/res/values/strings.xml
@@ -70,11 +70,14 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card
<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="transactions_title">Transactions</string>
+ <string name="transactions_balance">Balance</string>
+ <string name="transactions_send_funds">Send\nFunds</string>
+ <string name="transactions_receive_funds">Receive\nFunds</string>
<string name="transactions_empty">You don\'t have any transactions</string>
<string name="transactions_empty_search">No transactions found. Try a different search.</string>
<string name="transactions_error">Could not load transactions\n\n%s</string>
<string name="transactions_detail_title">Transaction</string>
- <string name="transactions_detail_title_balance">Balance: %s</string>
+ <string name="transactions_detail_title_currency">%s Transactions</string>
<string name="transactions_delete">Delete</string>
<string name="transactions_select_all">Select All</string>
<string name="transactions_delete_dialog_title">Delete Transaction</string>