Switch to AboutLibraries

This commit is contained in:
arkon 2020-06-08 18:26:20 -04:00
parent ec9d592cf1
commit 7753161332
5 changed files with 16 additions and 51 deletions

1
.gitignore vendored
View File

@ -11,7 +11,6 @@
/build /build
*.apk *.apk
app/**/output.json app/**/output.json
open_source_licenses.html
# Hebrew assets are copied on build # Hebrew assets are copied on build
app/src/main/res/values-iw/ app/src/main/res/values-iw/

View File

@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.license' apply plugin: 'com.mikepenz.aboutlibraries.plugin'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
@ -29,21 +29,6 @@ ext {
df.setTimeZone(TimeZone.getTimeZone("UTC")) df.setTimeZone(TimeZone.getTimeZone("UTC"))
return df.format(new Date()) 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 { android {
@ -268,6 +253,11 @@ dependencies {
implementation "io.github.reactivecircus.flowbinding:flowbinding-swiperefreshlayout:$flowbinding_version" implementation "io.github.reactivecircus.flowbinding:flowbinding-swiperefreshlayout:$flowbinding_version"
implementation "io.github.reactivecircus.flowbinding:flowbinding-viewpager:$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 // Tests
testImplementation 'junit:junit:4.13' testImplementation 'junit:junit:4.13'
testImplementation 'org.assertj:assertj-core:3.12.2' testImplementation 'org.assertj:assertj-core:3.12.2'
@ -316,22 +306,7 @@ task copyResources(type: Copy) {
include '**/*' include '**/*'
} }
// See https://github.com/jaredsburrows/gradle-license-plugin/issues/113 preBuild.dependsOn(ktlintFormat, copyResources)
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)
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Standard")) { if (getGradle().getStartParameter().getTaskRequests().toString().contains("Standard")) {
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'

View File

@ -5,10 +5,9 @@ import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.webkit.WebView
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
import com.afollestad.materialdialogs.MaterialDialog 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.BuildConfig
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.updater.UpdateChecker import eu.kanade.tachiyomi.data.updater.UpdateChecker
@ -130,7 +129,12 @@ class AboutController : SettingsController() {
titleRes = R.string.licenses titleRes = R.string.licenses
onClick { 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) { class NewUpdateDialogController(bundle: Bundle? = null) : DialogController(bundle) {
constructor(body: String, url: String) : this( constructor(body: String, url: String) : this(

View File

@ -369,7 +369,7 @@
<string name="cookies_cleared">Cookies cleared</string> <string name="cookies_cleared">Cookies cleared</string>
<string name="choices_reset">Dialog choices reset</string> <string name="choices_reset">Dialog choices reset</string>
<string name="pref_clear_database">Clear database</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_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="clear_database_completed">Entries deleted</string>
<string name="pref_refresh_library_covers">Refresh library manga covers</string> <string name="pref_refresh_library_covers">Refresh library manga covers</string>

View File

@ -39,7 +39,7 @@ buildscript {
dependencies { dependencies {
classpath("com.github.zellius:android-shortcut-gradle-plugin:0.1.2") classpath("com.github.zellius:android-shortcut-gradle-plugin:0.1.2")
classpath("com.google.gms:google-services:4.3.3") 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 { repositories {
google() google()