From 7fa8162e5b79cb0f5a20e267e63f0f4d3bc51102 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Mon, 5 Apr 2021 21:52:10 -0400 Subject: [PATCH] Separating "Check for updates" button + fixing about library + more about sites Twitter/Extensions added from upstream Co-Authored-By: arkon <4098258+arkon@users.noreply.github.com> --- .../tachiyomi/ui/setting/AboutController.kt | 125 +++++++++++------- buildSrc/src/main/kotlin/Dependencies.kt | 8 +- 2 files changed, 79 insertions(+), 54 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt index 08db6f4600..613c64cd8f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt @@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.ui.base.controller.DialogController import eu.kanade.tachiyomi.util.lang.toTimestampString import eu.kanade.tachiyomi.util.system.isOnline import eu.kanade.tachiyomi.util.system.toast +import eu.kanade.tachiyomi.util.view.openInBrowser import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job @@ -54,68 +55,92 @@ class AboutController : SettingsController() { titleRes = R.string.about preference { - titleRes = R.string.website - val url = "https://tachiyomi.org" - summary = url + key = "pref_whats_new" + titleRes = R.string.whats_new_this_release onClick { - val intent = Intent(Intent.ACTION_VIEW, url.toUri()) + val intent = Intent( + Intent.ACTION_VIEW, + if (BuildConfig.DEBUG) { + "https://github.com/Jays2Kings/tachiyomiJ2K/commits/master" + } else { + "https://github.com/Jays2Kings/tachiyomiJ2K/releases/tag/v${BuildConfig.VERSION_NAME}" + }.toUri() + ) startActivity(intent) } } - - preference { - title = "Discord" - val url = "https://discord.gg/tachiyomi" - summary = url - onClick { - val intent = Intent(Intent.ACTION_VIEW, url.toUri()) - startActivity(intent) - } - } - preference { - title = "Github" - val url = "https://github.com/Jays2Kings/tachiyomiJ2K" - summary = url - onClick { - val intent = Intent(Intent.ACTION_VIEW, url.toUri()) - startActivity(intent) - } - } - preferenceCategory { + if (isUpdaterEnabled) { preference { - titleRes = R.string.whats_new_this_release + key = "pref_check_for_updates" + titleRes = R.string.check_for_updates onClick { - val intent = Intent( - Intent.ACTION_VIEW, - if (BuildConfig.DEBUG) { - "https://github.com/Jays2Kings/tachiyomiJ2K/commits/master" - } else { - "https://github.com/Jays2Kings/tachiyomiJ2K/releases/tag/v${BuildConfig.VERSION_NAME}" - }.toUri() - ) - startActivity(intent) - } - } - preference { - titleRes = R.string.version - summary = if (BuildConfig.DEBUG) "r" + BuildConfig.COMMIT_COUNT - else BuildConfig.VERSION_NAME - - if (isUpdaterEnabled) { - onClick { - if (activity!!.isOnline()) { - checkVersion() - } else { - activity!!.toast(R.string.no_network_connection) - } + if (activity!!.isOnline()) { + checkVersion() + } else { + activity!!.toast(R.string.no_network_connection) } } } + } + preference { + key = "pref_version" + titleRes = R.string.version + summary = if (BuildConfig.DEBUG) "r" + BuildConfig.COMMIT_COUNT + else BuildConfig.VERSION_NAME + } + preference { + key = "pref_build_time" + titleRes = R.string.build_time + summary = getFormattedBuildTime() + } + + preferenceCategory { preference { - titleRes = R.string.build_time - summary = getFormattedBuildTime() + key = "pref_about_website" + titleRes = R.string.website + "https://tachiyomi.org".also { + summary = it + onClick { openInBrowser(it) } + } + } + + preference { + key = "pref_about_discord" + title = "Discord" + "https://discord.gg/tachiyomi".also { + summary = it + onClick { openInBrowser(it) } + } } preference { + key = "pref_about_github" + title = "Github" + "https://github.com/Jays2Kings/tachiyomiJ2K".also { + summary = it + onClick { openInBrowser(it) } + } + } + + preference { + key = "pref_about_twitter" + title = "Twitter" + "https://twitter.com/tachiyomiorg".also { + summary = it + onClick { openInBrowser(it) } + } + } + + preference { + key = "pref_about_label_extensions" + titleRes = R.string.extensions + "https://github.com/tachiyomiorg/tachiyomi-extensions".also { + summary = it + onClick { openInBrowser(it) } + } + } + + preference { + key = "pref_oss" titleRes = R.string.open_source_licenses onClick { diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 8cfb42e559..799518cc29 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -14,7 +14,7 @@ object Versions { const val RX_BINDING = "1.0.1" const val TIMBER = "4.7.1" const val WORKMANAGER = "2.5.0" - const val aboutLibraries = "8.3.0" + const val aboutLibraries = "0.10.3" const val androidAnnotations = "1.1.0" const val androidAppCompat = "1.1.0" const val androidBiometrics = "1.0.1" @@ -95,7 +95,7 @@ object Versions { } object LegacyPluginClassPath { - const val aboutLibraries = "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${Versions.aboutLibraries}" + const val aboutLibraries = "com.google.android.gms:oss-licenses-plugin:${Versions.aboutLibraries}" const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.androidGradlePlugin}" const val googleServices = "com.google.gms:google-services:${Versions.googleServices}" const val kotlinPlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" @@ -114,7 +114,7 @@ object AndroidVersions { } object Plugins { - const val aboutLibraries = "com.mikepenz.aboutlibraries.plugin" + const val aboutLibraries = "com.google.android.gms.oss-licenses-plugin" const val androidApplication = "com.android.application" const val firebaseCrashlytics = "com.google.firebase.crashlytics" const val googleServices = "com.google.gms.google-services" @@ -148,7 +148,7 @@ object BuildPluginsVersion { const val KOTLIN_GRADLE = "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN" const val KOTLINTER = "3.3.0" const val GOOGLE_SERVICES = "com.google.gms:google-services:4.3.3" - const val OSS_LICENSE = "com.google.android.gms:oss-licenses-plugin:0.10.2" + const val OSS_LICENSE = "com.google.android.gms:oss-licenses-plugin:0.10.3" const val VERSIONS_PLUGIN = "0.28.0" }