Browse Source

Switch to AboutLibraries

arkon 4 years ago
parent
commit
7753161332

+ 0 - 1
.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/

+ 7 - 32
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'

+ 7 - 16
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(

+ 1 - 1
app/src/main/res/values/strings.xml

@@ -369,7 +369,7 @@
     <string name="cookies_cleared">Cookies cleared</string>
     <string name="choices_reset">Dialog choices reset</string>
     <string name="pref_clear_database">Clear database</string>
-    <string name="pref_clear_database_summary">Delete history for manga that are not in saved your library</string>
+    <string name="pref_clear_database_summary">Delete history for manga that are not saved in your library</string>
     <string name="clear_database_confirmation">Are you sure? Read chapters and progress of non-library manga will be lost</string>
     <string name="clear_database_completed">Entries deleted</string>
     <string name="pref_refresh_library_covers">Refresh library manga covers</string>

+ 1 - 1
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()