From 0682c6b3d3f7cef22725f3db15916346fdc4529e Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Thu, 16 Apr 2020 13:37:45 -0300 Subject: [wallet] change main screen if there is only one currency If there is more than one currency, the screen shows a list of balances per currency like it used to. If there is only one currency, the main screen directly shows the list of transactions with the balance in the toolbar. --- .../main/java/net/taler/wallet/transactions/TransactionsFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'wallet/src/main/java/net/taler/wallet/transactions') 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 4f62547..0d6e9ce 100644 --- a/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/transactions/TransactionsFragment.kt @@ -30,7 +30,6 @@ import androidx.fragment.app.activityViewModels import androidx.lifecycle.Observer import androidx.navigation.fragment.findNavController import androidx.recyclerview.widget.DividerItemDecoration -import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager.VERTICAL import kotlinx.android.synthetic.main.fragment_transactions.* import net.taler.common.fadeIn @@ -46,6 +45,7 @@ class TransactionsFragment : Fragment(), OnEventClickListener { private val model: MainViewModel by activityViewModels() private val transactionManager by lazy { model.transactionManager } + private val transactionAdapter by lazy { TransactionAdapter(model.devMode.value == true, this) } private val currency by lazy { transactionManager.selectedCurrency!! } @@ -63,7 +63,6 @@ class TransactionsFragment : Fragment(), OnEventClickListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { list.apply { - layoutManager = LinearLayoutManager(context) adapter = transactionAdapter addItemDecoration(DividerItemDecoration(context, VERTICAL)) } @@ -102,7 +101,7 @@ class TransactionsFragment : Fragment(), OnEventClickListener { override fun onEventClicked(event: Transaction) { if (event.detailPageLayout != 0) { transactionManager.selectedEvent = event - findNavController().navigate(R.id.action_nav_transactions_to_nav_transaction_detail) + findNavController().navigate(R.id.action_nav_transaction_detail) } else if (model.devMode.value == true) { JsonDialogFragment.new(event.json.toString(2)) .show(parentFragmentManager, null) @@ -118,6 +117,7 @@ class TransactionsFragment : Fragment(), OnEventClickListener { is TransactionsResult.Success -> { emptyState.visibility = if (result.transactions.isEmpty()) VISIBLE else INVISIBLE transactionAdapter.update(result.transactions) + list.fadeIn() } } -- cgit v1.2.3