Commit c208c4bf authored by Max Lv's avatar Max Lv

refine profile initilizing

parent 34af6aee
...@@ -474,22 +474,22 @@ class Shadowsocks ...@@ -474,22 +474,22 @@ class Shadowsocks
addPreferencesFromResource(R.xml.pref_all) addPreferencesFromResource(R.xml.pref_all)
// Initialize the profile
currentProfile = {
profileManager.getProfile(settings.getInt(Key.profileId, -1)) getOrElse currentProfile
}
// Update the profile // Update the profile
if (!status.getBoolean(getVersionName, false)) { if (!status.getBoolean(getVersionName, false)) {
val h = showProgress(getString(R.string.initializing)) val h = showProgress(getString(R.string.initializing))
status.edit.putBoolean(getVersionName, true).apply() status.edit.putBoolean(getVersionName, true).apply()
currentProfile = profileManager.create()
spawn { spawn {
reset() reset()
currentProfile = profileManager.create()
h.sendEmptyMessage(0) h.sendEmptyMessage(0)
} }
} }
// Initialize the profile
currentProfile = {
profileManager.getProfile(settings.getInt(Key.profileId, -1)) getOrElse currentProfile
}
// Initialize drawer // Initialize drawer
menuAdapter.setActiveId(settings.getInt(Key.profileId, -1)) menuAdapter.setActiveId(settings.getInt(Key.profileId, -1))
menuAdapter.setListener(this) menuAdapter.setListener(this)
......
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