From 3372d8bcbddb59e11b9237b9db2adba37fa61a68 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 26 Jan 2020 12:09:12 +0800 Subject: [PATCH] Add OSS licenses --- build.gradle | 1 + mobile/build.gradle | 2 ++ .../be/mygod/vpnhotspot/SettingsPreferenceFragment.kt | 5 +++++ mobile/src/main/res/drawable/ic_action_code.xml | 10 ++++++++++ mobile/src/main/res/xml/pref_settings.xml | 5 +++++ 5 files changed, 23 insertions(+) create mode 100644 mobile/src/main/res/drawable/ic_action_code.xml diff --git a/build.gradle b/build.gradle index 5e60d61b..c2c8723c 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,7 @@ buildscript { classpath 'com.android.tools.build:gradle:4.0.0-alpha09' classpath 'com.github.ben-manes:gradle-versions-plugin:0.27.0' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta01' + classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5' classpath 'com.google.gms:google-services:4.3.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } diff --git a/mobile/build.gradle b/mobile/build.gradle index 97776949..253a9b95 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.application' +apply plugin: 'com.google.android.gms.oss-licenses-plugin' apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'com.google.gms.google-services' apply plugin: 'kotlin-android' @@ -81,6 +82,7 @@ dependencies { implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' implementation 'com.android.billingclient:billing-ktx:2.1.0' implementation 'com.github.topjohnwu.libsu:core:2.5.1' + implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' implementation 'com.google.android.material:material:1.1.0-rc02' implementation 'com.google.firebase:firebase-analytics:17.2.2' implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01' diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/SettingsPreferenceFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/SettingsPreferenceFragment.kt index 097c3da1..2ae034ff 100644 --- a/mobile/src/main/java/be/mygod/vpnhotspot/SettingsPreferenceFragment.kt +++ b/mobile/src/main/java/be/mygod/vpnhotspot/SettingsPreferenceFragment.kt @@ -22,6 +22,7 @@ import be.mygod.vpnhotspot.util.RootSession import be.mygod.vpnhotspot.util.launchUrl import be.mygod.vpnhotspot.util.showAllowingStateLoss import be.mygod.vpnhotspot.widget.SmartSnackbar +import com.google.android.gms.oss.licenses.OssLicensesMenuActivity import com.google.android.material.snackbar.Snackbar import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope @@ -171,6 +172,10 @@ class SettingsPreferenceFragment : PreferenceFragmentCompat() { EBegFragment().showAllowingStateLoss(parentFragmentManager, "EBegFragment") true } + findPreference("misc.licenses")!!.setOnPreferenceClickListener { + startActivity(Intent(context, OssLicensesMenuActivity::class.java)) + true + } } override fun onDisplayPreferenceDialog(preference: Preference) { diff --git a/mobile/src/main/res/drawable/ic_action_code.xml b/mobile/src/main/res/drawable/ic_action_code.xml new file mode 100644 index 00000000..0dd58ee1 --- /dev/null +++ b/mobile/src/main/res/drawable/ic_action_code.xml @@ -0,0 +1,10 @@ + + + diff --git a/mobile/src/main/res/xml/pref_settings.xml b/mobile/src/main/res/xml/pref_settings.xml index d822138a..25635777 100644 --- a/mobile/src/main/res/xml/pref_settings.xml +++ b/mobile/src/main/res/xml/pref_settings.xml @@ -88,5 +88,10 @@ app:icon="@drawable/ic_action_card_giftcard" app:title="@string/settings_misc_donate" app:summary="@string/settings_misc_donate_summary"/> +