diff options
author | Torsten Grote <t@grobox.de> | 2020-02-21 13:52:10 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-02-21 13:52:10 -0300 |
commit | 9b07cda04a02f5e8f685feb505db251006fd45fd (patch) | |
tree | b8a4e2d5dda19ee6a5dd3b9af7519f24ebf635e7 | |
parent | 5522993ea436e1fb0eaec98b412fc97203bfd899 (diff) | |
download | wallet-android-9b07cda04a02f5e8f685feb505db251006fd45fd.tar.gz wallet-android-9b07cda04a02f5e8f685feb505db251006fd45fd.tar.bz2 wallet-android-9b07cda04a02f5e8f685feb505db251006fd45fd.zip |
Fix nav drawer item selection and other minor issues
-rw-r--r-- | app/src/main/java/net/taler/wallet/MainActivity.kt | 21 | ||||
-rw-r--r-- | app/src/main/java/net/taler/wallet/WalletViewModel.kt | 6 | ||||
-rw-r--r-- | app/src/main/res/menu/main.xml | 24 | ||||
-rw-r--r-- | app/src/main/res/navigation/nav_graph.xml | 19 | ||||
-rw-r--r-- | app/src/main/res/values-v21/styles.xml | 23 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 4 |
6 files changed, 23 insertions, 74 deletions
diff --git a/app/src/main/java/net/taler/wallet/MainActivity.kt b/app/src/main/java/net/taler/wallet/MainActivity.kt index b2e716e..299fbfe 100644 --- a/app/src/main/java/net/taler/wallet/MainActivity.kt +++ b/app/src/main/java/net/taler/wallet/MainActivity.kt @@ -22,7 +22,6 @@ import android.content.Intent import android.content.IntentFilter import android.os.Bundle import android.util.Log -import android.view.Menu import android.view.MenuItem import android.view.View.INVISIBLE import android.view.View.VISIBLE @@ -71,7 +70,9 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener, nav_view.menu.getItem(0).isChecked = true } - val appBarConfiguration = AppBarConfiguration(nav.graph, drawer_layout) + val appBarConfiguration = AppBarConfiguration( + setOf(R.id.showBalance, R.id.settings, R.id.walletHistory), drawer_layout + ) toolbar.setupWithNavController(nav, appBarConfiguration) model.init() @@ -140,22 +141,6 @@ class MainActivity : AppCompatActivity(), OnNavigationItemSelectedListener, } } - override fun onCreateOptionsMenu(menu: Menu): Boolean { - // Inflate the menu; this adds items to the action bar if it is present. - //menuInflater.inflate(R.menu.main, menu) - return false - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. - return when (item.itemId) { - R.id.action_settings -> true - else -> super.onOptionsItemSelected(item) - } - } - override fun onNavigationItemSelected(item: MenuItem): Boolean { // Handle navigation view item clicks here. when (item.itemId) { diff --git a/app/src/main/java/net/taler/wallet/WalletViewModel.kt b/app/src/main/java/net/taler/wallet/WalletViewModel.kt index b30ed7e..2942805 100644 --- a/app/src/main/java/net/taler/wallet/WalletViewModel.kt +++ b/app/src/main/java/net/taler/wallet/WalletViewModel.kt @@ -259,9 +259,12 @@ class WalletViewModel(val app: Application) : AndroidViewModel(app) { walletBackendApi.sendRequest("getWithdrawDetailsForUri", args) { isError, result -> if (isError) { + Log.e(TAG, "Error getWithdrawDetailsForUri ${result.toString(4)}") return@sendRequest } if (myWithdrawRequestId != this.currentWithdrawRequestId) { + val mismatch = "$myWithdrawRequestId != ${this.currentWithdrawRequestId}" + Log.w(TAG, "Got withdraw result for different request id $mismatch") return@sendRequest } Log.v(TAG, "got getWithdrawDetailsForUri result") @@ -288,9 +291,12 @@ class WalletViewModel(val app: Application) : AndroidViewModel(app) { walletBackendApi.sendRequest("getWithdrawDetailsForUri", args) { isError, result -> if (isError) { + Log.e(TAG, "Error getWithdrawDetailsForUri ${result.toString(4)}") return@sendRequest } if (myWithdrawRequestId != this.currentWithdrawRequestId) { + val mismatch = "$myWithdrawRequestId != ${this.currentWithdrawRequestId}" + Log.w(TAG, "Got withdraw result for different request id $mismatch") return@sendRequest } Log.v(TAG, "got getWithdrawDetailsForUri result (with exchange details)") diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml deleted file mode 100644 index 9bc6684..0000000 --- a/app/src/main/res/menu/main.xml +++ /dev/null @@ -1,24 +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/> - --> - -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - <item android:id="@+id/action_settings" - android:title="@string/action_settings" - android:orderInCategory="100" - app:showAsAction="never"/> -</menu> diff --git a/app/src/main/res/navigation/nav_graph.xml b/app/src/main/res/navigation/nav_graph.xml index 5cfbf5b..a82d7be 100644 --- a/app/src/main/res/navigation/nav_graph.xml +++ b/app/src/main/res/navigation/nav_graph.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. ~ @@ -79,24 +78,26 @@ <action android:id="@+id/action_promptWithdraw_to_reviewExchangeTOS" app:destination="@id/reviewExchangeTOS" - app:popUpTo="@id/showBalance"/> + app:popUpTo="@id/showBalance" /> </fragment> <fragment android:id="@+id/withdrawSuccessful" android:name="net.taler.wallet.WithdrawSuccessful" android:label="Withdrawal Confirmed" tools:layout="@layout/fragment_withdraw_successful" /> - <action - android:id="@+id/action_global_promptPayment" - app:destination="@id/promptPayment" /> <fragment android:id="@+id/reviewExchangeTOS" android:name="net.taler.wallet.ReviewExchangeTOS" android:label="Exchange's Terms of Service" - tools:layout="@layout/fragment_review_exchange_tos" > + tools:layout="@layout/fragment_review_exchange_tos"> <action android:id="@+id/action_reviewExchangeTOS_to_promptWithdraw" - app:popUpTo="@id/showBalance" - app:destination="@id/promptWithdraw" /> + app:destination="@id/promptWithdraw" + app:popUpTo="@id/showBalance" /> </fragment> + + <action + android:id="@+id/action_global_promptPayment" + app:destination="@id/promptPayment" /> + </navigation>
\ No newline at end of file diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml deleted file mode 100644 index 1f6099a..0000000 --- a/app/src/main/res/values-v21/styles.xml +++ /dev/null @@ -1,23 +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/> - --> - -<resources> - <style name="AppTheme.NoActionBar"> - <item name="windowActionBar">false</item> - <item name="windowNoTitle">true</item> - <item name="android:statusBarColor">@android:color/transparent</item> - </style> -</resources> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index dadd00a..630196a 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -20,11 +20,15 @@ <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> + <item name="colorOnPrimary">@android:color/white</item> </style> + <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> + <item name="android:statusBarColor">@android:color/transparent</item> </style> + <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar"/> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.MaterialComponents.Light"/> |