From 3093e3a789f2df4766f72764708a5b48595a0139 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 6 Dec 2019 09:31:48 -0300 Subject: [PATCH 1/2] Add About DialogFragment reachable from main overflow menu --- .../seedvault/settings/AboutDialogFragment.kt | 29 +++++ .../seedvault/settings/SettingsFragment.kt | 6 +- app/src/main/res/layout/fragment_about.xml | 121 ++++++++++++++++++ app/src/main/res/menu/settings_menu.xml | 5 + app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/strings.xml | 11 +- app/src/main/res/values/themes.xml | 1 + 7 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/stevesoltys/seedvault/settings/AboutDialogFragment.kt create mode 100644 app/src/main/res/layout/fragment_about.xml diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/AboutDialogFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/AboutDialogFragment.kt new file mode 100644 index 00000000..8653777b --- /dev/null +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/AboutDialogFragment.kt @@ -0,0 +1,29 @@ +package com.stevesoltys.seedvault.settings + +import android.os.Bundle +import android.text.method.LinkMovementMethod +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.DialogFragment +import com.stevesoltys.seedvault.R +import kotlinx.android.synthetic.main.fragment_about.* + +class AboutDialogFragment : DialogFragment() { + + companion object { + internal val TAG = AboutDialogFragment::class.java.simpleName + } + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { + return inflater.inflate(R.layout.fragment_about, container, false) + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + val linkMovementMethod = LinkMovementMethod.getInstance() + licenseView.movementMethod = linkMovementMethod + authorView.movementMethod = linkMovementMethod + sponsorView.movementMethod = linkMovementMethod + } + +} diff --git a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsFragment.kt index b3dcd79b..82ed0246 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/settings/SettingsFragment.kt @@ -103,7 +103,7 @@ class SettingsFragment : PreferenceFragmentCompat() { super.onStart() // we need to re-set the title when returning to this fragment - activity?.setTitle(R.string.app_name) + activity?.setTitle(R.string.backup) storage = settingsManager.getStorage() setBackupState() @@ -139,6 +139,10 @@ class SettingsFragment : PreferenceFragmentCompat() { startActivity(Intent(requireContext(), RestoreActivity::class.java)) true } + item.itemId == R.id.action_about -> { + AboutDialogFragment().show(fragmentManager!!, AboutDialogFragment.TAG) + true + } else -> super.onOptionsItemSelected(item) } diff --git a/app/src/main/res/layout/fragment_about.xml b/app/src/main/res/layout/fragment_about.xml new file mode 100644 index 00000000..7b94c57c --- /dev/null +++ b/app/src/main/res/layout/fragment_about.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/menu/settings_menu.xml b/app/src/main/res/menu/settings_menu.xml index 71b7d5fc..c5e8b2c9 100644 --- a/app/src/main/res/menu/settings_menu.xml +++ b/app/src/main/res/menu/settings_menu.xml @@ -17,4 +17,9 @@ app:showAsAction="never" tools:visible="true" /> + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 63a97fea..4dec0d1c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,4 +1,5 @@ + #99cc00 #8A000000 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c6632033..b965ff78 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,6 +1,7 @@ Seedvault + Backup Restore backup @@ -25,7 +26,7 @@ People with access to your storage location can learn which apps you use, but do not get access to the apps\' data. USB Flash Drive Needs to be plugged in - %1$s free + %1$s free Initializing backup location… Looking for backups… An error occurred while accessing the backup location. @@ -89,4 +90,12 @@ Choose Other Use anyway + + About + A backup application using Android\'s internal backup API. + License: Apache2 + Written by: Steve Soltys and Torsten Grote + Sponsored by: Calyx Institute for use in CalyxOS + Source Code: https://github.com/stevesoltys/seedvault + diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 96232824..c1b981cd 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,6 +1,7 @@ From 6520f6aa04949241634e1ad6bceee2f3e7e06985 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 6 Dec 2019 09:38:07 -0300 Subject: [PATCH 2/2] Upgrade Kotlin and Android Gradle Plugin --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 4ce498dd..65385e66 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.3.61' repositories { jcenter() @@ -10,7 +10,7 @@ buildscript { } dependencies { // newer versions require us to remove targetSdkVersion from Manifest - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:3.5.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong