gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-android] branch master updated: [cashier] Add about screen


From: gnunet
Subject: [taler-taler-android] branch master updated: [cashier] Add about screen with version and license info
Date: Thu, 24 Sep 2020 14:30:05 +0200

This is an automated email from the git hooks/post-receive script.

torsten-grote pushed a commit to branch master
in repository taler-android.

The following commit(s) were added to refs/heads/master by this push:
     new 841d87d  [cashier] Add about screen with version and license info
841d87d is described below

commit 841d87d5f9f05bc4a5e050948af2577cd87efade
Author: Torsten Grote <t@grobox.de>
AuthorDate: Thu Sep 24 09:29:38 2020 -0300

    [cashier] Add about screen with version and license info
---
 .../java/net/taler/cashier/AboutDialogFragment.kt  | 63 +++++++++++++++++
 .../main/java/net/taler/cashier/BalanceFragment.kt |  6 +-
 .../java/net/taler/cashier/config/ConfigManager.kt |  2 +-
 .../src/main/res/layout/fragment_about_dialog.xml  | 81 ++++++++++++++++++++++
 cashier/src/main/res/menu/balance.xml              |  4 ++
 cashier/src/main/res/values/strings.xml            | 12 ++++
 6 files changed, 166 insertions(+), 2 deletions(-)

diff --git a/cashier/src/main/java/net/taler/cashier/AboutDialogFragment.kt 
b/cashier/src/main/java/net/taler/cashier/AboutDialogFragment.kt
new file mode 100644
index 0000000..cdea792
--- /dev/null
+++ b/cashier/src/main/java/net/taler/cashier/AboutDialogFragment.kt
@@ -0,0 +1,63 @@
+/*
+ * 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.cashier
+
+import android.os.Bundle
+import android.os.Handler
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.view.WindowManager
+import android.widget.Button
+import androidx.appcompat.app.AppCompatActivity
+import androidx.fragment.app.DialogFragment
+import androidx.fragment.app.Fragment
+import net.taler.cashier.BuildConfig.VERSION_NAME
+import net.taler.cashier.config.VERSION_BANK
+import net.taler.cashier.databinding.FragmentAboutDialogBinding
+import net.taler.cashier.databinding.FragmentBalanceBinding
+import net.taler.lib.common.Version
+
+class AboutDialogFragment : DialogFragment() {
+
+    private lateinit var ui: FragmentAboutDialogBinding
+
+    override fun onCreateView(
+        inflater: LayoutInflater,
+        container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        ui = FragmentAboutDialogBinding.inflate(layoutInflater, container, 
false)
+        return ui.root
+    }
+
+    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+        super.onViewCreated(view, savedInstanceState)
+
+        ui.versionView.text = getString(R.string.about_version, VERSION_NAME)
+        ui.bankVersionView.text = getString(R.string.about_supported_bank_api, 
VERSION_BANK.str())
+        ui.licenseView.text = getString(R.string.about_license, 
getString(R.string.about_license_content))
+        ui.copyrightView.text = getString(R.string.about_copyright, 
getString(R.string.about_copyright_holder))
+
+        ui.button.setOnClickListener { dismiss() }
+    }
+
+    private fun Version.str(): String {
+        return "$current:$revision:$age"
+    }
+
+}
\ No newline at end of file
diff --git a/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt 
b/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt
index 86ace20..1328484 100644
--- a/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt
+++ b/cashier/src/main/java/net/taler/cashier/BalanceFragment.kt
@@ -46,7 +46,7 @@ sealed class BalanceResult {
 class BalanceFragment : Fragment() {
 
     private val viewModel: MainViewModel by activityViewModels()
-    private val configManager by lazy { viewModel.configManager}
+    private val configManager by lazy { viewModel.configManager }
     private val withdrawManager by lazy { viewModel.withdrawManager }
 
     private lateinit var ui: FragmentBalanceBinding
@@ -118,6 +118,10 @@ class BalanceFragment : Fragment() {
             findNavController().navigate(configManager.configDestination)
             true
         }
+        R.id.action_about -> {
+            AboutDialogFragment().show(parentFragmentManager, "ABOUT")
+            true
+        }
         else -> super.onOptionsItemSelected(item)
     }
 
diff --git a/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt 
b/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
index fa4e1d5..e9f4117 100644
--- a/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
+++ b/cashier/src/main/java/net/taler/cashier/config/ConfigManager.kt
@@ -42,7 +42,7 @@ import net.taler.cashier.Response.Companion.response
 import net.taler.common.getIncompatibleStringOrNull
 import net.taler.lib.common.Version
 
-private val VERSION_BANK = Version(0, 0, 0)
+val VERSION_BANK = Version(0, 0, 0)
 private const val PREF_NAME = "net.taler.cashier.prefs"
 private const val PREF_KEY_BANK_URL = "bankUrl"
 private const val PREF_KEY_USERNAME = "username"
diff --git a/cashier/src/main/res/layout/fragment_about_dialog.xml 
b/cashier/src/main/res/layout/fragment_about_dialog.xml
new file mode 100644
index 0000000..2bb7742
--- /dev/null
+++ b/cashier/src/main/res/layout/fragment_about_dialog.xml
@@ -0,0 +1,81 @@
+<?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/>
+  -->
+
+<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:padding="16dp"
+    tools:context=".AboutDialogFragment">
+
+    <TextView
+        android:id="@+id/titleView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:maxLines="1"
+        android:text="@string/about_title"
+        android:textAppearance="@style/TextAppearance.AppCompat.Headline"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <TextView
+        android:id="@+id/versionView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        android:text="@string/about_version"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/titleView" />
+
+    <TextView
+        android:id="@+id/bankVersionView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        android:text="@string/about_supported_bank_api"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/versionView" />
+
+    <TextView
+        android:id="@+id/licenseView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        android:text="@string/about_license"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/bankVersionView" />
+
+    <TextView
+        android:id="@+id/copyrightView"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        android:text="@string/about_copyright"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/licenseView" />
+
+    <Button
+        android:id="@+id/button"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dp"
+        android:text="@string/ok"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/copyrightView" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/cashier/src/main/res/menu/balance.xml 
b/cashier/src/main/res/menu/balance.xml
index eac38d6..816512b 100644
--- a/cashier/src/main/res/menu/balance.xml
+++ b/cashier/src/main/res/menu/balance.xml
@@ -25,5 +25,9 @@
         android:id="@+id/action_lock"
         android:title="@string/action_lock"
         app:showAsAction="never" />
+    <item
+        android:id="@+id/action_about"
+        android:title="@string/action_about"
+        app:showAsAction="never" />
 
 </menu>
diff --git a/cashier/src/main/res/values/strings.xml 
b/cashier/src/main/res/values/strings.xml
index 4a8064f..4c000d8 100644
--- a/cashier/src/main/res/values/strings.xml
+++ b/cashier/src/main/res/values/strings.xml
@@ -15,8 +15,12 @@
     <string name="balance_current_label">Current balance</string>
     <string name="balance_error">ERROR: %s</string>
     <string name="balance_offline">Offline. Please connect to the 
Internet.</string>
+
+    <string name="ok">OK</string>
+
     <string name="action_reconfigure">Reconfigure</string>
     <string name="action_lock">Lock</string>
+    <string name="action_about">About</string>
 
     <string name="withdraw_input_amount">Amount</string>
     <string name="withdraw_into">How much e-cash should be withdrawn?</string>
@@ -40,4 +44,12 @@
     <string name="transaction_last_aborted">Last Transaction: Aborted</string>
     <string name="transaction_last_error">Last Transaction: Failed</string>
 
+    <string name="about_title">GNU Taler Cashier</string>
+    <string name="about_version">Version: %s</string>
+    <string name="about_license">License: %s</string>
+    <string name="about_license_content" 
translatable="false">GPL-3.0-or-later</string>
+    <string name="about_copyright">Copyright: %s</string>
+    <string name="about_copyright_holder" translatable="false">Taler Systems 
S.A.</string>
+    <string name="about_supported_bank_api">Bank API Version: %s</string>
+
 </resources>

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]