summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-03-05 11:27:24 -0300
committerTorsten Grote <t@grobox.de>2020-03-05 11:27:24 -0300
commit8589d5cae8087acbf25e7251e341f99fd2c7f9e2 (patch)
treec86ac8adefde5fde35d1c18a96440c8dbe08333f
parent1bbc48f7f9a893c13b07a5436a0b2b5f923de398 (diff)
downloadwallet-android-8589d5cae8087acbf25e7251e341f99fd2c7f9e2.tar.gz
wallet-android-8589d5cae8087acbf25e7251e341f99fd2c7f9e2.tar.bz2
wallet-android-8589d5cae8087acbf25e7251e341f99fd2c7f9e2.zip
Make initial screen look nicer and clean up its code
-rw-r--r--app/src/main/java/net/taler/wallet/MainActivity.kt4
-rw-r--r--app/src/main/java/net/taler/wallet/ShowBalance.kt158
-rw-r--r--app/src/main/java/net/taler/wallet/WalletViewModel.kt30
-rw-r--r--app/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt2
-rw-r--r--app/src/main/res/drawable/ic_scan_qr.xml208
-rw-r--r--app/src/main/res/layout/app_bar_main.xml9
-rw-r--r--app/src/main/res/layout/fragment_show_balance.xml112
-rw-r--r--app/src/main/res/values/strings.xml2
8 files changed, 168 insertions, 357 deletions
diff --git a/app/src/main/java/net/taler/wallet/MainActivity.kt b/app/src/main/java/net/taler/wallet/MainActivity.kt
index 5267056..1cdc9b3 100644
--- a/app/src/main/java/net/taler/wallet/MainActivity.kt
+++ b/app/src/main/java/net/taler/wallet/MainActivity.kt
@@ -24,7 +24,7 @@ import android.content.IntentFilter
import android.os.Bundle
import android.util.Log
import android.view.MenuItem
-import android.view.View.GONE
+import android.view.View.INVISIBLE
import android.view.View.VISIBLE
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
@@ -74,7 +74,7 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
toolbar.setupWithNavController(nav, appBarConfiguration)
model.showProgressBar.observe(this, Observer { show ->
- progress_bar.visibility = if (show) VISIBLE else GONE
+ progress_bar.visibility = if (show) VISIBLE else INVISIBLE
})
if (intent.action == ACTION_VIEW) intent.dataString?.let { uri ->
diff --git a/app/src/main/java/net/taler/wallet/ShowBalance.kt b/app/src/main/java/net/taler/wallet/ShowBalance.kt
index fe1a109..5448638 100644
--- a/app/src/main/java/net/taler/wallet/ShowBalance.kt
+++ b/app/src/main/java/net/taler/wallet/ShowBalance.kt
@@ -18,6 +18,7 @@ package net.taler.wallet
import android.annotation.SuppressLint
import android.os.Bundle
+import android.transition.TransitionManager.beginDelayedTransition
import android.util.Log
import android.view.LayoutInflater
import android.view.Menu
@@ -27,25 +28,26 @@ import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.ViewGroup
-import android.widget.Button
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
+import androidx.recyclerview.widget.LinearLayoutManager.VERTICAL
+import androidx.recyclerview.widget.RecyclerView.Adapter
+import androidx.recyclerview.widget.RecyclerView.ViewHolder
import com.google.zxing.integration.android.IntentIntegrator
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() {
private val model: WalletViewModel by activityViewModels()
private val withdrawManager by lazy { model.withdrawManager }
- private lateinit var balancesView: RecyclerView
- private lateinit var balancesPlaceholderView: TextView
- private lateinit var balancesAdapter: BalanceAdapter
+ private val balancesAdapter = BalanceAdapter()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -53,68 +55,52 @@ class ShowBalance : Fragment() {
}
override fun onCreateView(
- inflater: LayoutInflater, container: ViewGroup?,
+ inflater: LayoutInflater,
+ container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
- // Inflate the layout for this fragment
- val view = inflater.inflate(R.layout.fragment_show_balance, container, false)
- val payQrButton = view.findViewById<Button>(R.id.button_pay_qr)
- payQrButton.setOnClickListener {
- IntentIntegrator(activity).apply {
- setBeepEnabled(true)
- setOrientationLocked(false)
- }.initiateScan(QR_CODE_TYPES)
- }
-
- this.balancesView = view.findViewById(R.id.list_balances)
- this.balancesPlaceholderView = view.findViewById(R.id.list_balances_placeholder)
-
- val balances = model.balances.value!!
-
- balancesAdapter = BalanceAdapter(balances)
+ return inflater.inflate(R.layout.fragment_show_balance, container, false)
+ }
- view.findViewById<RecyclerView>(R.id.list_balances).apply {
- val myLayoutManager = LinearLayoutManager(context)
- val myItemDecoration = DividerItemDecoration(context, myLayoutManager.orientation)
- layoutManager = myLayoutManager
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ balancesList.apply {
+ layoutManager = LinearLayoutManager(context)
adapter = balancesAdapter
- addItemDecoration(myItemDecoration)
+ addItemDecoration(DividerItemDecoration(context, VERTICAL))
}
- updateBalances(balances)
-
model.balances.observe(viewLifecycleOwner, Observer {
- triggerLoading()
- updateBalances(it)
+ onBalancesChanged(it)
})
-
- val withdrawTestkudosButton = view.findViewById<Button>(R.id.button_withdraw_testkudos)
- withdrawTestkudosButton.setOnClickListener {
+ testWithdrawButton.setOnClickListener {
withdrawManager.withdrawTestkudos()
}
withdrawManager.testWithdrawalInProgress.observe(viewLifecycleOwner, Observer { loading ->
Log.v("taler-wallet", "observing balance loading $loading in show balance")
- withdrawTestkudosButton.isEnabled = !loading
- triggerLoading()
+ testWithdrawButton.isEnabled = !loading
+ model.showProgressBar.value = loading
})
- return view
+ scanButton.setOnClickListener {
+ IntentIntegrator(activity).apply {
+ setPrompt("")
+ setBeepEnabled(true)
+ setOrientationLocked(false)
+ }.initiateScan(QR_CODE_TYPES)
+ }
}
- override fun onResume() {
- super.onResume()
- triggerLoading()
- Log.v("taler-wallet", "called onResume on ShowBalance")
+ override fun onStart() {
+ super.onStart()
+ model.loadBalances()
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.reload_balance -> {
- triggerLoading()
- model.balances.value = WalletBalances(false, listOf())
- model.getBalances()
+ model.loadBalances()
true
}
else -> super.onOptionsItemSelected(item)
@@ -126,72 +112,64 @@ class ShowBalance : Fragment() {
super.onCreateOptionsMenu(menu, inflater)
}
- private fun triggerLoading() {
- val withdrawInProgress = withdrawManager.testWithdrawalInProgress.value == true
- val balances = model.balances.value
- val loading: Boolean = (withdrawInProgress) || (balances == null) || !balances.initialized
- model.showProgressBar.value = loading
- }
-
- private fun updateBalances(balances: WalletBalances) {
- if (!balances.initialized) {
- balancesPlaceholderView.visibility = GONE
- balancesView.visibility = GONE
- } else if (balances.byCurrency.isEmpty()) {
- balancesPlaceholderView.visibility = VISIBLE
- balancesView.visibility = GONE
+ private fun onBalancesChanged(balances: List<BalanceItem>) {
+ beginDelayedTransition(view as ViewGroup)
+ if (balances.isEmpty()) {
+ balancesEmptyState.visibility = VISIBLE
+ balancesList.visibility = GONE
} else {
- balancesPlaceholderView.visibility = GONE
- balancesView.visibility = VISIBLE
+ balancesAdapter.setItems(balances)
+ balancesEmptyState.visibility = GONE
+ balancesList.visibility = VISIBLE
}
- Log.v(TAG, "updating balances $balances")
- balancesAdapter.update(balances)
}
}
-class BalanceAdapter(private var myDataset: WalletBalances) :
- RecyclerView.Adapter<BalanceAdapter.BalanceViewHolder>() {
+class BalanceAdapter : Adapter<BalanceViewHolder>() {
+
+ private var items = emptyList<BalanceItem>()
init {
setHasStableIds(false)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BalanceViewHolder {
- val rowView =
- LayoutInflater.from(parent.context).inflate(R.layout.balance_row, parent, false)
- return BalanceViewHolder(rowView)
+ val v = LayoutInflater.from(parent.context).inflate(R.layout.balance_row, parent, false)
+ return BalanceViewHolder(v)
}
- override fun getItemCount(): Int {
- return myDataset.byCurrency.size
- }
+ override fun getItemCount() = items.size
override fun onBindViewHolder(holder: BalanceViewHolder, position: Int) {
- val amount = myDataset.byCurrency[position].available
- val amountIncoming = myDataset.byCurrency[position].pendingIncoming
- val currencyView = holder.rowView.findViewById<TextView>(R.id.balance_currency)
- currencyView.text = amount.currency
- val amountView = holder.rowView.findViewById<TextView>(R.id.balance_amount)
- amountView.text = amount.amount
-
- val amountIncomingRow = holder.rowView.findViewById<View>(R.id.balance_row_pending)
-
- val amountIncomingView = holder.rowView.findViewById<TextView>(R.id.balance_pending)
- if (amountIncoming.isZero()) {
- amountIncomingRow.visibility = GONE
- } else {
- amountIncomingRow.visibility = VISIBLE
- @SuppressLint("SetTextI18n")
- amountIncomingView.text = "${amountIncoming.amount} ${amountIncoming.currency}"
- }
+ val item = items[position]
+ holder.bind(item)
}
- fun update(updatedBalances: WalletBalances) {
- this.myDataset = updatedBalances
+ fun setItems(items: List<BalanceItem>) {
+ this.items = items
this.notifyDataSetChanged()
}
- class BalanceViewHolder(val rowView: View) : RecyclerView.ViewHolder(rowView)
+ class BalanceViewHolder(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)
+
+ fun bind(item: BalanceItem) {
+ currencyView.text = item.available.currency
+ amountView.text = item.available.amount
+
+ val amountIncoming = item.pendingIncoming
+ if (amountIncoming.isZero()) {
+ amountIncomingRow.visibility = GONE
+ } else {
+ amountIncomingRow.visibility = VISIBLE
+ @SuppressLint("SetTextI18n")
+ amountIncomingView.text = "${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 2ec88af..7baedcf 100644
--- a/app/src/main/java/net/taler/wallet/WalletViewModel.kt
+++ b/app/src/main/java/net/taler/wallet/WalletViewModel.kt
@@ -23,6 +23,7 @@ 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
@@ -43,19 +44,13 @@ import org.json.JSONObject
const val TAG = "taler-wallet"
-
-data class BalanceEntry(val available: Amount, val pendingIncoming: Amount)
-
-
-data class WalletBalances(val initialized: Boolean, val byCurrency: List<BalanceEntry>)
-
+data class BalanceItem(val available: Amount, val pendingIncoming: Amount)
@Suppress("EXPERIMENTAL_API_USAGE")
class WalletViewModel(val app: Application) : AndroidViewModel(app) {
- val balances = MutableLiveData<WalletBalances>().apply {
- value = WalletBalances(false, listOf())
- }
+ private val mBalances = MutableLiveData<List<BalanceItem>>()
+ val balances: LiveData<List<BalanceItem>> = mBalances.distinctUntilChanged()
private val mHistoryProgress = MutableLiveData<Boolean>()
val historyProgress: LiveData<Boolean> = mHistoryProgress
@@ -75,11 +70,11 @@ class WalletViewModel(val app: Application) : AndroidViewModel(app) {
private val walletBackendApi = WalletBackendApi(app, {
activeGetBalance = 0
- getBalances()
+ loadBalances()
pendingOperationsManager.getPending()
}) {
Log.i(TAG, "Received notification from wallet-core")
- getBalances()
+ loadBalances()
pendingOperationsManager.getPending()
}
@@ -92,17 +87,19 @@ class WalletViewModel(val app: Application) : AndroidViewModel(app) {
val pendingOperationsManager: PendingOperationsManager =
PendingOperationsManager(walletBackendApi)
- fun getBalances() {
+ @UiThread
+ fun loadBalances() {
if (activeGetBalance > 0) {
return
}
activeGetBalance++
+ showProgressBar.value = true
walletBackendApi.sendRequest("getBalances", null) { isError, result ->
activeGetBalance--
if (isError) {
return@sendRequest
}
- val balanceList = mutableListOf<BalanceEntry>()
+ val balanceList = mutableListOf<BalanceItem>()
val byCurrency = result.getJSONObject("byCurrency")
val currencyList = byCurrency.keys().asSequence().toList().sorted()
for (currency in currencyList) {
@@ -112,9 +109,10 @@ class WalletViewModel(val app: Application) : AndroidViewModel(app) {
val jsonAmountIncoming = byCurrency.getJSONObject(currency)
.getJSONObject("pendingIncoming")
val amountIncoming = Amount.fromJson(jsonAmountIncoming)
- balanceList.add(BalanceEntry(amount, amountIncoming))
+ balanceList.add(BalanceItem(amount, amountIncoming))
}
- balances.postValue(WalletBalances(true, balanceList))
+ mBalances.postValue(balanceList)
+ showProgressBar.postValue(false)
}
}
@@ -145,7 +143,7 @@ class WalletViewModel(val app: Application) : AndroidViewModel(app) {
fun dangerouslyReset() {
walletBackendApi.sendRequest("reset", null)
withdrawManager.testWithdrawalInProgress.value = false
- balances.value = WalletBalances(false, listOf())
+ mBalances.value = emptyList()
}
fun startTunnel() {
diff --git a/app/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt b/app/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt
index fa20318..dec03af 100644
--- a/app/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt
+++ b/app/src/main/java/net/taler/wallet/withdraw/WithdrawManager.kt
@@ -46,7 +46,7 @@ sealed class WithdrawStatus {
class WithdrawManager(private val walletBackendApi: WalletBackendApi) {
val withdrawStatus = MutableLiveData<WithdrawStatus>(WithdrawStatus.None)
- val testWithdrawalInProgress = MutableLiveData<Boolean>(false)
+ val testWithdrawalInProgress = MutableLiveData(false)
private var currentWithdrawRequestId = 0
diff --git a/app/src/main/res/drawable/ic_scan_qr.xml b/app/src/main/res/drawable/ic_scan_qr.xml
index a6d1172..2ca8a69 100644
--- a/app/src/main/res/drawable/ic_scan_qr.xml
+++ b/app/src/main/res/drawable/ic_scan_qr.xml
@@ -1,202 +1,10 @@
-<!--
- ~ 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="200dp"
- android:height="200dp"
- android:viewportWidth="278"
- android:viewportHeight="278">
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M103,28l0,77 -76,0 0,-77 76,0zM93,38l-56,0 0,57 56,0 0,-57z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M251,28l0,77 -76,0 0,-77 76,0zM241,38l-56,0 0,57 56,0 0,-57z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M103,174l0,76 -76,0 0,-76 76,0zM93,184l-56,0 0,56 56,0 0,-56z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M157,240l0,-12l-10,0l0,12l-12,0l0,-21l20,0l0,-10l-33,0l0,-9l-10,0l1,19l12,0l0,11l-13,0l0,10l13,0l0,10l42,0l0,-10z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M38,123l-11,0l0,-10l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M123,69l-10,0l0,-10l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M124,39l-11,0l0,-10l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M222,215l-10,0l0,-10l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M50,144l10,0l0,-10l-10,0l0,-10l-10,0l0,9l-12,0l0,24l12,0l0,8l31,0l0,-19l-11,0l0,9l-10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M242,113l0,10 9,0 0,10 -16,0 0,13 -29,0 0,9 16,0 0,23 -11,0 0,-13 -23,0 0,-10 8,0 0,-9 -6,0 0,-10 33,0 0,-18 -13,0 0,-5c10,0 21,0 32,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M121,123l-31,0l0,10l-21,0l0,-10l-11,0l0,-10l63,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M123,74l-10,0l0,17l0,17l10,0l11,0l0,-17l-11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M134,85l11,0l0,18l13,0l0,-12l8,0l0,-16l-32,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M153,44l-28,0 0,11 18,0 0,11 13,0 0,-11 11,0c0,-9 0,-18 0,-27l-24,0 0,11 10,0 0,5z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M138,70l-10,0l0,-10l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M112,139l-10,0l0,-10l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M157,183l-11,0l0,-18l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M140,180l-10,0l0,-10l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M206,189l-10,0l0,-20l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M241,240l-18,0l0,10l28,0l0,-26l-10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M183,237l-11,0l0,-18l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M123,187l-10,0l0,-23l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M172,196l-15,0l0,-10l-32,0l0,10l23,0l0,10l12,0l0,11l46,0l0,-11l-13,0l0,-10l-11,0l0,10l-10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M185,179l-13,0l0,11l-10,0l0,-21l23,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M198,220l10,0 0,20 9,0 0,10c-16,0 -13,0 -31,0l0,-10 12,0 0,-20z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M118,155l-30,0l0,10l-10,0l0,-13l0,0l0,-7l40,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M136,123l0,9l21,0l0,-9l13,0l0,-10l-43,0l0,10z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M145,147l-22,0l0,-10l22,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M158,150l-11,0l0,10l22,0l0,-23l-11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M251,184l-6,0l0,8l-10,0l0,-8l-5,0l0,-22l21,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M222,194l-11,0l0,-10l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M228,217c7,0 15,0 23,0l0,-19 -10,0 0,9 -13,0 0,10z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M237,236l-11,0l0,-10l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M82,82l-34,0l0,-32l34,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M230,82l-34,0l0,-32l34,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M82,228l-34,0l0,-32l34,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M183,250l-11,0l0,-10l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M140,162l-11,0l0,-10l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M218,132l-10,0l0,-10l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M193,123l-11,0l0,-10l11,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M251,159l-10,0l0,-10l10,0z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M0,53l0,-53l54,0l0,10l-44,0l0,43z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M278,53l0,-53l-54,0l0,10l44,0l0,43z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M0,225l0,53l54,0l0,-10l-44,0l0,-43z" />
- <path
- android:fillColor="#FFFFFF"
- android:fillType="nonZero"
- android:pathData="M278,225l0,53l-54,0l0,-10l44,0l0,-43z" />
+ android:width="24dp"
+ android:height="24dp"
+ android:tint="?attr/colorOnPrimarySurface"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#000"
+ android:pathData="M4,4H10V10H4V4M20,4V10H14V4H20M14,15H16V13H14V11H16V13H18V11H20V13H18V15H20V18H18V20H16V18H13V20H11V16H14V15M16,15V18H18V15H16M4,20V14H10V20H4M6,6V8H8V6H6M16,6V8H18V6H16M6,16V18H8V16H6M4,11H6V13H4V11M9,11H13V15H11V13H9V11M11,6H13V10H11V6M2,2V6H0V2A2,2 0 0,1 2,0H6V2H2M22,0A2,2 0 0,1 24,2V6H22V2H18V0H22M2,18V22H6V24H2A2,2 0 0,1 0,22V18H2M22,22V18H24V22A2,2 0 0,1 22,24H18V22H22Z" />
</vector>
diff --git a/app/src/main/res/layout/app_bar_main.xml b/app/src/main/res/layout/app_bar_main.xml
index e2fa71f..d976be8 100644
--- a/app/src/main/res/layout/app_bar_main.xml
+++ b/app/src/main/res/layout/app_bar_main.xml
@@ -43,13 +43,14 @@
<me.zhanghai.android.materialprogressbar.MaterialProgressBar
android:id="@+id/progress_bar"
style="@style/Widget.MaterialProgressBar.ProgressBar.Horizontal"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="4dp"
+ android:elevation="4dp"
android:indeterminate="true"
- android:visibility="gone"
- app:layout_constraintBottom_toBottomOf="parent"
+ android:visibility="invisible"
+ app:layout_constraintBottom_toBottomOf="@+id/toolbar"
+ app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@+id/toolbar"
app:mpb_progressStyle="horizontal"
app:mpb_useIntrinsicPadding="false"
tools:visibility="visible" />
diff --git a/app/src/main/res/layout/fragment_show_balance.xml b/app/src/main/res/layout/fragment_show_balance.xml
index db50754..969201a 100644
--- a/app/src/main/res/layout/fragment_show_balance.xml
+++ b/app/src/main/res/layout/fragment_show_balance.xml
@@ -13,54 +13,80 @@
~ 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/>
-->
-
-<androidx.core.widget.NestedScrollView 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"
- android:layout_margin="15dp">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <View
- android:id="@+id/header"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <androidx.recyclerview.widget.RecyclerView
- android:id="@+id/list_balances"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:scrollbars="vertical"
- tools:listitem="@layout/balance_row" />
+ android:layout_height="match_parent">
- <TextView
- android:id="@+id/list_balances_placeholder"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:text="@string/balance_no_cash"
- tools:visibility="gone" />
+ <androidx.recyclerview.widget.RecyclerView
+ 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"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintVertical_bias="0.0"
+ app:layout_constraintVertical_chainStyle="packed"
+ tools:layout_height="200dp"
+ tools:listitem="@layout/balance_row"
+ tools:visibility="visible" />
- <Space
- android:layout_width="match_parent"
- android:layout_height="20dp" />
+ <TextView
+ android:id="@+id/balancesEmptyState"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:autoLink="web"
+ android:gravity="center"
+ android:padding="16dp"
+ android:text="@string/balance_no_cash"
+ android:textSize="18sp"
+ android:visibility="gone"
+ app:layout_constraintBottom_toTopOf="@+id/scanButton"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
+ tools:visibility="visible" />
- <Button
- android:id="@+id/button_withdraw_testkudos"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/withdraw_button_testkudos" />
+ <androidx.constraintlayout.widget.Barrier
+ android:id="@+id/barrier"
+ android:layout_width="0dp"
+ android:layout_height="0dp"
+ app:barrierAllowsGoneWidgets="false"
+ app:barrierDirection="bottom"
+ app:constraint_referenced_ids="balancesList, balancesEmptyState" />
- <Button
- android:id="@+id/button_pay_qr"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/button_scan_qr_code" />
+ <Button
+ android:id="@+id/scanButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="16dp"
+ android:drawableLeft="@drawable/ic_scan_qr"
+ android:padding="16dp"
+ android:text="@string/button_scan_qr_code"
+ app:layout_constraintBottom_toTopOf="@+id/testWithdrawButton"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/barrier"
+ app:layout_constraintVertical_chainStyle="packed"
+ tools:ignore="RtlHardcoded" />
- </LinearLayout>
+ <Button
+ android:id="@+id/testWithdrawButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginTop="16dp"
+ android:layout_marginEnd="16dp"
+ android:padding="16dp"
+ android:text="@string/withdraw_button_testkudos"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/scanButton"
+ tools:visibility="visible" />
-</androidx.core.widget.NestedScrollView>
+</androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0b69c3c..ddf2246 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -79,7 +79,7 @@
<string name="withdraw_button_confirm">Confirm Withdraw</string>
<string name="balance_inbound">inbound</string>
- <string name="balance_no_cash">There is no digital cash in your wallet.</string>
+ <string name="balance_no_cash">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="pending_operations_label">Pending Operations:</string>
<string name="pending_operations_refuse">Refuse Proposal</string>