From 090bf141b0c037a94b0f1bb4d9206ebeb2962524 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sun, 23 Jun 2019 13:44:36 +0800 Subject: [PATCH] Update to API 29 --- app/build.gradle | 6 +++--- app/src/main/go/v2ray-plugin | 2 +- .../com/github/shadowsocks/plugin/v2ray/BinaryProvider.kt | 2 +- .../plugin/v2ray/CertificatePreferenceDialogFragment.kt | 8 +++----- .../com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt | 6 ++---- build.gradle | 2 +- 6 files changed, 11 insertions(+), 15 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 24cd046..d2f6738 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/go/v2ray-plugin b/app/src/main/go/v2ray-plugin index e5ada30..c7017f4 160000 --- a/app/src/main/go/v2ray-plugin +++ b/app/src/main/go/v2ray-plugin @@ -1 +1 @@ -Subproject commit e5ada302d39b0aef8e167701c94596e41e805ec1 +Subproject commit c7017f45bb1e12cf1e4b739bcb8f42f3eb8b22cd diff --git a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/BinaryProvider.kt b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/BinaryProvider.kt index 2505bde..1e886d9 100644 --- a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/BinaryProvider.kt +++ b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/BinaryProvider.kt @@ -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() } diff --git a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/CertificatePreferenceDialogFragment.kt b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/CertificatePreferenceDialogFragment.kt index a1a18b1..bdf7657 100644 --- a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/CertificatePreferenceDialogFragment.kt +++ b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/CertificatePreferenceDialogFragment.kt @@ -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(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() } } } diff --git a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt index a921081..3bf711d 100644 --- a/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt +++ b/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt @@ -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(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) diff --git a/build.gradle b/build.gradle index c76c0ad..46b47ca 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'com.github.ben-manes.versions' buildscript { ext { - kotlinVersion = '1.3.31' + kotlinVersion = '1.3.40' minSdkVersion = 21 } repositories {