diff --git a/V2rayNG/app/build.gradle b/V2rayNG/app/build.gradle index 1352b28a..47b65128 100644 --- a/V2rayNG/app/build.gradle +++ b/V2rayNG/app/build.gradle @@ -81,7 +81,6 @@ dependencies { implementation 'com.android.support.constraint:constraint-layout:2.0.1' // DSL - implementation "org.jetbrains.anko:anko-sdk15:$ankoVersion" implementation 'com.google.code.gson:gson:2.8.6' implementation 'io.reactivex:rxjava:1.3.4' implementation 'io.reactivex:rxandroid:1.2.1' diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AngApplication.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AngApplication.kt index 73f816d5..649e0594 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AngApplication.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/AngApplication.kt @@ -1,10 +1,9 @@ package com.v2ray.ang -//import com.squareup.leakcanary.LeakCanary import android.support.multidex.MultiDexApplication +import android.support.v7.preference.PreferenceManager import com.v2ray.ang.util.AngConfigManager import me.dozen.dpreference.DPreference -import org.jetbrains.anko.defaultSharedPreferences class AngApplication : MultiDexApplication() { companion object { @@ -22,6 +21,7 @@ class AngApplication : MultiDexApplication() { // LeakCanary.install(this) + val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this) firstRun = defaultSharedPreferences.getInt(PREF_LAST_VERSION, 0) != BuildConfig.VERSION_CODE if (firstRun) defaultSharedPreferences.edit().putInt(PREF_LAST_VERSION, BuildConfig.VERSION_CODE).apply() diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt index bd9d7492..fbce435f 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/MainRecyclerAdapter.kt @@ -5,6 +5,7 @@ import android.graphics.Color import android.support.v7.app.AlertDialog import android.support.v7.widget.RecyclerView import android.text.TextUtils +import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.v2ray.ang.AppConfig @@ -19,7 +20,6 @@ import com.v2ray.ang.util.Utils import com.v2ray.ang.util.V2rayConfigUtil import kotlinx.android.synthetic.main.item_qrcode.view.* import kotlinx.android.synthetic.main.item_recycler_main.view.* -import org.jetbrains.anko.* import rx.Observable import rx.android.schedulers.AndroidSchedulers import java.util.concurrent.TimeUnit @@ -180,10 +180,10 @@ class MainRecyclerAdapter(val activity: MainActivity) : RecyclerView.Adapter - return MainViewHolder(parent.context.layoutInflater + return MainViewHolder(LayoutInflater.from(parent.context) .inflate(R.layout.item_recycler_main, parent, false)) else -> - return FooterViewHolder(parent.context.layoutInflater + return FooterViewHolder(LayoutInflater.from(parent.context) .inflate(R.layout.item_recycler_footer, parent, false)) } } diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/PerAppProxyAdapter.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/PerAppProxyAdapter.kt index 2b7f9ce4..cc2d6088 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/PerAppProxyAdapter.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/PerAppProxyAdapter.kt @@ -2,12 +2,12 @@ package com.v2ray.ang.ui import android.graphics.Color import android.support.v7.widget.RecyclerView +import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.v2ray.ang.R import com.v2ray.ang.dto.AppInfo import kotlinx.android.synthetic.main.item_recycler_bypass_list.view.* -import org.jetbrains.anko.layoutInflater import java.util.* class PerAppProxyAdapter(val activity: BaseActivity, val apps: List, blacklist: MutableSet?) : @@ -43,7 +43,7 @@ class PerAppProxyAdapter(val activity: BaseActivity, val apps: List, bl // VIEW_TYPE_ITEM -> AppViewHolder(ctx.layoutInflater // .inflate(R.layout.item_recycler_bypass_list, parent, false)) - else -> AppViewHolder(ctx.layoutInflater + else -> AppViewHolder(LayoutInflater.from(ctx) .inflate(R.layout.item_recycler_bypass_list, parent, false)) } diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/SettingsActivity.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/SettingsActivity.kt index 936495eb..0843e0a4 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/SettingsActivity.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/SettingsActivity.kt @@ -8,7 +8,6 @@ import com.v2ray.ang.R import com.v2ray.ang.AppConfig import com.v2ray.ang.extension.toast import com.v2ray.ang.util.Utils -import org.jetbrains.anko.defaultSharedPreferences class SettingsActivity : BaseActivity() { companion object { @@ -206,9 +205,10 @@ class SettingsActivity : BaseActivity() { override fun onStart() { super.onStart() - updatePerAppProxy(activity?.defaultSharedPreferences?.getString(AppConfig.PREF_MODE, "VPN")) - remoteDns.summary = activity?.defaultSharedPreferences?.getString(PREF_REMOTE_DNS, "") - domesticDns.summary = activity?.defaultSharedPreferences?.getString(PREF_DOMESTIC_DNS, "") + val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(activity) + updatePerAppProxy(defaultSharedPreferences.getString(AppConfig.PREF_MODE, "VPN")) + remoteDns.summary = defaultSharedPreferences.getString(PREF_REMOTE_DNS, "") + domesticDns.summary = defaultSharedPreferences.getString(PREF_DOMESTIC_DNS, "") if (remoteDns.summary == "") { remoteDns.summary = AppConfig.DNS_AGENT @@ -223,10 +223,10 @@ class SettingsActivity : BaseActivity() { } private fun updatePerAppProxy(mode: String?) { - val preference = activity?.defaultSharedPreferences ?: return if (mode == "VPN") { perAppProxy.isEnabled = true - perAppProxy.isChecked = preference.getBoolean(PREF_PER_APP_PROXY, false) + perAppProxy.isChecked = PreferenceManager.getDefaultSharedPreferences(activity) + .getBoolean(PREF_PER_APP_PROXY, false) } else { perAppProxy.isEnabled = false perAppProxy.isChecked = false diff --git a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/SubSettingRecyclerAdapter.kt b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/SubSettingRecyclerAdapter.kt index 307f3a46..50c89d5b 100644 --- a/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/SubSettingRecyclerAdapter.kt +++ b/V2rayNG/app/src/main/kotlin/com/v2ray/ang/ui/SubSettingRecyclerAdapter.kt @@ -3,13 +3,13 @@ package com.v2ray.ang.ui import android.content.Intent import android.graphics.Color import android.support.v7.widget.RecyclerView +import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.v2ray.ang.R import com.v2ray.ang.dto.AngConfig import com.v2ray.ang.util.AngConfigManager import kotlinx.android.synthetic.main.item_recycler_sub_setting.view.* -import org.jetbrains.anko.* class SubSettingRecyclerAdapter(val activity: SubSettingActivity) : RecyclerView.Adapter() { @@ -41,7 +41,7 @@ class SubSettingRecyclerAdapter(val activity: SubSettingActivity) : RecyclerView } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder { - return MainViewHolder(parent.context.layoutInflater + return MainViewHolder(LayoutInflater.from(parent.context) .inflate(R.layout.item_recycler_sub_setting, parent, false)) } diff --git a/V2rayNG/app/src/main/res/raw/licenses.xml b/V2rayNG/app/src/main/res/raw/licenses.xml index e7949142..06723342 100644 --- a/V2rayNG/app/src/main/res/raw/licenses.xml +++ b/V2rayNG/app/src/main/res/raw/licenses.xml @@ -17,11 +17,6 @@ Copyright(C) 2008-2011 The Android Open Source Project Apache Software License 2.0 - - anko - https://github.com/Kotlin/anko - Apache Software License 2.0 - Google Gson https://github.com/google/gson diff --git a/V2rayNG/gradle.properties b/V2rayNG/gradle.properties index ee67f2c2..cd501cb8 100644 --- a/V2rayNG/gradle.properties +++ b/V2rayNG/gradle.properties @@ -13,7 +13,6 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true #Fri Jun 02 14:08:42 CST 2017 -ankoVersion=0.10.8 kotlinVersion=1.4.0 supportLibVersion=28.0.0 buildToolsVer=29.0.3