diff options
author | Torsten Grote <t@grobox.de> | 2020-05-08 14:09:52 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2020-05-08 14:09:52 -0300 |
commit | 2a719e4e82a0e33c822a0b8e668a6a0312be1b6a (patch) | |
tree | c4f8608842f0afecdca1559f758ea53d65b1a4f5 /wallet | |
parent | 35b28a4e957be263447c432d6ab28924d0ef245c (diff) | |
download | taler-android-2a719e4e82a0e33c822a0b8e668a6a0312be1b6a.tar.gz taler-android-2a719e4e82a0e33c822a0b8e668a6a0312be1b6a.tar.bz2 taler-android-2a719e4e82a0e33c822a0b8e668a6a0312be1b6a.zip |
[wallet] Show versions in settings when dev mode is on
Diffstat (limited to 'wallet')
-rw-r--r-- | wallet/src/main/java/net/taler/wallet/SettingsFragment.kt | 28 | ||||
-rw-r--r-- | wallet/src/main/res/drawable/ic_account_balance.xml | 1 | ||||
-rw-r--r-- | wallet/src/main/res/drawable/ic_account_balance_wallet.xml | 1 | ||||
-rw-r--r-- | wallet/src/main/res/drawable/ic_add_circle.xml | 1 | ||||
-rw-r--r-- | wallet/src/main/res/drawable/ic_adjust.xml | 10 | ||||
-rw-r--r-- | wallet/src/main/res/drawable/ic_nuke.xml | 10 | ||||
-rw-r--r-- | wallet/src/main/res/drawable/ic_store_mall.xml | 10 | ||||
-rw-r--r-- | wallet/src/main/res/values/strings.xml | 5 | ||||
-rw-r--r-- | wallet/src/main/res/xml/settings_main.xml | 37 |
9 files changed, 101 insertions, 2 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt b/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt index c4622a6..2020c49 100644 --- a/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/SettingsFragment.kt @@ -26,6 +26,9 @@ import androidx.preference.PreferenceFragmentCompat import androidx.preference.SwitchPreferenceCompat import com.google.android.material.snackbar.BaseTransientBottomBar.LENGTH_SHORT import com.google.android.material.snackbar.Snackbar +import net.taler.wallet.BuildConfig.VERSION_CODE +import net.taler.wallet.BuildConfig.VERSION_NAME +import net.taler.wallet.BuildConfig.WALLET_CORE_VERSION class SettingsFragment : PreferenceFragmentCompat() { @@ -35,12 +38,30 @@ class SettingsFragment : PreferenceFragmentCompat() { private lateinit var prefDevMode: SwitchPreferenceCompat private lateinit var prefWithdrawTest: Preference + private lateinit var prefVersionApp: Preference + private lateinit var prefVersionCore: Preference + private lateinit var prefVersionExchange: Preference + private lateinit var prefVersionMerchant: Preference private lateinit var prefReset: Preference + private val devPrefs by lazy { + listOf( + prefWithdrawTest, + prefVersionApp, + prefVersionCore, + prefVersionExchange, + prefVersionMerchant, + prefReset + ) + } override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { setPreferencesFromResource(R.xml.settings_main, rootKey) prefDevMode = findPreference("pref_dev_mode")!! prefWithdrawTest = findPreference("pref_testkudos")!! + prefVersionApp = findPreference("pref_version_app")!! + prefVersionCore = findPreference("pref_version_core")!! + prefVersionExchange = findPreference("pref_version_protocol_exchange")!! + prefVersionMerchant = findPreference("pref_version_protocol_merchant")!! prefReset = findPreference("pref_reset")!! } @@ -49,8 +70,11 @@ class SettingsFragment : PreferenceFragmentCompat() { model.devMode.observe(viewLifecycleOwner, Observer { enabled -> prefDevMode.isChecked = enabled - prefWithdrawTest.isVisible = enabled - prefReset.isVisible = enabled + if (enabled) { + prefVersionApp.summary = "$VERSION_NAME ($VERSION_CODE)" + prefVersionCore.summary = WALLET_CORE_VERSION + } + devPrefs.forEach { it.isVisible = enabled } }) prefDevMode.setOnPreferenceChangeListener { _, newValue -> model.devMode.value = newValue as Boolean diff --git a/wallet/src/main/res/drawable/ic_account_balance.xml b/wallet/src/main/res/drawable/ic_account_balance.xml index 3f10d02..78836a0 100644 --- a/wallet/src/main/res/drawable/ic_account_balance.xml +++ b/wallet/src/main/res/drawable/ic_account_balance.xml @@ -17,6 +17,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" + android:tint="?attr/colorControlNormal" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path diff --git a/wallet/src/main/res/drawable/ic_account_balance_wallet.xml b/wallet/src/main/res/drawable/ic_account_balance_wallet.xml index 912d0a8..40ef939 100644 --- a/wallet/src/main/res/drawable/ic_account_balance_wallet.xml +++ b/wallet/src/main/res/drawable/ic_account_balance_wallet.xml @@ -1,6 +1,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" + android:tint="?attr/colorControlNormal" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path diff --git a/wallet/src/main/res/drawable/ic_add_circle.xml b/wallet/src/main/res/drawable/ic_add_circle.xml index 655a314..4144735 100644 --- a/wallet/src/main/res/drawable/ic_add_circle.xml +++ b/wallet/src/main/res/drawable/ic_add_circle.xml @@ -17,6 +17,7 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" + android:tint="?attr/colorControlNormal" android:viewportWidth="24.0" android:viewportHeight="24.0"> <path diff --git a/wallet/src/main/res/drawable/ic_adjust.xml b/wallet/src/main/res/drawable/ic_adjust.xml new file mode 100644 index 0000000..04c7907 --- /dev/null +++ b/wallet/src/main/res/drawable/ic_adjust.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FF000000" + android:pathData="M12,2C6.49,2 2,6.49 2,12s4.49,10 10,10 10,-4.49 10,-10S17.51,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM15,12c0,1.66 -1.34,3 -3,3s-3,-1.34 -3,-3 1.34,-3 3,-3 3,1.34 3,3z" /> +</vector> diff --git a/wallet/src/main/res/drawable/ic_nuke.xml b/wallet/src/main/res/drawable/ic_nuke.xml new file mode 100644 index 0000000..71a075a --- /dev/null +++ b/wallet/src/main/res/drawable/ic_nuke.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000" + android:pathData="M14.04,12H10V11H5.5A3.5,3.5 0 0,1 2,7.5A3.5,3.5 0 0,1 5.5,4C6.53,4 7.45,4.44 8.09,5.15C8.5,3.35 10.08,2 12,2C13.92,2 15.5,3.35 15.91,5.15C16.55,4.44 17.47,4 18.5,4A3.5,3.5 0 0,1 22,7.5A3.5,3.5 0 0,1 18.5,11H14.04V12M10,16.9V15.76H5V13.76H19V15.76H14.04V16.92L20,19.08C20.58,19.29 21,19.84 21,20.5A1.5,1.5 0 0,1 19.5,22H4.5A1.5,1.5 0 0,1 3,20.5C3,19.84 3.42,19.29 4,19.08L10,16.9Z" /> +</vector>
\ No newline at end of file diff --git a/wallet/src/main/res/drawable/ic_store_mall.xml b/wallet/src/main/res/drawable/ic_store_mall.xml new file mode 100644 index 0000000..53db426 --- /dev/null +++ b/wallet/src/main/res/drawable/ic_store_mall.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24.0" + android:viewportHeight="24.0"> + <path + android:fillColor="#FF000000" + android:pathData="M20,4L4,4v2h16L20,4zM21,14v-2l-1,-5L4,7l-1,5v2h1v6h10v-6h4v6h2v-6h1zM12,18L6,18v-4h6v4z" /> +</vector> diff --git a/wallet/src/main/res/values/strings.xml b/wallet/src/main/res/values/strings.xml index e01a0f0..a28545f 100644 --- a/wallet/src/main/res/values/strings.xml +++ b/wallet/src/main/res/values/strings.xml @@ -138,6 +138,11 @@ GNU Taler is immune against many types of fraud, such as phishing of credit card <string name="settings_dev_mode_summary">Shows more information intended for debugging</string> <string name="settings_withdraw_testkudos">Withdraw TESTKUDOS</string> <string name="settings_withdraw_testkudos_summary">Get money for testing</string> + <string name="settings_version_app">App Version</string> + <string name="settings_version_core">Wallet Core Version</string> + <string name="settings_version_protocol_exchange">Supported Exchange Versions</string> + <string name="settings_version_protocol_merchant">Supported Merchant Versions</string> + <string name="settings_version_unknown">Unknown</string> <string name="settings_reset">Reset Wallet (dangerous!)</string> <string name="settings_reset_summary">Throws away your money</string> diff --git a/wallet/src/main/res/xml/settings_main.xml b/wallet/src/main/res/xml/settings_main.xml index d200bb5..f4cc34e 100644 --- a/wallet/src/main/res/xml/settings_main.xml +++ b/wallet/src/main/res/xml/settings_main.xml @@ -32,6 +32,43 @@ tools:isPreferenceVisible="true" /> <Preference + app:icon="@drawable/ic_account_balance_wallet" + app:isPreferenceVisible="false" + app:key="pref_version_app" + app:selectable="false" + app:summary="@string/settings_version_unknown" + app:title="@string/settings_version_app" + tools:isPreferenceVisible="true" /> + + <Preference + app:icon="@drawable/ic_adjust" + app:isPreferenceVisible="false" + app:key="pref_version_core" + app:selectable="false" + app:summary="@string/settings_version_unknown" + app:title="@string/settings_version_core" + tools:isPreferenceVisible="true" /> + + <Preference + app:icon="@drawable/ic_account_balance" + app:isPreferenceVisible="false" + app:key="pref_version_protocol_exchange" + app:selectable="false" + app:summary="@string/settings_version_unknown" + app:title="@string/settings_version_protocol_exchange" + tools:isPreferenceVisible="true" /> + + <Preference + app:icon="@drawable/ic_store_mall" + app:isPreferenceVisible="false" + app:key="pref_version_protocol_merchant" + app:selectable="false" + app:summary="@string/settings_version_unknown" + app:title="@string/settings_version_protocol_merchant" + tools:isPreferenceVisible="true" /> + + <Preference + app:icon="@drawable/ic_nuke" app:isPreferenceVisible="false" app:key="pref_reset" app:summary="@string/settings_reset_summary" |