refine VPN mode
This commit is contained in:
@@ -44,7 +44,6 @@
|
||||
<string name="forward_stop">后台服务已停止。</string>
|
||||
<string name="service_failed">请检查你的网络状态后并重试。</string>
|
||||
<string name="stop">停止服务</string>
|
||||
<string name="vpn_status">推荐通过通知栏关闭 VPN 服务</string>
|
||||
<string name="vpn_error">无法启动 VPN 服务:\"%s\"。看来和你的设备存在兼容性问题,请使用 Root 模式。</string>
|
||||
<string name="ok_iknow">确定</string>
|
||||
<string name="port_alert">端口号应大于1024</string>
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
<string name="forward_stop">Shadowsocks stopped.</string>
|
||||
<string name="service_failed">Please check your network status and try again.</string>
|
||||
<string name="stop">Stop the service</string>
|
||||
<string name="vpn_status">Recommend to disable the VPN service through the notification bar.</string>
|
||||
<string name="vpn_error">Unable to start VPN service: "%s". It seems to be a compatibility issue with your device. Please consider using ROOT mode instead.</string>
|
||||
|
||||
<!-- alert category -->
|
||||
|
||||
@@ -919,7 +919,6 @@ class Shadowsocks
|
||||
if (isVpnEnabled) {
|
||||
val style = new Style.Builder().setBackgroundColorValue(Style.holoBlueLight).build()
|
||||
val config = new Configuration.Builder().setDuration(Configuration.DURATION_LONG).build()
|
||||
Crouton.makeText(Shadowsocks.this, R.string.vpn_status, style).setConfiguration(config).show()
|
||||
changeSwitch(checked = false)
|
||||
}
|
||||
true
|
||||
|
||||
@@ -118,13 +118,8 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
|
||||
def startVpn() {
|
||||
|
||||
val openIntent = new Intent(this, classOf[Shadowsocks])
|
||||
openIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||
val configIntent = PendingIntent.getActivity(this, 0, openIntent, 0)
|
||||
|
||||
val builder = new Builder()
|
||||
builder
|
||||
.setConfigureIntent(configIntent)
|
||||
.setSession(config.profileName)
|
||||
.setMtu(VPN_MTU)
|
||||
.addAddress(PRIVATE_VLAN.format("1"), 24)
|
||||
@@ -221,9 +216,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
}
|
||||
|
||||
def notifyAlert(title: String, info: String) {
|
||||
val openIntent = new Intent(this, classOf[Shadowsocks])
|
||||
openIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||
val contentIntent = PendingIntent.getActivity(this, 0, openIntent, 0)
|
||||
val builder = new NotificationCompat.Builder(this)
|
||||
builder
|
||||
.setSmallIcon(R.drawable.ic_stat_shadowsocks)
|
||||
@@ -231,7 +223,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
|
||||
.setTicker(title)
|
||||
.setContentTitle(getString(R.string.app_name))
|
||||
.setContentText(info)
|
||||
.setContentIntent(contentIntent)
|
||||
.setAutoCancel(true)
|
||||
notificationManager.notify(1, builder.build)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user