Fix #746
This commit is contained in:
@@ -117,7 +117,7 @@ trait BaseService extends Service {
|
||||
}
|
||||
|
||||
def checkProfile(profile: Profile) = if (TextUtils.isEmpty(profile.host) || TextUtils.isEmpty(profile.password)) {
|
||||
changeState(State.STOPPED)
|
||||
changeState(State.STOPPED, getString(R.string.proxy_empty))
|
||||
stopRunner(true)
|
||||
false
|
||||
} else true
|
||||
|
||||
@@ -405,7 +405,7 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
|
||||
fab = findViewById(R.id.fab).asInstanceOf[FloatingActionButton]
|
||||
fabProgressCircle = findViewById(R.id.fabProgressCircle).asInstanceOf[FABProgressCircle]
|
||||
fab.setOnClickListener(_ => if (serviceStarted) serviceStop()
|
||||
else if (checkText(Key.host) && checkText(Key.password) && bgService != null) prepareStartService()
|
||||
else if (bgService != null) prepareStartService()
|
||||
else changeSwitch(checked = false))
|
||||
fab.setOnLongClickListener((v: View) => {
|
||||
Utils.positionToast(Toast.makeText(this, if (serviceStarted) R.string.stop else R.string.connect,
|
||||
@@ -568,13 +568,6 @@ class Shadowsocks extends AppCompatActivity with ServiceBoundContext {
|
||||
if (bgService != null) bgService.use(-1)
|
||||
}
|
||||
|
||||
def checkText(key: String): Boolean = {
|
||||
val text = app.settings.getString(key, "")
|
||||
if (text != null && text.length > 0) return true
|
||||
Snackbar.make(findViewById(android.R.id.content), R.string.proxy_empty, Snackbar.LENGTH_LONG).show
|
||||
false
|
||||
}
|
||||
|
||||
/** Called when connect button is clicked. */
|
||||
def serviceLoad() {
|
||||
bgService.use(app.profileId)
|
||||
|
||||
Reference in New Issue
Block a user