From 77531613325d32d64f543b96b02587a253949ecf Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 8 Jun 2020 18:26:20 -0400 Subject: [PATCH] Switch to AboutLibraries --- .gitignore | 1 - app/build.gradle | 39 ++++--------------- .../tachiyomi/ui/more/AboutController.kt | 23 ++++------- app/src/main/res/values/strings.xml | 2 +- build.gradle.kts | 2 +- 5 files changed, 16 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index b5ef6219e1..93b8ea71fa 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,6 @@ /build *.apk app/**/output.json -open_source_licenses.html # Hebrew assets are copied on build app/src/main/res/values-iw/ diff --git a/app/build.gradle b/app/build.gradle index 0e56b05c39..b4096f3d6f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile import java.text.SimpleDateFormat apply plugin: 'com.android.application' -apply plugin: 'com.jaredsburrows.license' +apply plugin: 'com.mikepenz.aboutlibraries.plugin' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' @@ -29,21 +29,6 @@ ext { df.setTimeZone(TimeZone.getTimeZone("UTC")) return df.format(new Date()) } - - getGradleWrapper = { - if (System.properties['os.name'].toLowerCase().contains('windows')) { - return '../gradlew.bat' - } else { - return '../gradlew' - } - } -} - -licenseReport { - generateHtmlReport = true - generateJsonReport = false - - copyHtmlReportToAssets = true } android { @@ -268,6 +253,11 @@ dependencies { implementation "io.github.reactivecircus.flowbinding:flowbinding-swiperefreshlayout:$flowbinding_version" implementation "io.github.reactivecircus.flowbinding:flowbinding-viewpager:$flowbinding_version" + // Licenses + final aboutlibraries_version = '8.2.0' + implementation "com.mikepenz:aboutlibraries-core:$aboutlibraries_version" + implementation "com.mikepenz:aboutlibraries:$aboutlibraries_version" + // Tests testImplementation 'junit:junit:4.13' testImplementation 'org.assertj:assertj-core:3.12.2' @@ -316,22 +306,7 @@ task copyResources(type: Copy) { include '**/*' } -// See https://github.com/jaredsburrows/gradle-license-plugin/issues/113 -task licenseReportPreBuild(type: Exec) { - switch (getGradle().getStartParameter().getTaskRequests().toString()) { - case ~/.*Standard.*/: - commandLine getGradleWrapper(), 'licenseStandardReleaseReport' - break - case ~/.*Fdroid.*/: - commandLine getGradleWrapper(), 'licenseFdroidReleaseReport' - break - case ~/.*Dev.*/: - commandLine getGradleWrapper(), 'licenseDevReleaseReport' - break - } -} - -preBuild.dependsOn(ktlintFormat, copyResources, licenseReportPreBuild) +preBuild.dependsOn(ktlintFormat, copyResources) if (getGradle().getStartParameter().getTaskRequests().toString().contains("Standard")) { apply plugin: 'com.google.gms.google-services' diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt index 96603e572a..c0661e4daf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt @@ -5,10 +5,9 @@ import android.content.Intent import android.net.Uri import android.os.Build import android.os.Bundle -import android.webkit.WebView import androidx.preference.PreferenceScreen import com.afollestad.materialdialogs.MaterialDialog -import com.afollestad.materialdialogs.customview.customView +import com.mikepenz.aboutlibraries.LibsBuilder import eu.kanade.tachiyomi.BuildConfig import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.updater.UpdateChecker @@ -130,7 +129,12 @@ class AboutController : SettingsController() { titleRes = R.string.licenses onClick { - LicensesDialogController().showDialog(router) + LibsBuilder() + .withActivityTitle(activity!!.getString(R.string.licenses)) + .withAboutIconShown(false) + .withAboutVersionShown(false) + .withLicenseShown(true) + .start(activity!!) } } } @@ -165,19 +169,6 @@ class AboutController : SettingsController() { } } - class LicensesDialogController(bundle: Bundle? = null) : DialogController(bundle) { - - override fun onCreateDialog(savedViewState: Bundle?): Dialog { - val webView = WebView(activity!!) - webView.loadUrl("file:///android_asset/open_source_licenses.html") - - return MaterialDialog(activity!!) - .title(res = R.string.licenses) - .customView(view = webView) - .positiveButton(res = android.R.string.ok) - } - } - class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundle) { constructor(body: String, url: String) : this( diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 12c349c082..52091b0916 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -369,7 +369,7 @@ Cookies cleared Dialog choices reset Clear database - Delete history for manga that are not in saved your library + Delete history for manga that are not saved in your library Are you sure? Read chapters and progress of non-library manga will be lost Entries deleted Refresh library manga covers diff --git a/build.gradle.kts b/build.gradle.kts index efc38e14aa..48b28dd51a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -39,7 +39,7 @@ buildscript { dependencies { classpath("com.github.zellius:android-shortcut-gradle-plugin:0.1.2") classpath("com.google.gms:google-services:4.3.3") - classpath("com.jaredsburrows:gradle-license-plugin:0.8.80") + classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:8.2.0") } repositories { google()