Explorar el Código

Add link to website and open source licenses

arkon hace 5 años
padre
commit
ca47446b46

+ 3 - 1
app/build.gradle

@@ -1,13 +1,13 @@
 import java.text.SimpleDateFormat
 
 apply plugin: 'com.android.application'
+apply plugin: 'com.google.android.gms.oss-licenses-plugin'
 apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-android-extensions'
 apply plugin: 'kotlin-kapt'
 apply plugin: 'com.github.zellius.shortcut-helper'
 apply plugin: "org.jmailen.kotlinter"
 
-
 shortcutHelper.filePath = './shortcuts.xml'
 
 ext {
@@ -259,6 +259,8 @@ dependencies {
     implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
     implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
 
+    implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
+
     // For detecting memory leaks; see https://square.github.io/leakcanary/
 //    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
 }

+ 7 - 0
app/src/main/AndroidManifest.xml

@@ -119,6 +119,13 @@
             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"

+ 17 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt

@@ -6,6 +6,7 @@ import android.net.Uri
 import android.os.Bundle
 import androidx.preference.PreferenceScreen
 import com.afollestad.materialdialogs.MaterialDialog
+import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
 import eu.kanade.tachiyomi.BuildConfig
 import eu.kanade.tachiyomi.R
 import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
@@ -72,6 +73,15 @@ class AboutController : SettingsController() {
                 isVisible = false
             }
         }
+        preference {
+            titleRes = R.string.website
+            val url = "https://tachiyomi.org"
+            summary = url
+            onClick {
+                val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
+                startActivity(intent)
+            }
+        }
         preference {
             title = "Discord"
             val url = "https://discord.gg/tachiyomi"
@@ -109,6 +119,13 @@ class AboutController : SettingsController() {
                 ChangelogDialogController().showDialog(router)
             }
         }
+        preference {
+            titleRes = R.string.licenses
+
+            onClick {
+                startActivity(Intent(activity, OssLicensesMenuActivity::class.java))
+            }
+        }
     }
 
     /**

+ 2 - 0
app/src/main/res/values/strings.xml

@@ -350,10 +350,12 @@
     <string name="battery_optimization_disabled">Battery optimization is already disabled</string>
 
       <!-- About section -->
+    <string name="website">Website</string>
     <string name="version">Version</string>
     <string name="build_time">Build time</string>
     <string name="notices">Notices</string>
     <string name="changelog">Changelog</string>
+    <string name="licenses">Open source licenses</string>
     <string name="pref_enable_automatic_updates">Check for updates</string>
     <string name="pref_enable_automatic_updates_summary">Automatically check for new app versions</string>
     <!-- ACRA -->

+ 1 - 0
build.gradle.kts

@@ -13,6 +13,7 @@ buildscript {
         classpath("com.github.zellius:android-shortcut-gradle-plugin:0.1.2")
         classpath("org.jmailen.gradle:kotlinter-gradle:2.3.2")
         classpath("com.google.gms:google-services:4.3.3")
+        classpath("com.google.android.gms:oss-licenses-plugin:0.10.2")
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
     }