Fix #1497
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
package com.github.shadowsocks
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.KeyguardManager
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
@@ -28,14 +29,13 @@ import android.content.IntentFilter
|
||||
import android.net.VpnService
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.util.Log
|
||||
import com.github.shadowsocks.App.Companion.app
|
||||
import com.github.shadowsocks.aidl.IShadowsocksService
|
||||
import com.github.shadowsocks.bg.BaseService
|
||||
import com.github.shadowsocks.utils.broadcastReceiver
|
||||
|
||||
class VpnRequestActivity : AppCompatActivity(), ShadowsocksConnection.Interface {
|
||||
class VpnRequestActivity : Activity(), ShadowsocksConnection.Interface {
|
||||
companion object {
|
||||
private const val TAG = "VpnRequestActivity"
|
||||
private const val REQUEST_CONNECT = 1
|
||||
@@ -43,8 +43,8 @@ class VpnRequestActivity : AppCompatActivity(), ShadowsocksConnection.Interface
|
||||
|
||||
private var receiver: BroadcastReceiver? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
|
||||
super.onCreate(savedInstanceState, persistentState)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
if (!BaseService.usingVpnMode) {
|
||||
finish()
|
||||
return
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.github.shadowsocks.R
|
||||
import com.github.shadowsocks.database.ProfileManager
|
||||
import com.twofortyfouram.locale.api.Intent as ApiIntent
|
||||
|
||||
class Settings(bundle: Bundle) {
|
||||
class Settings(bundle: Bundle?) {
|
||||
companion object {
|
||||
private val KEY_SWITCH_ON = "switch_on"
|
||||
private val KEY_PROFILE_ID = "profile_id"
|
||||
@@ -35,8 +35,8 @@ class Settings(bundle: Bundle) {
|
||||
fun fromIntent(intent: Intent) = Settings(intent.getBundleExtra(ApiIntent.EXTRA_BUNDLE))
|
||||
}
|
||||
|
||||
var switchOn: Boolean = bundle.getBoolean(KEY_SWITCH_ON, true)
|
||||
var profileId: Int = bundle.getInt(KEY_PROFILE_ID, -1)
|
||||
var switchOn: Boolean = bundle?.getBoolean(KEY_SWITCH_ON, true) ?: false
|
||||
var profileId: Int = bundle?.getInt(KEY_PROFILE_ID, -1) ?: -1
|
||||
|
||||
fun toIntent(context: Context): Intent {
|
||||
val bundle = Bundle()
|
||||
|
||||
Reference in New Issue
Block a user