Alternate open source licenses plugin

This commit is contained in:
arkon 2020-06-06 11:40:46 -04:00
parent 0b73f8b1ef
commit ac2df87954
5 changed files with 45 additions and 12 deletions

1
.gitignore vendored
View file

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

View file

@ -3,7 +3,7 @@ import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
apply plugin: 'com.jaredsburrows.license'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
@ -31,6 +31,13 @@ ext {
}
}
licenseReport {
generateHtmlReport = true
generateJsonReport = false
copyHtmlReportToAssets = true
}
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
@ -78,6 +85,9 @@ android {
buildConfigField "boolean", "INCLUDE_UPDATER", "true"
dimension "default"
}
fdroid {
dimension "default"
}
dev {
resConfigs "en", "xxhdpi"
dimension "default"
@ -295,7 +305,22 @@ task copyResources(type: Copy) {
include '**/*'
}
preBuild.dependsOn(ktlintFormat, copyResources)
// See https://github.com/jaredsburrows/gradle-license-plugin/issues/113
task licenseReportPreBuild(type: Exec) {
switch (getGradle().getStartParameter().getTaskRequests().toString()) {
case ~/.*Standard.*/:
commandLine '../gradlew', 'licenseStandardReleaseReport'
break
case ~/.*Fdroid.*/:
commandLine '../gradlew', 'licenseFdroidReleaseReport'
break
case ~/.*Dev.*/:
commandLine '../gradlew', 'licenseDevReleaseReport'
break
}
}
preBuild.dependsOn(ktlintFormat, copyResources, licenseReportPreBuild)
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Standard")) {
apply plugin: 'com.google.gms.google-services'

View file

@ -124,13 +124,6 @@
android:name=".extension.util.ExtensionInstallActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.MaterialComponents" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.MaterialComponents" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"

View file

@ -5,9 +5,10 @@ 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.google.android.gms.oss.licenses.OssLicensesMenuActivity
import com.afollestad.materialdialogs.customview.customView
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.updater.UpdateChecker
@ -129,7 +130,7 @@ class AboutController : SettingsController() {
titleRes = R.string.licenses
onClick {
startActivity(Intent(activity, OssLicensesMenuActivity::class.java))
LicensesDialogController().showDialog(router)
}
}
}
@ -164,6 +165,19 @@ 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(

View file

@ -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.google.android.gms:oss-licenses-plugin:0.10.2")
classpath("com.jaredsburrows:gradle-license-plugin:0.8.80")
}
repositories {
google()