diff --git a/src/main/res/values-v21/styles_shadow.xml b/src/main/res/values-v21/styles_shadow.xml index e57859aa..705b7e23 100644 --- a/src/main/res/values-v21/styles_shadow.xml +++ b/src/main/res/values-v21/styles_shadow.xml @@ -79,4 +79,18 @@ @style/m_textAppearanceSmallPopupMenu + + diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml index 3aea3ebe..a732e9de 100644 --- a/src/main/res/values/styles.xml +++ b/src/main/res/values/styles.xml @@ -19,7 +19,9 @@ - - \ No newline at end of file + diff --git a/src/main/scala/com/github/shadowsocks/Shadowsocks.scala b/src/main/scala/com/github/shadowsocks/Shadowsocks.scala index 42ff638b..d44497f5 100644 --- a/src/main/scala/com/github/shadowsocks/Shadowsocks.scala +++ b/src/main/scala/com/github/shadowsocks/Shadowsocks.scala @@ -638,6 +638,25 @@ class Shadowsocks builder.create().show() } + def reloadProfile() { + drawer.closeMenu(true) + + val h = showProgress(getString(R.string.loading)) + + handler.postDelayed(new Runnable { + def run() { + currentProfile = { + profileManager.getProfile(settings.getInt(Key.profileId, -1)) getOrElse currentProfile + } + menuAdapter.updateList(getMenuList, currentProfile.id) + + updatePreferenceScreen() + + h.sendEmptyMessage(0) + } + }, 600) + } + def addProfile(profile: Profile) { drawer.closeMenu(true) @@ -826,6 +845,10 @@ class Shadowsocks switchButton.setOnCheckedChangeListener(Shadowsocks.this) } ConfigUtils.refresh(this) + + // Check if profile list changed + if (currentProfile.id != settings.getInt(Key.profileId, -1)) + reloadProfile() } private def setPreferenceEnabled(enabled: Boolean) {