Skip to content

Commit

Permalink
fix #295
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed May 8, 2015
1 parent ef2ff23 commit fa083a8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/main/res/values-v21/styles_shadow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,18 @@
<item name="android:textAppearanceSmallPopupMenu" >@style/m_textAppearanceSmallPopupMenu</item>
</style>

<style name="PopupTheme" parent="@android:style/Theme.Material.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:windowSoftInputMode">stateAlwaysHidden</item>
<item name="android:windowActionModeOverlay">true</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowCloseOnTouchOutside">true</item>
<item name="android:windowIsTranslucent">true</item>
</style>

</resources>
6 changes: 4 additions & 2 deletions src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
<style name="Theme.AppManager" parent="@style/Theme.Shadow">
</style>

<style name="PopupTheme" parent="@android:style/Theme.Translucent.NoTitleBar">
<style name="PopupTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowContentOverlay">@null</item>
Expand Down Expand Up @@ -72,4 +74,4 @@
<item name="mdMenuSize">250dp</item>
</style>

</resources>
</resources>
23 changes: 23 additions & 0 deletions src/main/scala/com/github/shadowsocks/Shadowsocks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fa083a8

Please sign in to comment.