Add OSS licenses

This commit is contained in:
Mygod
2020-01-26 12:09:12 +08:00
parent 3cee5a4782
commit 3372d8bcbd
5 changed files with 23 additions and 0 deletions

View File

@@ -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"
}

View File

@@ -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'

View File

@@ -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<Preference>("misc.licenses")!!.setOnPreferenceClickListener {
startActivity(Intent(context, OssLicensesMenuActivity::class.java))
true
}
}
override fun onDisplayPreferenceDialog(preference: Preference) {

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M9.4,16.6L4.8,12l4.6,-4.6L8,6l-6,6 6,6 1.4,-1.4zM14.6,16.6l4.6,-4.6 -4.6,-4.6L16,6l6,6 -6,6 -1.4,-1.4z"/>
</vector>

View File

@@ -88,5 +88,10 @@
app:icon="@drawable/ic_action_card_giftcard"
app:title="@string/settings_misc_donate"
app:summary="@string/settings_misc_donate_summary"/>
<Preference
app:key="misc.licenses"
app:icon="@drawable/ic_action_code"
app:title="@string/oss_license_title"
app:summary="@string/preferences_license_summary"/>
</PreferenceCategory>
</PreferenceScreen>