Commit 738febba authored by Mygod's avatar Mygod

Always show stop button for now

Fix #940.
parent ed91010b
...@@ -40,7 +40,7 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str ...@@ -40,7 +40,7 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
.setContentIntent(PendingIntent.getActivity(service, 0, new Intent(service, classOf[Shadowsocks]) .setContentIntent(PendingIntent.getActivity(service, 0, new Intent(service, classOf[Shadowsocks])
.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 0)) .setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT), 0))
.setSmallIcon(R.drawable.ic_stat_shadowsocks) .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)) service.getString(R.string.stop), PendingIntent.getBroadcast(service, 0, new Intent(Action.CLOSE), 0))
app.profileManager.getAllProfiles match { app.profileManager.getAllProfiles match {
case Some(profiles) => if (profiles.length > 1) case Some(profiles) => if (profiles.length > 1)
......
...@@ -9,10 +9,6 @@ import com.github.shadowsocks.utils.{State, Utils} ...@@ -9,10 +9,6 @@ import com.github.shadowsocks.utils.{State, Utils}
/** /**
* @author Mygod * @author Mygod
*/ */
object ShadowsocksTileService {
var running: Boolean = _
}
@TargetApi(24) @TargetApi(24)
final class ShadowsocksTileService extends TileService with ServiceBoundContext { final class ShadowsocksTileService extends TileService with ServiceBoundContext {
import ShadowsocksTileService._ import ShadowsocksTileService._
...@@ -46,15 +42,6 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext ...@@ -46,15 +42,6 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext
override def onServiceConnected() = callback.stateChanged(bgService.getState, bgService.getProfileName, null) 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 { override def onStartListening {
super.onStartListening super.onStartListening
attachService(callback) attachService(callback)
......
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