aboutsummaryrefslogtreecommitdiff
path: root/wallet
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-04-15 09:37:37 -0300
committerTorsten Grote <t@grobox.de>2020-04-15 09:37:37 -0300
commit8b7947a14349877120e74127a3949a73f917c3d2 (patch)
tree5cc34b7233eff3402e94690f0c75013edd964251 /wallet
parent10e49b74e29df50d8ac3e24438195063918ee265 (diff)
downloadtaler-android-8b7947a14349877120e74127a3949a73f917c3d2.tar.gz
taler-android-8b7947a14349877120e74127a3949a73f917c3d2.tar.bz2
taler-android-8b7947a14349877120e74127a3949a73f917c3d2.zip
[wallet] use floating action button for scan action
This prepares a layout change for display of balances and transactions.
Diffstat (limited to 'wallet')
-rw-r--r--wallet/src/main/java/net/taler/wallet/BalanceAdapter.kt79
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainActivity.kt5
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainFragment.kt (renamed from wallet/src/main/java/net/taler/wallet/BalanceFragment.kt)115
-rw-r--r--wallet/src/main/java/net/taler/wallet/MainViewModel.kt (renamed from wallet/src/main/java/net/taler/wallet/WalletViewModel.kt)2
-rw-r--r--wallet/src/main/java/net/taler/wallet/SettingsFragment.kt (renamed from wallet/src/main/java/net/taler/wallet/Settings.kt)4
-rw-r--r--wallet/src/main/java/net/taler/wallet/history/HistoryEventFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/history/HistoryFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/ErrorFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt4
-rw-r--r--wallet/src/main/java/net/taler/wallet/withdraw/SelectExchangeFragment.kt4
-rw-r--r--wallet/src/main/res/layout/fragment_settings.xml2
-rw-r--r--wallet/src/main/res/layout/fragment_show_balance.xml72
-rw-r--r--wallet/src/main/res/menu/activity_main_drawer.xml4
-rw-r--r--wallet/src/main/res/navigation/nav_graph.xml4
17 files changed, 152 insertions, 167 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/BalanceAdapter.kt b/wallet/src/main/java/net/taler/wallet/BalanceAdapter.kt
new file mode 100644
index 0000000..96cfb99
--- /dev/null
+++ b/wallet/src/main/java/net/taler/wallet/BalanceAdapter.kt
@@ -0,0 +1,79 @@
+/*
+ * 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
+
+import android.view.LayoutInflater
+import android.view.View
+import android.view.View.GONE
+import android.view.View.VISIBLE
+import android.view.ViewGroup
+import android.widget.TextView
+import androidx.recyclerview.widget.RecyclerView
+import androidx.recyclerview.widget.RecyclerView.Adapter
+import net.taler.wallet.BalanceAdapter.BalanceViewHolder
+
+class BalanceAdapter(private val listener: BalanceClickListener) : Adapter<BalanceViewHolder>() {
+
+ private var items = emptyList<BalanceItem>()
+
+ init {
+ setHasStableIds(false)
+ }
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BalanceViewHolder {
+ val v =
+ LayoutInflater.from(parent.context).inflate(R.layout.list_item_balance, parent, false)
+ return BalanceViewHolder(v)
+ }
+
+ override fun getItemCount() = items.size
+
+ override fun onBindViewHolder(holder: BalanceViewHolder, position: Int) {
+ val item = items[position]
+ holder.bind(item)
+ }
+
+ fun setItems(items: List<BalanceItem>) {
+ this.items = items
+ this.notifyDataSetChanged()
+ }
+
+ inner class BalanceViewHolder(private val v: View) : RecyclerView.ViewHolder(v) {
+ private val currencyView: TextView = v.findViewById(R.id.balance_currency)
+ private val amountView: TextView = v.findViewById(R.id.balance_amount)
+ private val balanceInboundAmount: TextView = v.findViewById(R.id.balanceInboundAmount)
+ private val balanceInboundLabel: TextView = v.findViewById(R.id.balanceInboundLabel)
+
+ fun bind(item: BalanceItem) {
+ v.setOnClickListener { listener.onBalanceClick() }
+ currencyView.text = item.available.currency
+ amountView.text = item.available.amountStr
+
+ 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)
+ }
+ }
+ }
+
+}
diff --git a/wallet/src/main/java/net/taler/wallet/MainActivity.kt b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
index 6f0ed89..a43cbf2 100644
--- a/wallet/src/main/java/net/taler/wallet/MainActivity.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainActivity.kt
@@ -57,7 +57,7 @@ import java.util.Locale.ROOT
class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
ResetDialogEventListener {
- private val model: WalletViewModel by viewModels()
+ private val model: MainViewModel by viewModels()
private lateinit var nav: NavController
@@ -76,7 +76,7 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
setSupportActionBar(toolbar)
val appBarConfiguration = AppBarConfiguration(
- setOf(R.id.showBalance, R.id.settings, R.id.walletHistory, R.id.nav_pending_operations),
+ setOf(R.id.showBalance, R.id.settings, R.id.nav_pending_operations),
drawer_layout
)
toolbar.setupWithNavController(nav, appBarConfiguration)
@@ -116,7 +116,6 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener,
when (item.itemId) {
R.id.nav_home -> nav.navigate(R.id.showBalance)
R.id.nav_settings -> nav.navigate(R.id.settings)
- R.id.nav_history -> nav.navigate(R.id.walletHistory)
R.id.nav_pending_operations -> nav.navigate(R.id.nav_pending_operations)
}
drawer_layout.closeDrawer(START)
diff --git a/wallet/src/main/java/net/taler/wallet/BalanceFragment.kt b/wallet/src/main/java/net/taler/wallet/MainFragment.kt
index 3d5364b..a0eb8ff 100644
--- a/wallet/src/main/java/net/taler/wallet/BalanceFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainFragment.kt
@@ -18,7 +18,6 @@ package net.taler.wallet
import android.os.Bundle
import android.transition.TransitionManager.beginDelayedTransition
-import android.util.Log
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
@@ -27,7 +26,6 @@ import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.ViewGroup
-import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.Observer
@@ -35,20 +33,17 @@ import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
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
import kotlinx.android.synthetic.main.fragment_show_balance.*
-import net.taler.wallet.BalanceAdapter.BalanceViewHolder
interface BalanceClickListener {
fun onBalanceClick()
}
-class BalanceFragment : Fragment(), BalanceClickListener {
+class MainFragment : Fragment(), BalanceClickListener {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val withdrawManager by lazy { model.withdrawManager }
private var reloadBalanceMenuItem: MenuItem? = null
@@ -68,7 +63,7 @@ class BalanceFragment : Fragment(), BalanceClickListener {
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- balancesList.apply {
+ mainList.apply {
layoutManager = LinearLayoutManager(context)
adapter = balancesAdapter
addItemDecoration(DividerItemDecoration(context, VERTICAL))
@@ -78,26 +73,22 @@ class BalanceFragment : Fragment(), BalanceClickListener {
onBalancesChanged(it)
})
- model.devMode.observe(viewLifecycleOwner, Observer { enabled ->
- delayedTransition()
- testWithdrawButton.visibility = if (enabled) VISIBLE else GONE
- reloadBalanceMenuItem?.isVisible = enabled
- })
- testWithdrawButton.setOnClickListener {
- withdrawManager.withdrawTestkudos()
- }
- withdrawManager.testWithdrawalInProgress.observe(viewLifecycleOwner, Observer { loading ->
- Log.v("taler-wallet", "observing balance loading $loading in show balance")
- testWithdrawButton.isEnabled = !loading
- model.showProgressBar.value = loading
- })
-
- scanButton.setOnClickListener {
- IntentIntegrator(activity).apply {
- setPrompt("")
- setBeepEnabled(true)
- setOrientationLocked(false)
- }.initiateScan(listOf(QR_CODE))
+// model.devMode.observe(viewLifecycleOwner, Observer { enabled ->
+// delayedTransition()
+// testWithdrawButton.visibility = if (enabled) VISIBLE else GONE
+// reloadBalanceMenuItem?.isVisible = enabled
+// })
+// testWithdrawButton.setOnClickListener {
+// withdrawManager.withdrawTestkudos()
+// }
+// withdrawManager.testWithdrawalInProgress.observe(viewLifecycleOwner, Observer { loading ->
+// Log.v("taler-wallet", "observing balance loading $loading in show balance")
+// testWithdrawButton.isEnabled = !loading
+// model.showProgressBar.value = loading
+// })
+
+ mainFab.setOnClickListener {
+ onScanButtonClicked()
}
}
@@ -130,15 +121,23 @@ class BalanceFragment : Fragment(), BalanceClickListener {
super.onCreateOptionsMenu(menu, inflater)
}
+ private fun onScanButtonClicked() {
+ IntentIntegrator(activity).apply {
+ setPrompt("")
+ setBeepEnabled(true)
+ setOrientationLocked(false)
+ }.initiateScan(listOf(QR_CODE))
+ }
+
private fun onBalancesChanged(balances: List<BalanceItem>) {
delayedTransition()
if (balances.isEmpty()) {
- balancesEmptyState.visibility = VISIBLE
- balancesList.visibility = GONE
+ mainEmptyState.visibility = VISIBLE
+ mainList.visibility = GONE
} else {
balancesAdapter.setItems(balances)
- balancesEmptyState.visibility = GONE
- balancesList.visibility = VISIBLE
+ mainEmptyState.visibility = GONE
+ mainList.visibility = VISIBLE
}
}
@@ -151,55 +150,3 @@ class BalanceFragment : Fragment(), BalanceClickListener {
}
}
-
-class BalanceAdapter(private val listener: BalanceClickListener) : Adapter<BalanceViewHolder>() {
-
- private var items = emptyList<BalanceItem>()
-
- init {
- setHasStableIds(false)
- }
-
- override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BalanceViewHolder {
- val v =
- LayoutInflater.from(parent.context).inflate(R.layout.list_item_balance, parent, false)
- return BalanceViewHolder(v)
- }
-
- override fun getItemCount() = items.size
-
- override fun onBindViewHolder(holder: BalanceViewHolder, position: Int) {
- val item = items[position]
- holder.bind(item)
- }
-
- fun setItems(items: List<BalanceItem>) {
- this.items = items
- this.notifyDataSetChanged()
- }
-
- inner 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 balanceInboundAmount: TextView = v.findViewById(R.id.balanceInboundAmount)
- private val balanceInboundLabel: TextView = v.findViewById(R.id.balanceInboundLabel)
-
- fun bind(item: BalanceItem) {
- v.setOnClickListener { listener.onBalanceClick() }
- currencyView.text = item.available.currency
- amountView.text = item.available.amountStr
-
- 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)
- }
- }
- }
-
-}
diff --git a/wallet/src/main/java/net/taler/wallet/WalletViewModel.kt b/wallet/src/main/java/net/taler/wallet/MainViewModel.kt
index 607ce15..e5f385a 100644
--- a/wallet/src/main/java/net/taler/wallet/WalletViewModel.kt
+++ b/wallet/src/main/java/net/taler/wallet/MainViewModel.kt
@@ -39,7 +39,7 @@ const val TAG = "taler-wallet"
data class BalanceItem(val available: Amount, val pendingIncoming: Amount)
-class WalletViewModel(val app: Application) : AndroidViewModel(app) {
+class MainViewModel(val app: Application) : AndroidViewModel(app) {
private val mBalances = MutableLiveData<List<BalanceItem>>()
val balances: LiveData<List<BalanceItem>> = mBalances.distinctUntilChanged()
diff --git a/wallet/src/main/java/net/taler/wallet/Settings.kt b/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt
index 572c036..559b162 100644
--- a/wallet/src/main/java/net/taler/wallet/Settings.kt
+++ b/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt
@@ -79,7 +79,7 @@ class ResetDialogFragment : DialogFragment() {
}
}
-class Settings : Fragment() {
+class SettingsFragment : Fragment() {
companion object {
private const val TAG = "taler-wallet"
@@ -87,7 +87,7 @@ class Settings : Fragment() {
private const val PICK_FILE = 2
}
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryEventFragment.kt b/wallet/src/main/java/net/taler/wallet/history/HistoryEventFragment.kt
index 0093bb5..b6a2a33 100644
--- a/wallet/src/main/java/net/taler/wallet/history/HistoryEventFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/history/HistoryEventFragment.kt
@@ -35,12 +35,12 @@ import kotlinx.android.synthetic.main.fragment_event_withdraw.timeView
import net.taler.common.Amount
import net.taler.common.toAbsoluteTime
import net.taler.wallet.R
-import net.taler.wallet.WalletViewModel
+import net.taler.wallet.MainViewModel
import net.taler.wallet.cleanExchange
class HistoryEventFragment : Fragment() {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val historyManager by lazy { model.historyManager }
private val event by lazy { requireNotNull(historyManager.selectedEvent) }
diff --git a/wallet/src/main/java/net/taler/wallet/history/HistoryFragment.kt b/wallet/src/main/java/net/taler/wallet/history/HistoryFragment.kt
index 73dbae0..9f83d5a 100644
--- a/wallet/src/main/java/net/taler/wallet/history/HistoryFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/history/HistoryFragment.kt
@@ -36,7 +36,7 @@ import kotlinx.android.synthetic.main.fragment_show_history.*
import net.taler.common.fadeIn
import net.taler.common.fadeOut
import net.taler.wallet.R
-import net.taler.wallet.WalletViewModel
+import net.taler.wallet.MainViewModel
interface OnEventClickListener {
fun onEventClicked(event: HistoryEvent)
@@ -44,7 +44,7 @@ interface OnEventClickListener {
class HistoryFragment : Fragment(), OnEventClickListener {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val historyManager by lazy { model.historyManager }
private lateinit var showAllItem: MenuItem
private var reloadHistoryItem: MenuItem? = null
diff --git a/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt b/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
index 7fab695..6d31879 100644
--- a/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/payment/PromptPaymentFragment.kt
@@ -37,14 +37,14 @@ import net.taler.common.ContractTerms
import net.taler.common.fadeIn
import net.taler.common.fadeOut
import net.taler.wallet.R
-import net.taler.wallet.WalletViewModel
+import net.taler.wallet.MainViewModel
/**
* Show a payment and ask the user to accept/decline.
*/
class PromptPaymentFragment : Fragment(), ProductImageClickListener {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val paymentManager by lazy { model.paymentManager }
private val adapter = ProductAdapter(this)
diff --git a/wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt b/wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt
index d8b0896..1e776d4 100644
--- a/wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/pending/PendingOperationsFragment.kt
@@ -39,7 +39,7 @@ import com.google.android.material.snackbar.Snackbar.LENGTH_SHORT
import kotlinx.android.synthetic.main.fragment_pending_operations.*
import net.taler.wallet.R
import net.taler.wallet.TAG
-import net.taler.wallet.WalletViewModel
+import net.taler.wallet.MainViewModel
import org.json.JSONObject
interface PendingOperationClickListener {
@@ -49,7 +49,7 @@ interface PendingOperationClickListener {
class PendingOperationsFragment : Fragment(), PendingOperationClickListener {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val pendingOperationsManager by lazy { model.pendingOperationsManager }
private val pendingAdapter = PendingOperationsAdapter(emptyList(), this)
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/ErrorFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/ErrorFragment.kt
index f0f6610..fa5ab2f 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/ErrorFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/ErrorFragment.kt
@@ -27,11 +27,11 @@ import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
import kotlinx.android.synthetic.main.fragment_error.*
import net.taler.wallet.R
-import net.taler.wallet.WalletViewModel
+import net.taler.wallet.MainViewModel
class ErrorFragment : Fragment() {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val withdrawManager by lazy { model.withdrawManager }
override fun onCreateView(
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt
index 56a2a8c..747551b 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/PromptWithdrawFragment.kt
@@ -29,7 +29,7 @@ import net.taler.common.Amount
import net.taler.common.fadeIn
import net.taler.common.fadeOut
import net.taler.wallet.R
-import net.taler.wallet.WalletViewModel
+import net.taler.wallet.MainViewModel
import net.taler.wallet.cleanExchange
import net.taler.wallet.withdraw.WithdrawStatus.Loading
import net.taler.wallet.withdraw.WithdrawStatus.TermsOfServiceReviewRequired
@@ -37,7 +37,7 @@ import net.taler.wallet.withdraw.WithdrawStatus.Withdrawing
class PromptWithdrawFragment : Fragment() {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val withdrawManager by lazy { model.withdrawManager }
override fun onCreateView(
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt
index af76971..47b6f14 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/ReviewExchangeTosFragment.kt
@@ -29,11 +29,11 @@ import kotlinx.android.synthetic.main.fragment_review_exchange_tos.*
import net.taler.common.fadeIn
import net.taler.common.fadeOut
import net.taler.wallet.R
-import net.taler.wallet.WalletViewModel
+import net.taler.wallet.MainViewModel
class ReviewExchangeTosFragment : Fragment() {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val withdrawManager by lazy { model.withdrawManager }
override fun onCreateView(
diff --git a/wallet/src/main/java/net/taler/wallet/withdraw/SelectExchangeFragment.kt b/wallet/src/main/java/net/taler/wallet/withdraw/SelectExchangeFragment.kt
index 1e7ee3a..fd614c6 100644
--- a/wallet/src/main/java/net/taler/wallet/withdraw/SelectExchangeFragment.kt
+++ b/wallet/src/main/java/net/taler/wallet/withdraw/SelectExchangeFragment.kt
@@ -32,13 +32,13 @@ import net.taler.common.Amount
import net.taler.common.toRelativeTime
import net.taler.common.toShortDate
import net.taler.wallet.R
-import net.taler.wallet.WalletViewModel
+import net.taler.wallet.MainViewModel
import net.taler.wallet.withdraw.CoinFeeAdapter.CoinFeeViewHolder
import net.taler.wallet.withdraw.WireFeeAdapter.WireFeeViewHolder
class SelectExchangeFragment : Fragment() {
- private val model: WalletViewModel by activityViewModels()
+ private val model: MainViewModel by activityViewModels()
private val withdrawManager by lazy { model.withdrawManager }
override fun onCreateView(
diff --git a/wallet/src/main/res/layout/fragment_settings.xml b/wallet/src/main/res/layout/fragment_settings.xml
index fdd0120..27c5f57 100644
--- a/wallet/src/main/res/layout/fragment_settings.xml
+++ b/wallet/src/main/res/layout/fragment_settings.xml
@@ -20,7 +20,7 @@
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical"
- tools:context=".Settings">
+ tools:context=".SettingsFragment">
<TextView
diff --git a/wallet/src/main/res/layout/fragment_show_balance.xml b/wallet/src/main/res/layout/fragment_show_balance.xml
index 82b5106..3f4aa2e 100644
--- a/wallet/src/main/res/layout/fragment_show_balance.xml
+++ b/wallet/src/main/res/layout/fragment_show_balance.xml
@@ -13,79 +13,43 @@
~ 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.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout 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">
<androidx.recyclerview.widget.RecyclerView
- android:id="@+id/balancesList"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
+ android:id="@+id/mainList"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
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/list_item_balance"
tools:visibility="visible" />
<TextView
- android:id="@+id/balancesEmptyState"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
+ android:id="@+id/mainEmptyState"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
android:autoLink="web"
android:gravity="center"
android:padding="16dp"
android:text="@string/balances_empty_state"
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="gone" />
-
- <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/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" />
+ tools:visibility="visible" />
- <Button
- android:id="@+id/testWithdrawButton"
+ <com.google.android.material.floatingactionbutton.FloatingActionButton
+ android:id="@+id/mainFab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="16dp"
- android:layout_marginTop="16dp"
+ android:layout_gravity="bottom|end"
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" />
+ android:layout_marginBottom="16dp"
+ android:src="@drawable/ic_scan_qr"
+ app:backgroundTint="@color/colorPrimary"
+ app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"
+ app:layout_dodgeInsetEdges="bottom"
+ app:tint="?attr/colorOnPrimary" />
-</androidx.constraintlayout.widget.ConstraintLayout>
+</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/wallet/src/main/res/menu/activity_main_drawer.xml b/wallet/src/main/res/menu/activity_main_drawer.xml
index 49119f8..896ff69 100644
--- a/wallet/src/main/res/menu/activity_main_drawer.xml
+++ b/wallet/src/main/res/menu/activity_main_drawer.xml
@@ -25,10 +25,6 @@
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_settings"
android:title="@string/menu_settings" />
diff --git a/wallet/src/main/res/navigation/nav_graph.xml b/wallet/src/main/res/navigation/nav_graph.xml
index f6d8598..d4257b9 100644
--- a/wallet/src/main/res/navigation/nav_graph.xml
+++ b/wallet/src/main/res/navigation/nav_graph.xml
@@ -23,7 +23,7 @@
<fragment
android:id="@+id/showBalance"
- android:name="net.taler.wallet.BalanceFragment"
+ android:name="net.taler.wallet.MainFragment"
android:label="@string/balances_title"
tools:layout="@layout/fragment_show_balance">
<action
@@ -54,7 +54,7 @@
tools:layout="@layout/fragment_payment_successful" />
<fragment
android:id="@+id/settings"
- android:name="net.taler.wallet.Settings"
+ android:name="net.taler.wallet.SettingsFragment"
android:label="Settings"
tools:layout="@layout/fragment_settings" />