Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3facb73cf1 | ||
|
|
8f10e95329 | ||
|
|
b620a2e666 | ||
|
|
9cf8c4c483 | ||
|
|
bfbbb90ac3 | ||
|
|
dc840fd0e9 | ||
|
|
79d1ccba23 | ||
|
|
19df6caa93 |
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
resolvers += Resolver.url("scalasbt releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
|
resolvers += Resolver.url("scalasbt releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
|
||||||
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.5.12")
|
addSbtPlugin("com.hanhuy.sbt" % "android-sdk-plugin" % "1.5.13")
|
||||||
|
|
||||||
resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
|
resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||||
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.7.0-SNAPSHOT")
|
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.7.0-SNAPSHOT")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.github.shadowsocks"
|
package="com.github.shadowsocks"
|
||||||
android:versionCode="127"
|
android:versionCode="128"
|
||||||
android:versionName="2.9.5">
|
android:versionName="2.9.6">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<string name="vpn_error">后台服务启动失败:%s</string>
|
<string name="vpn_error">后台服务启动失败:%s</string>
|
||||||
<string name="reboot_required">VPN 服务启动失败。你可能需要重启设备。</string>
|
<string name="reboot_required">VPN 服务启动失败。你可能需要重启设备。</string>
|
||||||
<string name="close">关闭</string>
|
<string name="close">关闭</string>
|
||||||
<string name="proxy_empty">代理服务器地址不能为空</string>
|
<string name="proxy_empty">代理服务器地址及密码不能为空</string>
|
||||||
<string name="connect">连接</string>
|
<string name="connect">连接</string>
|
||||||
<string name="initializing">正在初始化……</string>
|
<string name="initializing">正在初始化……</string>
|
||||||
<string name="recovering">重置中……</string>
|
<string name="recovering">重置中……</string>
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
<!-- alert category -->
|
<!-- alert category -->
|
||||||
<string name="close">Close</string>
|
<string name="close">Close</string>
|
||||||
<string name="proxy_empty">Proxy should not be empty</string>
|
<string name="proxy_empty">Proxy/Password should not be empty</string>
|
||||||
<string name="connect">Connect</string>
|
<string name="connect">Connect</string>
|
||||||
<string name="initializing">Initializing…</string>
|
<string name="initializing">Initializing…</string>
|
||||||
<string name="recovering">Resetting…</string>
|
<string name="recovering">Resetting…</string>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.{ComponentName, Context, Intent, ServiceConnection}
|
|||||||
import android.os.{RemoteException, IBinder}
|
import android.os.{RemoteException, IBinder}
|
||||||
import com.github.shadowsocks.aidl.{IShadowsocksServiceCallback, IShadowsocksService}
|
import com.github.shadowsocks.aidl.{IShadowsocksServiceCallback, IShadowsocksService}
|
||||||
import com.github.shadowsocks.utils.Action
|
import com.github.shadowsocks.utils.Action
|
||||||
|
import com.github.shadowsocks.utils.Utils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mygod
|
* @author Mygod
|
||||||
@@ -60,6 +61,7 @@ trait ServiceBoundContext extends Context {
|
|||||||
|
|
||||||
connection = new ShadowsocksServiceConnection()
|
connection = new ShadowsocksServiceConnection()
|
||||||
bindService(intent, connection, Context.BIND_AUTO_CREATE)
|
bindService(intent, connection, Context.BIND_AUTO_CREATE)
|
||||||
|
startService(intent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,14 +126,14 @@ class Shadowsocks
|
|||||||
if (state == State.CONNECTING) {
|
if (state == State.CONNECTING) {
|
||||||
fabProgressCircle.beginFinalAnimation()
|
fabProgressCircle.beginFinalAnimation()
|
||||||
} else {
|
} else {
|
||||||
handler.postDelayed(() => fabProgressCircle.hide(), 1000)
|
fabProgressCircle.postDelayed(hideCircle, 1000)
|
||||||
}
|
}
|
||||||
fab.setEnabled(true)
|
fab.setEnabled(true)
|
||||||
changeSwitch(checked = true)
|
changeSwitch(checked = true)
|
||||||
preferences.setEnabled(false)
|
preferences.setEnabled(false)
|
||||||
case State.STOPPED =>
|
case State.STOPPED =>
|
||||||
fab.setBackgroundTintList(greyTint)
|
fab.setBackgroundTintList(greyTint)
|
||||||
handler.postDelayed(() => fabProgressCircle.hide(), 1000)
|
fabProgressCircle.postDelayed(hideCircle, 1000)
|
||||||
fab.setEnabled(true)
|
fab.setEnabled(true)
|
||||||
changeSwitch(checked = false)
|
changeSwitch(checked = false)
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
@@ -176,7 +176,7 @@ class Shadowsocks
|
|||||||
override def onServiceConnected() {
|
override def onServiceConnected() {
|
||||||
// Update the UI
|
// Update the UI
|
||||||
if (fab != null) fab.setEnabled(true)
|
if (fab != null) fab.setEnabled(true)
|
||||||
stateUpdate()
|
updateState()
|
||||||
|
|
||||||
if (!ShadowsocksApplication.settings.getBoolean(ShadowsocksApplication.getVersionName, false)) {
|
if (!ShadowsocksApplication.settings.getBoolean(ShadowsocksApplication.getVersionName, false)) {
|
||||||
ShadowsocksApplication.settings.edit.putBoolean(ShadowsocksApplication.getVersionName, true).apply()
|
ShadowsocksApplication.settings.edit.putBoolean(ShadowsocksApplication.getVersionName, true).apply()
|
||||||
@@ -404,7 +404,15 @@ class Shadowsocks
|
|||||||
ShadowsocksApplication.profileManager.save
|
ShadowsocksApplication.profileManager.save
|
||||||
}
|
}
|
||||||
|
|
||||||
private def stateUpdate() {
|
private def hideCircle() {
|
||||||
|
try {
|
||||||
|
fabProgressCircle.hide()
|
||||||
|
} catch {
|
||||||
|
case _: java.lang.NullPointerException => // Ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private def updateState() {
|
||||||
if (bgService != null) {
|
if (bgService != null) {
|
||||||
bgService.getState match {
|
bgService.getState match {
|
||||||
case State.CONNECTING =>
|
case State.CONNECTING =>
|
||||||
@@ -418,7 +426,7 @@ class Shadowsocks
|
|||||||
serviceStarted = true
|
serviceStarted = true
|
||||||
fab.setImageResource(R.drawable.ic_cloud)
|
fab.setImageResource(R.drawable.ic_cloud)
|
||||||
preferences.setEnabled(false)
|
preferences.setEnabled(false)
|
||||||
fabProgressCircle.postDelayed(fabProgressCircle.hide, 100)
|
fabProgressCircle.postDelayed(hideCircle, 100)
|
||||||
case State.STOPPING =>
|
case State.STOPPING =>
|
||||||
fab.setBackgroundTintList(greyTint)
|
fab.setBackgroundTintList(greyTint)
|
||||||
serviceStarted = false
|
serviceStarted = false
|
||||||
@@ -430,7 +438,7 @@ class Shadowsocks
|
|||||||
serviceStarted = false
|
serviceStarted = false
|
||||||
fab.setImageResource(R.drawable.ic_cloud_off)
|
fab.setImageResource(R.drawable.ic_cloud_off)
|
||||||
preferences.setEnabled(true)
|
preferences.setEnabled(true)
|
||||||
fabProgressCircle.postDelayed(fabProgressCircle.hide, 100)
|
fabProgressCircle.postDelayed(hideCircle, 100)
|
||||||
}
|
}
|
||||||
state = bgService.getState
|
state = bgService.getState
|
||||||
}
|
}
|
||||||
@@ -438,13 +446,13 @@ class Shadowsocks
|
|||||||
|
|
||||||
protected override def onResume() {
|
protected override def onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
stateUpdate()
|
|
||||||
ConfigUtils.refresh(this)
|
ConfigUtils.refresh(this)
|
||||||
|
|
||||||
// Check if current profile changed
|
// Check if current profile changed
|
||||||
if (ShadowsocksApplication.profileId != currentProfile.id) reloadProfile()
|
if (ShadowsocksApplication.profileId != currentProfile.id) reloadProfile()
|
||||||
|
|
||||||
updateTraffic()
|
updateTraffic()
|
||||||
|
updateState()
|
||||||
}
|
}
|
||||||
|
|
||||||
private def updatePreferenceScreen() {
|
private def updatePreferenceScreen() {
|
||||||
|
|||||||
@@ -89,5 +89,6 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
|
|||||||
}
|
}
|
||||||
unregisterCallback
|
unregisterCallback
|
||||||
service.stopForeground(true)
|
service.stopForeground(true)
|
||||||
|
nm.cancel(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,11 +43,10 @@ import android.app.{Activity, KeyguardManager}
|
|||||||
import android.content.{Intent, IntentFilter, Context, BroadcastReceiver}
|
import android.content.{Intent, IntentFilter, Context, BroadcastReceiver}
|
||||||
import android.net.VpnService
|
import android.net.VpnService
|
||||||
import android.os.{Bundle, Handler}
|
import android.os.{Bundle, Handler}
|
||||||
import android.support.v7.app.AppCompatActivity
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.github.shadowsocks.utils.ConfigUtils
|
import com.github.shadowsocks.utils.ConfigUtils
|
||||||
|
|
||||||
class ShadowsocksRunnerActivity extends AppCompatActivity with ServiceBoundContext {
|
class ShadowsocksRunnerActivity extends Activity with ServiceBoundContext {
|
||||||
val handler = new Handler()
|
val handler = new Handler()
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
|
|||||||
@@ -144,7 +144,11 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
|
|||||||
web.loadUrl("file:///android_asset/pages/about.html")
|
web.loadUrl("file:///android_asset/pages/about.html")
|
||||||
web.setWebViewClient(new WebViewClient() {
|
web.setWebViewClient(new WebViewClient() {
|
||||||
override def shouldOverrideUrlLoading(view: WebView, url: String): Boolean = {
|
override def shouldOverrideUrlLoading(view: WebView, url: String): Boolean = {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
try {
|
||||||
|
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)))
|
||||||
|
} catch {
|
||||||
|
case _: android.content.ActivityNotFoundException => // Ignore
|
||||||
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ import android.util.{DisplayMetrics, Base64, Log}
|
|||||||
import android.view.View.MeasureSpec
|
import android.view.View.MeasureSpec
|
||||||
import android.view.{Gravity, View, Window}
|
import android.view.{Gravity, View, Window}
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.github.shadowsocks.{ShadowsocksRunnerActivity, ShadowsocksRunnerService, ShadowsocksApplication, BuildConfig}
|
import com.github.shadowsocks.{ShadowsocksRunnerService, ShadowsocksApplication, BuildConfig}
|
||||||
import org.xbill.DNS._
|
import org.xbill.DNS._
|
||||||
|
|
||||||
|
|
||||||
@@ -405,15 +405,8 @@ object Utils {
|
|||||||
val isInstalled: Boolean = ShadowsocksApplication.settings.getBoolean(ShadowsocksApplication.getVersionName, false)
|
val isInstalled: Boolean = ShadowsocksApplication.settings.getBoolean(ShadowsocksApplication.getVersionName, false)
|
||||||
if (!isInstalled) return
|
if (!isInstalled) return
|
||||||
|
|
||||||
if (Utils.isLollipopOrAbove) {
|
val intent = new Intent(context, classOf[ShadowsocksRunnerService])
|
||||||
val intent = new Intent(context, classOf[ShadowsocksRunnerService])
|
context.startService(intent)
|
||||||
context.startService(intent)
|
|
||||||
} else {
|
|
||||||
val intent = new Intent(context, classOf[ShadowsocksRunnerActivity])
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
|
||||||
context.startActivity(intent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def stopSsService(context: Context): Unit = {
|
def stopSsService(context: Context): Unit = {
|
||||||
|
|||||||
Reference in New Issue
Block a user