Commit ea7ede03 authored by Max Lv's avatar Max Lv

Fix #1497

parent 956443ef
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
package com.github.shadowsocks package com.github.shadowsocks
import android.app.Activity
import android.app.KeyguardManager import android.app.KeyguardManager
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.Context import android.content.Context
...@@ -28,14 +29,13 @@ import android.content.IntentFilter ...@@ -28,14 +29,13 @@ import android.content.IntentFilter
import android.net.VpnService import android.net.VpnService
import android.os.Bundle import android.os.Bundle
import android.os.PersistableBundle import android.os.PersistableBundle
import android.support.v7.app.AppCompatActivity
import android.util.Log import android.util.Log
import com.github.shadowsocks.App.Companion.app import com.github.shadowsocks.App.Companion.app
import com.github.shadowsocks.aidl.IShadowsocksService import com.github.shadowsocks.aidl.IShadowsocksService
import com.github.shadowsocks.bg.BaseService import com.github.shadowsocks.bg.BaseService
import com.github.shadowsocks.utils.broadcastReceiver import com.github.shadowsocks.utils.broadcastReceiver
class VpnRequestActivity : AppCompatActivity(), ShadowsocksConnection.Interface { class VpnRequestActivity : Activity(), ShadowsocksConnection.Interface {
companion object { companion object {
private const val TAG = "VpnRequestActivity" private const val TAG = "VpnRequestActivity"
private const val REQUEST_CONNECT = 1 private const val REQUEST_CONNECT = 1
...@@ -43,8 +43,8 @@ class VpnRequestActivity : AppCompatActivity(), ShadowsocksConnection.Interface ...@@ -43,8 +43,8 @@ class VpnRequestActivity : AppCompatActivity(), ShadowsocksConnection.Interface
private var receiver: BroadcastReceiver? = null private var receiver: BroadcastReceiver? = null
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState, persistentState) super.onCreate(savedInstanceState)
if (!BaseService.usingVpnMode) { if (!BaseService.usingVpnMode) {
finish() finish()
return return
......
...@@ -27,7 +27,7 @@ import com.github.shadowsocks.R ...@@ -27,7 +27,7 @@ import com.github.shadowsocks.R
import com.github.shadowsocks.database.ProfileManager import com.github.shadowsocks.database.ProfileManager
import com.twofortyfouram.locale.api.Intent as ApiIntent import com.twofortyfouram.locale.api.Intent as ApiIntent
class Settings(bundle: Bundle) { class Settings(bundle: Bundle?) {
companion object { companion object {
private val KEY_SWITCH_ON = "switch_on" private val KEY_SWITCH_ON = "switch_on"
private val KEY_PROFILE_ID = "profile_id" private val KEY_PROFILE_ID = "profile_id"
...@@ -35,8 +35,8 @@ class Settings(bundle: Bundle) { ...@@ -35,8 +35,8 @@ class Settings(bundle: Bundle) {
fun fromIntent(intent: Intent) = Settings(intent.getBundleExtra(ApiIntent.EXTRA_BUNDLE)) fun fromIntent(intent: Intent) = Settings(intent.getBundleExtra(ApiIntent.EXTRA_BUNDLE))
} }
var switchOn: Boolean = bundle.getBoolean(KEY_SWITCH_ON, true) var switchOn: Boolean = bundle?.getBoolean(KEY_SWITCH_ON, true) ?: false
var profileId: Int = bundle.getInt(KEY_PROFILE_ID, -1) var profileId: Int = bundle?.getInt(KEY_PROFILE_ID, -1) ?: -1
fun toIntent(context: Context): Intent { fun toIntent(context: Context): Intent {
val bundle = Bundle() val bundle = Bundle()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment