From 738febbac7b53b5185b9fb4d0910702b88530908 Mon Sep 17 00:00:00 2001 From: Mygod Date: Sat, 15 Oct 2016 13:47:29 +0800 Subject: [PATCH] Always show stop button for now Fix #940. --- .../shadowsocks/ShadowsocksNotification.scala | 2 +- .../github/shadowsocks/ShadowsocksTileService.scala | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala index 2df8a806..7b3c94bb 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala @@ -40,7 +40,7 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str .setContentIntent(PendingIntent.getActivity(service, 0, new Intent(service, classOf[Shadowsocks]) .setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 0)) .setSmallIcon(R.drawable.ic_stat_shadowsocks) - if (!ShadowsocksTileService.running) builder.addAction(R.drawable.ic_navigation_close, + builder.addAction(R.drawable.ic_navigation_close, service.getString(R.string.stop), PendingIntent.getBroadcast(service, 0, new Intent(Action.CLOSE), 0)) app.profileManager.getAllProfiles match { case Some(profiles) => if (profiles.length > 1) diff --git a/src/main/scala/com/github/shadowsocks/ShadowsocksTileService.scala b/src/main/scala/com/github/shadowsocks/ShadowsocksTileService.scala index 59a5766c..86f0f2c7 100644 --- a/src/main/scala/com/github/shadowsocks/ShadowsocksTileService.scala +++ b/src/main/scala/com/github/shadowsocks/ShadowsocksTileService.scala @@ -9,10 +9,6 @@ import com.github.shadowsocks.utils.{State, Utils} /** * @author Mygod */ -object ShadowsocksTileService { - var running: Boolean = _ -} - @TargetApi(24) final class ShadowsocksTileService extends TileService with ServiceBoundContext { import ShadowsocksTileService._ @@ -46,15 +42,6 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext override def onServiceConnected() = callback.stateChanged(bgService.getState, bgService.getProfileName, null) - override def onCreate { - super.onCreate - running = true - } - override def onDestroy { - super.onDestroy - running = false - } - override def onStartListening { super.onStartListening attachService(callback)