UI fixes
* Refine exceptions handling when parsing per-app config string * Remove redundant profiles Preference * Move Network Traffic to title bar * Add ripple to title text * Animate using animateLayoutChanges * Hide connection test in NAT mode * Refine UI. * Change notification action button icon for hidpi device * Fix FAB ripple * Fix usability problem * Fix changes not commited when snackbar being swiped * Show import/export as action * Drop unused drawables * Move TaskerSettings * Fix action icons * Prevent switching to an invalid profile * Fix line wrap when screen width is small
This commit is contained in:
@@ -44,6 +44,7 @@ import java.util.{Timer, TimerTask}
|
||||
import android.app.Service
|
||||
import android.content.{BroadcastReceiver, Context, Intent, IntentFilter}
|
||||
import android.os.{Handler, RemoteCallbackList}
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import com.github.shadowsocks.aidl.{Config, IShadowsocksService, IShadowsocksServiceCallback}
|
||||
@@ -104,9 +105,10 @@ trait BaseService extends Service {
|
||||
}
|
||||
|
||||
override def use(config: Config) = synchronized(state match {
|
||||
case State.STOPPED => if (config != null) startRunner(config)
|
||||
case State.STOPPED => if (config != null && checkConfig(config)) startRunner(config)
|
||||
case State.CONNECTED =>
|
||||
if (config == null) stopRunner(true) else if (config.profileId != BaseService.this.config.profileId) {
|
||||
if (config == null) stopRunner(true)
|
||||
else if (config.profileId != BaseService.this.config.profileId && checkConfig(config)) {
|
||||
stopRunner(false)
|
||||
startRunner(config)
|
||||
}
|
||||
@@ -114,6 +116,12 @@ trait BaseService extends Service {
|
||||
})
|
||||
}
|
||||
|
||||
def checkConfig(config: Config) = if (TextUtils.isEmpty(config.proxy) || TextUtils.isEmpty(config.sitekey)) {
|
||||
changeState(State.STOPPED)
|
||||
stopRunner(true)
|
||||
false
|
||||
} else true
|
||||
|
||||
def startRunner(config: Config) {
|
||||
this.config = config
|
||||
|
||||
|
||||
Reference in New Issue
Block a user