[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-android] branch master updated (b666242 -> 09b66e7)
From: |
gnunet |
Subject: |
[taler-wallet-android] branch master updated (b666242 -> 09b66e7) |
Date: |
Thu, 05 Mar 2020 19:53:04 +0100 |
This is an automated email from the git hooks/post-receive script.
torsten-grote pushed a change to branch master
in repository wallet-android.
from b666242 Don't restart withdrawal process after accepting ToS
new b9f573b Turn on dev mode by default for debug builds
new 630f199 Factor out history code from ViewModel
new 44693dd Clean up balances UI
new 09b66e7 Use better icons for navigation drawer menu
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../wallet/{ShowBalance.kt => BalanceFragment.kt} | 25 +++---
.../main/java/net/taler/wallet/WalletViewModel.kt | 51 +-----------
.../net/taler/wallet/history/HistoryManager.kt | 71 +++++++++++++++++
.../{WalletHistory.kt => WalletHistoryFragment.kt} | 72 ++++++++---------
.../res/drawable/ic_account_balance_wallet.xml | 9 +++
app/src/main/res/drawable/ic_menu_manage.xml | 25 ------
app/src/main/res/drawable/ic_settings.xml | 9 +++
app/src/main/res/drawable/ic_sync.xml | 9 +++
app/src/main/res/layout/balance_row.xml | 90 ----------------------
app/src/main/res/layout/fragment_show_balance.xml | 5 +-
.../{history_payment.xml => list_item_balance.xml} | 82 +++++++++-----------
app/src/main/res/layout/nav_header_main.xml | 22 +++---
app/src/main/res/menu/activity_main_drawer.xml | 13 ++--
app/src/main/res/navigation/nav_graph.xml | 6 +-
app/src/main/res/values/strings.xml | 16 ++--
15 files changed, 215 insertions(+), 290 deletions(-)
rename app/src/main/java/net/taler/wallet/{ShowBalance.kt =>
BalanceFragment.kt} (87%)
create mode 100644 app/src/main/java/net/taler/wallet/history/HistoryManager.kt
rename app/src/main/java/net/taler/wallet/history/{WalletHistory.kt =>
WalletHistoryFragment.kt} (76%)
create mode 100644 app/src/main/res/drawable/ic_account_balance_wallet.xml
delete mode 100644 app/src/main/res/drawable/ic_menu_manage.xml
create mode 100644 app/src/main/res/drawable/ic_settings.xml
create mode 100644 app/src/main/res/drawable/ic_sync.xml
delete mode 100644 app/src/main/res/layout/balance_row.xml
copy app/src/main/res/layout/{history_payment.xml => list_item_balance.xml}
(50%)
diff --git a/app/src/main/java/net/taler/wallet/ShowBalance.kt
b/app/src/main/java/net/taler/wallet/BalanceFragment.kt
similarity index 87%
rename from app/src/main/java/net/taler/wallet/ShowBalance.kt
rename to app/src/main/java/net/taler/wallet/BalanceFragment.kt
index 71ef87f..b9f5818 100644
--- a/app/src/main/java/net/taler/wallet/ShowBalance.kt
+++ b/app/src/main/java/net/taler/wallet/BalanceFragment.kt
@@ -16,7 +16,6 @@
package net.taler.wallet
-import android.annotation.SuppressLint
import android.os.Bundle
import android.transition.TransitionManager.beginDelayedTransition
import android.util.Log
@@ -42,7 +41,7 @@ import
com.google.zxing.integration.android.IntentIntegrator.QR_CODE_TYPES
import kotlinx.android.synthetic.main.fragment_show_balance.*
import net.taler.wallet.BalanceAdapter.BalanceViewHolder
-class ShowBalance : Fragment() {
+class BalanceFragment : Fragment() {
private val model: WalletViewModel by activityViewModels()
private val withdrawManager by lazy { model.withdrawManager }
@@ -148,7 +147,8 @@ class BalanceAdapter : Adapter<BalanceViewHolder>() {
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int):
BalanceViewHolder {
- val v =
LayoutInflater.from(parent.context).inflate(R.layout.balance_row, parent, false)
+ val v =
+
LayoutInflater.from(parent.context).inflate(R.layout.list_item_balance, parent,
false)
return BalanceViewHolder(v)
}
@@ -164,11 +164,11 @@ class BalanceAdapter : Adapter<BalanceViewHolder>() {
this.notifyDataSetChanged()
}
- class BalanceViewHolder(v: View) : ViewHolder(v) {
+ class BalanceViewHolder(private val v: View) : ViewHolder(v) {
private val currencyView: TextView =
v.findViewById(R.id.balance_currency)
private val amountView: TextView = v.findViewById(R.id.balance_amount)
- private val amountIncomingRow: View =
v.findViewById(R.id.balance_row_pending)
- private val amountIncomingView: TextView =
v.findViewById(R.id.balance_pending)
+ private val balanceInboundAmount: TextView =
v.findViewById(R.id.balanceInboundAmount)
+ private val balanceInboundLabel: TextView =
v.findViewById(R.id.balanceInboundLabel)
fun bind(item: BalanceItem) {
currencyView.text = item.available.currency
@@ -176,11 +176,16 @@ class BalanceAdapter : Adapter<BalanceViewHolder>() {
val amountIncoming = item.pendingIncoming
if (amountIncoming.isZero()) {
- amountIncomingRow.visibility = GONE
+ balanceInboundAmount.visibility = GONE
+ balanceInboundLabel.visibility = GONE
} else {
- amountIncomingRow.visibility = VISIBLE
- @SuppressLint("SetTextI18n")
- amountIncomingView.text = "${amountIncoming.amount}
${amountIncoming.currency}"
+ balanceInboundAmount.visibility = VISIBLE
+ balanceInboundLabel.visibility = VISIBLE
+ balanceInboundAmount.text = v.context.getString(
+ R.string.balances_inbound_amount,
+ amountIncoming.amount,
+ amountIncoming.currency
+ )
}
}
}
diff --git a/app/src/main/java/net/taler/wallet/WalletViewModel.kt
b/app/src/main/java/net/taler/wallet/WalletViewModel.kt
index 1126ced..14a800f 100644
--- a/app/src/main/java/net/taler/wallet/WalletViewModel.kt
+++ b/app/src/main/java/net/taler/wallet/WalletViewModel.kt
@@ -22,21 +22,12 @@ import androidx.annotation.UiThread
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
-import androidx.lifecycle.asLiveData
import androidx.lifecycle.distinctUntilChanged
-import androidx.lifecycle.switchMap
import
com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
-import com.fasterxml.jackson.module.kotlin.readValue
-import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.channels.awaitClose
-import kotlinx.coroutines.flow.callbackFlow
-import kotlinx.coroutines.flow.onCompletion
-import kotlinx.coroutines.flow.onStart
import net.taler.wallet.backend.WalletBackendApi
-import net.taler.wallet.history.History
-import net.taler.wallet.history.HistoryEvent
+import net.taler.wallet.history.HistoryManager
import net.taler.wallet.payment.PaymentManager
import net.taler.wallet.pending.PendingOperationsManager
import net.taler.wallet.withdraw.WithdrawManager
@@ -46,26 +37,12 @@ const val TAG = "taler-wallet"
data class BalanceItem(val available: Amount, val pendingIncoming: Amount)
-@Suppress("EXPERIMENTAL_API_USAGE")
class WalletViewModel(val app: Application) : AndroidViewModel(app) {
private val mBalances = MutableLiveData<List<BalanceItem>>()
val balances: LiveData<List<BalanceItem>> =
mBalances.distinctUntilChanged()
- val devMode = MutableLiveData(false)
-
- private val mHistoryProgress = MutableLiveData<Boolean>()
- val historyProgress: LiveData<Boolean> = mHistoryProgress
-
- val historyShowAll = MutableLiveData<Boolean>()
-
- val history: LiveData<History> = historyShowAll.switchMap { showAll ->
- loadHistory(showAll)
- .onStart { mHistoryProgress.postValue(true) }
- .onCompletion { mHistoryProgress.postValue(false) }
- .asLiveData(Dispatchers.IO)
- }
-
+ val devMode = MutableLiveData(BuildConfig.DEBUG)
val showProgressBar = MutableLiveData<Boolean>()
private var activeGetBalance = 0
@@ -88,6 +65,7 @@ class WalletViewModel(val app: Application) :
AndroidViewModel(app) {
val paymentManager = PaymentManager(walletBackendApi, mapper)
val pendingOperationsManager: PendingOperationsManager =
PendingOperationsManager(walletBackendApi)
+ val historyManager = HistoryManager(walletBackendApi, mapper)
override fun onCleared() {
walletBackendApi.destroy()
@@ -123,29 +101,6 @@ class WalletViewModel(val app: Application) :
AndroidViewModel(app) {
}
}
- private fun loadHistory(showAll: Boolean) = callbackFlow {
- mHistoryProgress.postValue(true)
- walletBackendApi.sendRequest("getHistory", null) { isError, result ->
- if (isError) {
- // TODO show error message in [WalletHistory] fragment
- close()
- return@sendRequest
- }
- val history = History()
- val json = result.getJSONArray("history")
- for (i in 0 until json.length()) {
- val event: HistoryEvent = mapper.readValue(json.getString(i))
- event.json = json.getJSONObject(i)
- history.add(event)
- }
- history.reverse() // show latest first
- mHistoryProgress.postValue(false)
- offer(if (showAll) history else history.filter { it.showToUser }
as History)
- close()
- }
- awaitClose()
- }
-
@UiThread
fun dangerouslyReset() {
walletBackendApi.sendRequest("reset", null)
diff --git a/app/src/main/java/net/taler/wallet/history/HistoryManager.kt
b/app/src/main/java/net/taler/wallet/history/HistoryManager.kt
new file mode 100644
index 0000000..c350daa
--- /dev/null
+++ b/app/src/main/java/net/taler/wallet/history/HistoryManager.kt
@@ -0,0 +1,71 @@
+/*
+ * This file is part of GNU Taler
+ * (C) 2020 Taler Systems S.A.
+ *
+ * GNU Taler is free software; you can redistribute it and/or modify it under
the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3, or (at your option) any later version.
+ *
+ * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+package net.taler.wallet.history
+
+import androidx.lifecycle.LiveData
+import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.asLiveData
+import androidx.lifecycle.switchMap
+import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.module.kotlin.readValue
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.channels.awaitClose
+import kotlinx.coroutines.flow.callbackFlow
+import kotlinx.coroutines.flow.onCompletion
+import kotlinx.coroutines.flow.onStart
+import net.taler.wallet.backend.WalletBackendApi
+
+@Suppress("EXPERIMENTAL_API_USAGE")
+class HistoryManager(
+ private val walletBackendApi: WalletBackendApi,
+ private val mapper: ObjectMapper
+) {
+
+ private val mProgress = MutableLiveData<Boolean>()
+ val progress: LiveData<Boolean> = mProgress
+
+ val showAll = MutableLiveData<Boolean>()
+
+ val history: LiveData<History> = showAll.switchMap { showAll ->
+ loadHistory(showAll)
+ .onStart { mProgress.postValue(true) }
+ .onCompletion { mProgress.postValue(false) }
+ .asLiveData(Dispatchers.IO)
+ }
+
+ private fun loadHistory(showAll: Boolean) = callbackFlow {
+ walletBackendApi.sendRequest("getHistory", null) { isError, result ->
+ if (isError) {
+ // TODO show error message in [WalletHistory] fragment
+ close()
+ return@sendRequest
+ }
+ val history = History()
+ val json = result.getJSONArray("history")
+ for (i in 0 until json.length()) {
+ val event: HistoryEvent = mapper.readValue(json.getString(i))
+ event.json = json.getJSONObject(i)
+ history.add(event)
+ }
+ history.reverse() // show latest first
+ offer(if (showAll) history else history.filter { it.showToUser }
as History)
+ close()
+ }
+ awaitClose()
+ }
+
+}
diff --git a/app/src/main/java/net/taler/wallet/history/WalletHistory.kt
b/app/src/main/java/net/taler/wallet/history/WalletHistoryFragment.kt
similarity index 76%
rename from app/src/main/java/net/taler/wallet/history/WalletHistory.kt
rename to app/src/main/java/net/taler/wallet/history/WalletHistoryFragment.kt
index bb37ffa..75b7d02 100644
--- a/app/src/main/java/net/taler/wallet/history/WalletHistory.kt
+++ b/app/src/main/java/net/taler/wallet/history/WalletHistoryFragment.kt
@@ -16,7 +16,6 @@
package net.taler.wallet.history
-
import android.os.Bundle
import android.view.LayoutInflater
import android.view.Menu
@@ -27,10 +26,11 @@ import android.view.View.INVISIBLE
import android.view.View.VISIBLE
import android.view.ViewGroup
import androidx.fragment.app.Fragment
+import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
-import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.LinearLayoutManager.VERTICAL
import kotlinx.android.synthetic.main.fragment_show_history.*
import net.taler.wallet.R
import net.taler.wallet.WalletViewModel
@@ -39,44 +39,16 @@ interface OnEventClickListener {
fun onEventClicked(event: HistoryEvent)
}
-/**
- * Wallet history.
- *
- */
-class WalletHistory : Fragment(), OnEventClickListener {
+class WalletHistoryFragment : Fragment(), OnEventClickListener {
- private lateinit var model: WalletViewModel
+ private val model: WalletViewModel by activityViewModels()
+ private val historyManager by lazy { model.historyManager }
private lateinit var showAllItem: MenuItem
private val historyAdapter = WalletHistoryAdapter(this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setHasOptionsMenu(true)
-
- model = activity?.run {
- ViewModelProvider(this)[WalletViewModel::class.java]
- } ?: throw Exception("Invalid Activity")
-
- }
-
- override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
- inflater.inflate(R.menu.history, menu)
- showAllItem = menu.findItem(R.id.show_all_history)
- }
-
- override fun onOptionsItemSelected(item: MenuItem): Boolean {
- return when (item.itemId) {
- R.id.show_all_history -> {
- item.isChecked = !item.isChecked
- model.historyShowAll.value = item.isChecked
- true
- }
- R.id.reload_history -> {
- model.historyShowAll.value = showAllItem.isChecked
- true
- }
- else -> super.onOptionsItemSelected(item)
- }
}
override fun onCreateView(
@@ -88,26 +60,46 @@ class WalletHistory : Fragment(), OnEventClickListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
historyList.apply {
- val myLayoutManager = LinearLayoutManager(context)
- val myItemDecoration = DividerItemDecoration(context,
myLayoutManager.orientation)
- layoutManager = myLayoutManager
+ layoutManager = LinearLayoutManager(context)
adapter = historyAdapter
- addItemDecoration(myItemDecoration)
+ addItemDecoration(DividerItemDecoration(context, VERTICAL))
}
- model.historyProgress.observe(viewLifecycleOwner, Observer { show ->
+ historyManager.progress.observe(viewLifecycleOwner, Observer { show ->
historyProgressBar.visibility = if (show) VISIBLE else INVISIBLE
})
- model.history.observe(viewLifecycleOwner, Observer { history ->
+ historyManager.history.observe(viewLifecycleOwner, Observer { history
->
historyEmptyState.visibility = if (history.isEmpty()) VISIBLE else
INVISIBLE
historyAdapter.update(history)
})
// kicks off initial load, needs to be adapted if showAll state is
ever saved
- if (savedInstanceState == null) model.historyShowAll.value = false
+ if (savedInstanceState == null) historyManager.showAll.value =
model.devMode.value
+ }
+
+ override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
+ inflater.inflate(R.menu.history, menu)
+ showAllItem = menu.findItem(R.id.show_all_history)
+ showAllItem.isChecked = historyManager.showAll.value == true
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem): Boolean {
+ return when (item.itemId) {
+ R.id.show_all_history -> {
+ item.isChecked = !item.isChecked
+ historyManager.showAll.value = item.isChecked
+ true
+ }
+ R.id.reload_history -> {
+ historyManager.showAll.value = showAllItem.isChecked
+ true
+ }
+ else -> super.onOptionsItemSelected(item)
+ }
}
override fun onEventClicked(event: HistoryEvent) {
+ if (model.devMode.value != true) return
JsonDialogFragment.new(event.json.toString(4))
.show(parentFragmentManager, null)
}
diff --git a/app/src/main/res/drawable/ic_account_balance_wallet.xml
b/app/src/main/res/drawable/ic_account_balance_wallet.xml
new file mode 100644
index 0000000..514b118
--- /dev/null
+++ b/app/src/main/res/drawable/ic_account_balance_wallet.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M21,18v1c0,1.1 -0.9,2 -2,2L5,21c-1.11,0 -2,-0.9
-2,-2L3,5c0,-1.1 0.89,-2 2,-2h14c1.1,0 2,0.9 2,2v1h-9c-1.11,0 -2,0.9
-2,2v8c0,1.1 0.89,2 2,2h9zM12,16h10L22,8L12,8v8zM16,13.5c-0.83,0 -1.5,-0.67
-1.5,-1.5s0.67,-1.5 1.5,-1.5 1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z" />
+</vector>
diff --git a/app/src/main/res/drawable/ic_menu_manage.xml
b/app/src/main/res/drawable/ic_menu_manage.xml
deleted file mode 100644
index f104384..0000000
--- a/app/src/main/res/drawable/ic_menu_manage.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
- ~ This file is part of GNU Taler
- ~ (C) 2020 Taler Systems S.A.
- ~
- ~ GNU Taler is free software; you can redistribute it and/or modify it under
the
- ~ terms of the GNU General Public License as published by the Free Software
- ~ Foundation; either version 3, or (at your option) any later version.
- ~
- ~ GNU Taler is distributed in the hope that it will be useful, but WITHOUT
ANY
- ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR
- ~ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- ~
- ~ You should have received a copy of the GNU General Public License along
with
- ~ GNU Taler; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>
- -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="24dp"
- android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0">
- <path
- android:fillColor="#FF000000"
- android:pathData="M22.7,19l-9.1,-9.1c0.9,-2.3 0.4,-5 -1.5,-6.9
-2,-2 -5,-2.4 -7.4,-1.3L9,6 6,9 1.6,4.7C0.4,7.1 0.9,10.1 2.9,12.1c1.9,1.9
4.6,2.4 6.9,1.5l9.1,9.1c0.4,0.4 1,0.4 1.4,0l2.3,-2.3c0.5,-0.4 0.5,-1.1
0.1,-1.4z"/>
-</vector>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/ic_settings.xml
b/app/src/main/res/drawable/ic_settings.xml
new file mode 100644
index 0000000..7cadd58
--- /dev/null
+++ b/app/src/main/res/drawable/ic_settings.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M19.1,12.9a2.8,2.8 0,0 0,0.1 -0.9,2.8 2.8,0 0,0
-0.1,-0.9l2.1,-1.6a0.7,0.7 0,0 0,0.1 -0.6L19.4,5.5a0.7,0.7 0,0 0,-0.6
-0.2l-2.4,1a6.5,6.5 0,0 0,-1.6 -0.9l-0.4,-2.6a0.5,0.5 0,0 0,-0.5
-0.4H10.1a0.5,0.5 0,0 0,-0.5 0.4L9.3,5.4a5.6,5.6 0,0 0,-1.7 0.9l-2.4,-1a0.4,0.4
0,0 0,-0.5 0.2l-2,3.4c-0.1,0.2 0,0.4 0.2,0.6l2,1.6a2.8,2.8 0,0 0,-0.1 0.9,2.8
2.8,0 0,0 0.1,0.9L2.8,14.5a0.7,0.7 0,0 0,-0.1 0.6l1.9,3.4a0.7,0.7 0,0 0,0.6
0.2l2.4,-1a6.5,6.5 0,0 0,1.6 0.9l0.4,2.6a0.5, [...]
+</vector>
diff --git a/app/src/main/res/drawable/ic_sync.xml
b/app/src/main/res/drawable/ic_sync.xml
new file mode 100644
index 0000000..78593fc
--- /dev/null
+++ b/app/src/main/res/drawable/ic_sync.xml
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,4L12,1L8,5l4,4L12,6c3.31,0 6,2.69 6,6 0,1.01
-0.25,1.97 -0.7,2.8l1.46,1.46C19.54,15.03 20,13.57 20,12c0,-4.42 -3.58,-8
-8,-8zM12,18c-3.31,0 -6,-2.69 -6,-6 0,-1.01 0.25,-1.97
0.7,-2.8L5.24,7.74C4.46,8.97 4,10.43 4,12c0,4.42 3.58,8 8,8v3l4,-4 -4,-4v3z" />
+</vector>
diff --git a/app/src/main/res/layout/balance_row.xml
b/app/src/main/res/layout/balance_row.xml
deleted file mode 100644
index 662068b..0000000
--- a/app/src/main/res/layout/balance_row.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ This file is part of GNU Taler
- ~ (C) 2020 Taler Systems S.A.
- ~
- ~ GNU Taler is free software; you can redistribute it and/or modify it under
the
- ~ terms of the GNU General Public License as published by the Free Software
- ~ Foundation; either version 3, or (at your option) any later version.
- ~
- ~ GNU Taler is distributed in the hope that it will be useful, but WITHOUT
ANY
- ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR
- ~ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- ~
- ~ You should have received a copy of the GNU General Public License along
with
- ~ GNU Taler; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>
- -->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <TextView
- android:id="@+id/balance_amount"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="40sp"
- tools:text="100.50" />
-
- <Space
- android:layout_width="10sp"
- android:layout_height="match_parent" />
-
- <TextView
- android:id="@+id/balance_currency"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textSize="20sp"
- tools:text="TESTKUDOS" />
-
- </LinearLayout>
-
- <LinearLayout
- android:id="@+id/balance_row_pending"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <Space
- android:layout_width="5sp"
- android:layout_height="match_parent" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="+"
- android:textColor="#006600"
- tools:ignore="HardcodedText" />
-
- <Space
- android:layout_width="5sp"
- android:layout_height="match_parent" />
-
- <TextView
- android:id="@+id/balance_pending"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="#006600"
- android:textSize="20sp"
- tools:text="10 TESTKUDOS" />
-
- <Space
- android:layout_width="5sp"
- android:layout_height="match_parent" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/balances_inbound"
- android:textColor="#006600" />
-
- </LinearLayout>
-
-
-</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_show_balance.xml
b/app/src/main/res/layout/fragment_show_balance.xml
index 5b38fb6..5bc6ee8 100644
--- a/app/src/main/res/layout/fragment_show_balance.xml
+++ b/app/src/main/res/layout/fragment_show_balance.xml
@@ -23,7 +23,6 @@
android:id="@+id/balancesList"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:layout_margin="16dp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/scanButton"
app:layout_constraintEnd_toEndOf="parent"
@@ -32,7 +31,7 @@
app:layout_constraintVertical_bias="0.0"
app:layout_constraintVertical_chainStyle="packed"
tools:layout_height="200dp"
- tools:listitem="@layout/balance_row"
+ tools:listitem="@layout/list_item_balance"
tools:visibility="visible" />
<TextView
@@ -49,7 +48,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- tools:visibility="visible" />
+ tools:visibility="gone" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier"
diff --git a/app/src/main/res/layout/history_payment.xml
b/app/src/main/res/layout/list_item_balance.xml
similarity index 50%
copy from app/src/main/res/layout/history_payment.xml
copy to app/src/main/res/layout/list_item_balance.xml
index dd135e7..f9c37b7 100644
--- a/app/src/main/res/layout/history_payment.xml
+++ b/app/src/main/res/layout/list_item_balance.xml
@@ -19,69 +19,59 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginStart="16dp"
- android:layout_marginTop="8dp"
- android:layout_marginEnd="16dp"
- android:layout_marginBottom="8dp"
- android:background="?attr/selectableItemBackground">
-
- <ImageView
- android:id="@+id/icon"
- android:layout_width="32dp"
- android:layout_height="32dp"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:srcCompat="@drawable/history_withdrawn"
- app:tint="?android:colorControlNormal"
- tools:ignore="ContentDescription" />
+ android:padding="16dp">
<TextView
- android:id="@+id/title"
- style="@style/HistoryTitle"
- android:layout_width="0dp"
+ android:id="@+id/balance_amount"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
- app:layout_constraintEnd_toStartOf="@+id/amountPaidWithFees"
- app:layout_constraintStart_toEndOf="@+id/icon"
+ android:textSize="40sp"
+ app:layout_constraintEnd_toStartOf="@+id/balance_currency"
+ app:layout_constraintHorizontal_bias="0.0"
+ app:layout_constraintHorizontal_chainStyle="packed"
+ app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
- tools:text="Lots of books with very long titles" />
+ tools:text="100.50" />
<TextView
- android:id="@+id/summary"
+ android:id="@+id/balance_currency"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
- android:layout_marginTop="8dp"
- app:layout_constrainedWidth="true"
- app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintEnd_toStartOf="@+id/amountPaidWithFees"
- app:layout_constraintHorizontal_bias="0.0"
- app:layout_constraintStart_toEndOf="@+id/icon"
- app:layout_constraintTop_toBottomOf="@+id/title"
- app:layout_constraintVertical_bias="0.0"
- tools:text="@string/history_event_payment_sent" />
+ android:textSize="20sp"
+ app:layout_constraintBottom_toBottomOf="@+id/balance_amount"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintHorizontal_bias="0.5"
+ app:layout_constraintStart_toEndOf="@+id/balance_amount"
+ app:layout_constraintTop_toTopOf="@+id/balance_amount"
+ tools:text="TESTKUDOS" />
<TextView
- android:id="@+id/amountPaidWithFees"
+ android:id="@+id/balanceInboundAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textColor="@color/red"
- android:textSize="16sp"
- app:layout_constraintBottom_toTopOf="@+id/time"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintVertical_bias="0.0"
- tools:text="0.2 TESTKUDOS" />
+ android:textColor="@color/green"
+ android:textSize="20sp"
+ 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/balance_amount"
+ tools:text="+10 TESTKUDOS"
+ tools:visibility="visible" />
<TextView
- android:id="@+id/time"
+ android:id="@+id/balanceInboundLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="14sp"
- app:layout_constraintBottom_toBottomOf="parent"
+ android:layout_marginStart="8dp"
+ android:text="@string/balances_inbound_label"
+ android:textColor="@color/green"
+ app:layout_constraintBottom_toBottomOf="@+id/balanceInboundAmount"
app:layout_constraintEnd_toEndOf="parent"
- tools:text="23 min ago" />
+ app:layout_constraintStart_toEndOf="@+id/balanceInboundAmount"
+ app:layout_constraintTop_toTopOf="@+id/balanceInboundAmount"
+ tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/layout/nav_header_main.xml
b/app/src/main/res/layout/nav_header_main.xml
index 37559fb..f21d6a3 100644
--- a/app/src/main/res/layout/nav_header_main.xml
+++ b/app/src/main/res/layout/nav_header_main.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
~ This file is part of GNU Taler
~ (C) 2020 Taler Systems S.A.
~
@@ -15,19 +14,18 @@
~ GNU Taler; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>
-->
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@drawable/side_nav_bar"
- android:paddingBottom="@dimen/activity_vertical_margin"
+ android:gravity="bottom"
+ android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
- android:theme="@style/ThemeOverlay.AppCompat.Dark"
- android:orientation="vertical"
- android:gravity="bottom">
+ android:paddingRight="@dimen/activity_horizontal_margin"
+ android:paddingBottom="@dimen/activity_vertical_margin"
+ android:theme="@style/ThemeOverlay.AppCompat.Dark">
<ImageView
android:id="@+id/imageView"
@@ -43,12 +41,12 @@
android:layout_height="wrap_content"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:text="@string/nav_header_title"
- android:textAppearance="@style/TextAppearance.AppCompat.Body1"/>
+ android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
<TextView
+ android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/nav_header_subtitle"
- android:id="@+id/textView"/>
+ android:text="@string/nav_header_subtitle" />
</LinearLayout>
diff --git a/app/src/main/res/menu/activity_main_drawer.xml
b/app/src/main/res/menu/activity_main_drawer.xml
index 7a54077..5eee6cc 100644
--- a/app/src/main/res/menu/activity_main_drawer.xml
+++ b/app/src/main/res/menu/activity_main_drawer.xml
@@ -16,25 +16,26 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- tools:showIn="navigation_view">
+ tools:showIn="@layout/activity_main">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_home"
- android:icon="@drawable/ic_home_black_24dp"
- android:title="@string/menu_home" />
+ android:icon="@drawable/ic_account_balance_wallet"
+ android:title="@string/balances_title"
+ tools:checked="true" />
<item
android:id="@+id/nav_history"
android:icon="@drawable/ic_history_black_24dp"
android:title="@string/menu_history" />
<item
android:id="@+id/nav_settings"
- android:icon="@drawable/ic_menu_manage"
+ android:icon="@drawable/ic_settings"
android:title="@string/menu_settings" />
<item
android:id="@+id/nav_pending_operations"
- android:icon="@drawable/history_refresh"
- android:title="Pending Operations" />
+ android:icon="@drawable/ic_sync"
+ android:title="@string/pending_operations_title" />
</group>
</menu>
diff --git a/app/src/main/res/navigation/nav_graph.xml
b/app/src/main/res/navigation/nav_graph.xml
index 648c88e..e540c12 100644
--- a/app/src/main/res/navigation/nav_graph.xml
+++ b/app/src/main/res/navigation/nav_graph.xml
@@ -23,7 +23,7 @@
<fragment
android:id="@+id/showBalance"
- android:name="net.taler.wallet.ShowBalance"
+ android:name="net.taler.wallet.BalanceFragment"
android:label="@string/balances_title"
tools:layout="@layout/fragment_show_balance">
<action
@@ -59,8 +59,8 @@
tools:layout="@layout/fragment_settings" />
<fragment
android:id="@+id/walletHistory"
- android:name="net.taler.wallet.history.WalletHistory"
- android:label="History"
+ android:name="net.taler.wallet.history.WalletHistoryFragment"
+ android:label="@string/history_title"
tools:layout="@layout/fragment_show_history" />
<fragment
android:id="@+id/alreadyPaid"
diff --git a/app/src/main/res/values/strings.xml
b/app/src/main/res/values/strings.xml
index ca69756..b8f41fb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -28,7 +28,6 @@
<string name="button_cancel">Cancel</string>
<string name="button_scan_qr_code">Scan Taler QR Code</string>
- <string name="menu_home">Home</string>
<string name="menu_history">History</string>
<string name="menu_settings">Settings</string>
<string name="menu_balance_reload">Reload balances</string>
@@ -39,9 +38,16 @@
<string name="aiddescription">my aid</string>
<string name="balances_title">Balances</string>
- <string name="balances_inbound">inbound</string>
+ <string name="balances_inbound_amount">+%1s %2s</string>
+ <string name="balances_inbound_label">inbound</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="history_title">History</string>
+ <string name="history_fee_label">Fee:</string>
+ <string name="history_show_all">Show All</string>
+ <string name="history_reload">Reload History</string>
+ <string name="history_empty">The wallet history is empty</string>
+
<!-- HistoryEvents -->
<string name="history_event_exchange_added">Exchange Added</string>
<string name="history_event_exchange_updated">Exchange Updated</string>
@@ -57,10 +63,6 @@
<string name="history_event_refund">Refund</string>
<string name="history_event_refreshed">Obtained change</string>
<string name="history_event_unknown">Unknown Event</string>
- <string name="history_fee_label">Fee:</string>
- <string name="history_show_all">Show All</string>
- <string name="history_reload">Reload History</string>
- <string name="history_empty">The wallet history is empty</string>
<string name="payment_fee">+%s payment fee</string>
<string name="payment_button_confirm">Confirm Payment</string>
@@ -83,7 +85,7 @@
<string name="withdraw_button_testkudos">Withdraw TESTKUDOS</string>
<string name="withdraw_button_confirm">Confirm Withdraw</string>
- <string name="pending_operations_label">Pending Operations:</string>
+ <string name="pending_operations_title">Pending Operations</string>
<string name="pending_operations_refuse">Refuse Proposal</string>
<string name="pending_operations_no_action">(no action)</string>
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-wallet-android] branch master updated (b666242 -> 09b66e7),
gnunet <=