Merge branch 'master' into r

This commit is contained in:
Mygod
2020-05-29 04:34:20 +08:00
3 changed files with 6 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ buildscript {
} }
dependencies { dependencies {
classpath("com.android.tools.build:gradle:4.0.0-rc01") classpath("com.android.tools.build:gradle:4.0.0")
classpath("com.github.ben-manes:gradle-versions-plugin:0.28.0") classpath("com.github.ben-manes:gradle-versions-plugin:0.28.0")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.1.1") classpath("com.google.firebase:firebase-crashlytics-gradle:2.1.1")
classpath("com.google.android.gms:oss-licenses-plugin:0.10.2") classpath("com.google.android.gms:oss-licenses-plugin:0.10.2")

View File

@@ -83,7 +83,7 @@ dependencies {
implementation("com.android.billingclient:billing-ktx:2.2.1") implementation("com.android.billingclient:billing-ktx:2.2.1")
implementation("com.github.topjohnwu.libsu:core:2.5.1") 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.gms:play-services-oss-licenses:17.0.0")
implementation("com.google.android.material:material:1.1.0") implementation("com.google.android.material:material:1.2.0-beta01")
implementation("com.google.firebase:firebase-analytics-ktx:17.4.2") implementation("com.google.firebase:firebase-analytics-ktx:17.4.2")
implementation("com.google.firebase:firebase-crashlytics:17.0.0") implementation("com.google.firebase:firebase-crashlytics:17.0.0")
implementation("com.google.zxing:core:3.4.0") implementation("com.google.zxing:core:3.4.0")

View File

@@ -2,7 +2,6 @@ package be.mygod.vpnhotspot.net
import android.content.res.Resources import android.content.res.Resources
import androidx.core.os.BuildCompat import androidx.core.os.BuildCompat
import be.mygod.vpnhotspot.App.Companion.app
import be.mygod.vpnhotspot.R import be.mygod.vpnhotspot.R
import java.util.regex.Pattern import java.util.regex.Pattern
@@ -38,10 +37,9 @@ enum class TetherType {
* Source: https://android.googlesource.com/platform/frameworks/base/+/32e772f/packages/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java#93 * Source: https://android.googlesource.com/platform/frameworks/base/+/32e772f/packages/Tethering/src/com/android/networkstack/tethering/TetheringConfiguration.java#93
*/ */
init { init {
val appRes = app.resources val system = Resources.getSystem()
val sysRes = Resources.getSystem() fun getRegexs(name: String) = system
fun getRegexs(name: String) = appRes.getStringArray(sysRes .getStringArray(system.getIdentifier(name, "array", "android"))
.getIdentifier(name, "array", "android"))
.filterNotNull() .filterNotNull()
.map { it.toPattern() } .map { it.toPattern() }
usbRegexs = getRegexs("config_tether_usb_regexs") usbRegexs = getRegexs("config_tether_usb_regexs")
@@ -51,7 +49,7 @@ enum class TetherType {
bluetoothRegexs = getRegexs("config_tether_bluetooth_regexs") bluetoothRegexs = getRegexs("config_tether_bluetooth_regexs")
ncmRegexs = if (BuildCompat.isAtLeastR()) getRegexs("config_tether_ncm_regexs") else emptyList() ncmRegexs = if (BuildCompat.isAtLeastR()) getRegexs("config_tether_ncm_regexs") else emptyList()
ethernetRegex = if (BuildCompat.isAtLeastR()) { ethernetRegex = if (BuildCompat.isAtLeastR()) {
appRes.getString(sysRes.getIdentifier("config_ethernet_iface_regex", "string", "android")).run { system.getString(system.getIdentifier("config_ethernet_iface_regex", "string", "android")).run {
if (isEmpty()) null else toPattern() if (isEmpty()) null else toPattern()
} }
} else null } else null