Update to API 29

This commit is contained in:
Mygod 2019-06-23 13:44:36 +08:00
parent 3daf980174
commit 090bf141b0
6 changed files with 11 additions and 15 deletions

View file

@ -18,11 +18,11 @@ def getCurrentFlavor() {
}
android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "com.github.shadowsocks.plugin.v2ray"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion 28
targetSdkVersion 29
versionCode 1020000
versionName "1.2.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@ -64,7 +64,7 @@ tasks.whenTaskAdded { task ->
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.preference:preference:1.1.0-beta01"
implementation 'com.github.shadowsocks:plugin:1.2.0'
implementation 'com.github.shadowsocks:plugin:1.3.0'
implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
testImplementation 'junit:junit:4.12'

@ -1 +1 @@
Subproject commit e5ada302d39b0aef8e167701c94596e41e805ec1
Subproject commit c7017f45bb1e12cf1e4b739bcb8f42f3eb8b22cd

View file

@ -32,7 +32,7 @@ class BinaryProvider : NativePluginProvider() {
provider.addPath("v2ray", 0b111101101)
}
override fun getExecutable() = context!!.applicationInfo.nativeLibraryDir + "/libv2ray.so"
override fun openFile(uri: Uri?): ParcelFileDescriptor = when (uri?.path) {
override fun openFile(uri: Uri): ParcelFileDescriptor = when (uri.path) {
"/v2ray" -> ParcelFileDescriptor.open(File(getExecutable()), ParcelFileDescriptor.MODE_READ_ONLY)
else -> throw FileNotFoundException()
}

View file

@ -22,7 +22,6 @@ package com.github.shadowsocks.plugin.v2ray
import android.content.ActivityNotFoundException
import android.content.Intent
import android.view.View
import androidx.appcompat.app.AlertDialog
import androidx.core.os.bundleOf
import androidx.preference.EditTextPreferenceDialogFragmentCompat
@ -35,7 +34,7 @@ class CertificatePreferenceDialogFragment : EditTextPreferenceDialogFragmentComp
override fun onPrepareDialogBuilder(builder: AlertDialog.Builder) {
super.onPrepareDialogBuilder(builder)
builder.setNeutralButton("Browse…") { _, _ ->
builder.setNeutralButton(R.string.browse) { _, _ ->
val activity = requireActivity()
try {
targetFragment!!.startActivityForResult(Intent(Intent.ACTION_GET_CONTENT).apply {
@ -44,9 +43,8 @@ class CertificatePreferenceDialogFragment : EditTextPreferenceDialogFragmentComp
}, ConfigFragment.REQUEST_BROWSE_CERTIFICATE)
return@setNeutralButton
} catch (_: ActivityNotFoundException) { } catch (_: SecurityException) { }
Snackbar.make(activity.findViewById<View>(R.id.content),
"Please install a file manager like MiXplorer",
Snackbar.LENGTH_SHORT).show()
Snackbar.make(activity.findViewById(R.id.content), R.string.file_manager_missing, Snackbar.LENGTH_SHORT)
.show()
}
}
}

View file

@ -25,14 +25,12 @@ import android.content.Intent
import android.os.Bundle
import android.text.InputFilter
import android.text.InputType
import android.view.View
import androidx.preference.EditTextPreference
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import com.github.shadowsocks.plugin.PluginOptions
import com.google.android.material.snackbar.Snackbar
import java.lang.RuntimeException
class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener {
companion object {
@ -116,8 +114,8 @@ class ConfigFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChange
certRaw.text = activity.contentResolver.openInputStream(data!!.data!!)!!
.bufferedReader().readText()
} catch (e: RuntimeException) {
Snackbar.make(activity.findViewById<View>(R.id.content), e.localizedMessage, Snackbar.LENGTH_LONG)
.show()
Snackbar.make(activity.findViewById(R.id.content), e.localizedMessage ?: e.javaClass.name,
Snackbar.LENGTH_LONG).show()
}
}
else -> super.onActivityResult(requestCode, resultCode, data)

View file

@ -4,7 +4,7 @@ apply plugin: 'com.github.ben-manes.versions'
buildscript {
ext {
kotlinVersion = '1.3.31'
kotlinVersion = '1.3.40'
minSdkVersion = 21
}
repositories {