From cbfd186686f39c86385de365ba19f43004e8b049 Mon Sep 17 00:00:00 2001 From: Jannik Date: Tue, 13 Oct 2020 21:27:05 +0200 Subject: [PATCH] added licenses dialog --- app/build.gradle | 5 +- .../java/org/mosad/teapod/MainActivity.kt | 22 +++++++ .../teapod/ui/account/AccountFragment.kt | 19 ++++-- app/src/main/res/layout/fragment_account.xml | 20 ++++++ app/src/main/res/raw/notices.xml | 63 +++++++++++++++++++ app/src/main/res/values-de-rDE/strings.xml | 3 + app/src/main/res/values/strings.xml | 5 +- 7 files changed, 129 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/raw/notices.xml diff --git a/app/build.gradle b/app/build.gradle index de296d7..bb8d40a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,7 +11,7 @@ android { minSdkVersion 23 targetSdkVersion 30 versionCode 1 - versionName "0.1-alpha1" + versionName "0.1-alpha2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" resValue "string", "build_time", buildTime() @@ -44,6 +44,7 @@ dependencies { implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0' implementation 'androidx.navigation:navigation-ui-ktx:2.3.0' implementation 'androidx.security:security-crypto:1.1.0-alpha02' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.google.android.material:material:1.2.1' implementation 'com.google.code.gson:gson:2.8.6' @@ -57,7 +58,7 @@ dependencies { implementation 'jp.wasabeef:glide-transformations:4.3.0' implementation 'com.afollestad.material-dialogs:core:3.3.0' implementation 'com.afollestad.material-dialogs:bottomsheets:3.3.0' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'de.psdev.licensesdialog:licensesdialog:2.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.2' diff --git a/app/src/main/java/org/mosad/teapod/MainActivity.kt b/app/src/main/java/org/mosad/teapod/MainActivity.kt index 7546e86..0e1bff1 100644 --- a/app/src/main/java/org/mosad/teapod/MainActivity.kt +++ b/app/src/main/java/org/mosad/teapod/MainActivity.kt @@ -1,3 +1,25 @@ +/** + * Teapod + * + * Copyright 2020 + * + * This program 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 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + package org.mosad.teapod import android.content.Intent diff --git a/app/src/main/java/org/mosad/teapod/ui/account/AccountFragment.kt b/app/src/main/java/org/mosad/teapod/ui/account/AccountFragment.kt index 6891512..8cc94ae 100644 --- a/app/src/main/java/org/mosad/teapod/ui/account/AccountFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/account/AccountFragment.kt @@ -6,7 +6,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment -import com.afollestad.materialdialogs.MaterialDialog +import com.google.android.material.dialog.MaterialAlertDialogBuilder +import de.psdev.licensesdialog.LicensesDialog import kotlinx.android.synthetic.main.fragment_account.* import org.mosad.teapod.BuildConfig import org.mosad.teapod.R @@ -35,9 +36,19 @@ class AccountFragment : Fragment() { } linear_about.setOnClickListener { - MaterialDialog(requireContext()) - .title(R.string.info_about) - .message(R.string.info_about_dialog) + MaterialAlertDialogBuilder(requireContext()) + .setTitle(R.string.info_about) + .setMessage(R.string.info_about_dialog) + .show() + } + + text_licenses.setOnClickListener { + LicensesDialog.Builder(requireContext()) + .setNotices(R.raw.notices) + .setTitle(R.string.licenses) + .setIncludeOwnLicense(true) + .setThemeResourceId(R.style.AppTheme) + .build() .show() } } diff --git a/app/src/main/res/layout/fragment_account.xml b/app/src/main/res/layout/fragment_account.xml index eb99b63..d633aa1 100644 --- a/app/src/main/res/layout/fragment_account.xml +++ b/app/src/main/res/layout/fragment_account.xml @@ -39,6 +39,7 @@ android:id="@+id/linear_account_login" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_margin="7dp" android:gravity="center" android:orientation="horizontal"> @@ -103,6 +104,7 @@ android:id="@+id/linear_about" android:layout_width="match_parent" android:layout_height="match_parent" + android:layout_margin="7dp" android:gravity="center" android:orientation="horizontal"> @@ -110,6 +112,7 @@ android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:contentDescription="@string/info" android:minWidth="48dp" android:minHeight="48dp" android:padding="5dp" @@ -140,6 +143,23 @@ + + + + diff --git a/app/src/main/res/raw/notices.xml b/app/src/main/res/raw/notices.xml new file mode 100644 index 0000000..633e7ff --- /dev/null +++ b/app/src/main/res/raw/notices.xml @@ -0,0 +1,63 @@ + + + + AndroidX + https://developer.android.com/jetpack/androidx + Copyright The Android Open Source Project + Apache Software License 2.0 + + + Material Components for Android + https://github.com/material-components/material-components-android + Copyright The Android Open Source Project + Apache Software License 2.0 + + + ExoPlayer + https://github.com/material-components/material-components-android + Copyright The Android Open Source Project + Apache Software License 2.0 + + + Gson + https://github.com/google/gson + Copyright 2008 Google Inc. + Apache Software License 2.0 + + + Material design icons + https://github.com/google/material-design-icons + Copyright Google Inc. + Apache Software License 2.0 + + + Material Dialogs + https://github.com/afollestad/material-dialogs + Copyright Aidan Follestad + Apache Software License 2.0 + + + Jsoup + https://jsoup.org/ + Copyright 2009 - 2020 Jonathan Hedley + MIT License + + + kotlinx.coroutines + https://github.com/Kotlin/kotlinx.coroutines + Copyright 2016 - 2019 JetBrains + Apache Software License 2.0 + + + Glide + https://github.com/bumptech/glide + Copyright Google, Inc + BSD 3-Clause License + + + Glide Transformations + https://github.com/wasabeef/glide-transformations + Copyright 2020 Wasabeef + Apache Software License 2.0 + + \ No newline at end of file diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index a177454..9b59b1d 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -18,6 +18,9 @@ Account Zum bearbeiten tippen Info + Version %1$s (%2$s) + Diese App wird unter den Bedingungen der GNU GPL 3 oder höher zur Verfügung gestellt. Weiter Informationen findest du unter: \ngit.mosad.xyz/Seil0/teapod \n\n© 2020 seil0@mosad.xyz + Lizenzen speichern diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 63f1dc7..e092a30 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -26,8 +26,9 @@ Tap to edit Info Teapod by @Seil0 - Version %1$s (%2$s) - This software is published under the terms and conditions of GPL 3. For further information visit: \ngit.mosad.xyz/Seil0/teapod \n\n© 2020 seil0@mosad.xyz + Version %1$s (%2$s) + This app is published under the terms and conditions of the GNU GPL 3 or later. For further information visit: \ngit.mosad.xyz/Seil0/teapod \n\n© 2020 seil0@mosad.xyz + Licenses save