Commit a21d099a authored by Max Lv's avatar Max Lv

Fix #746

parent ae1e396a
......@@ -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)
......
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