Commit 16e39f8b authored by Mygod's avatar Mygod

Hide quick switch if there's nothing to switch

parent 6dede5c0
...@@ -41,8 +41,12 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str ...@@ -41,8 +41,12 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
.setSmallIcon(R.drawable.ic_stat_shadowsocks) .setSmallIcon(R.drawable.ic_stat_shadowsocks)
.addAction(android.R.drawable.ic_menu_close_clear_cancel, service.getString(R.string.stop), .addAction(android.R.drawable.ic_menu_close_clear_cancel, service.getString(R.string.stop),
PendingIntent.getBroadcast(service, 0, new Intent(Action.CLOSE), 0)) PendingIntent.getBroadcast(service, 0, new Intent(Action.CLOSE), 0))
.addAction(android.R.drawable.ic_menu_manage, service.getString(R.string.quick_switch), ShadowsocksApplication.profileManager.getAllProfiles match {
PendingIntent.getActivity(service, 0, new Intent(Action.QUICK_SWITCH), 0)) case Some(profiles) => if (profiles.length > 1)
builder.addAction(android.R.drawable.ic_menu_manage, service.getString(R.string.quick_switch),
PendingIntent.getActivity(service, 0, new Intent(Action.QUICK_SWITCH), 0))
case _ =>
}
private lazy val style = new BigTextStyle(builder) private lazy val style = new BigTextStyle(builder)
private val showOnUnlock = visible && Utils.isLollipopOrAbove private val showOnUnlock = visible && Utils.isLollipopOrAbove
private var isVisible = true private var isVisible = true
......
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