Hide stop action in notification if the quick settings tile is present
This commit is contained in:
@@ -10,8 +10,14 @@ import com.github.shadowsocks.ShadowsocksApplication.app
|
||||
/**
|
||||
* @author Mygod
|
||||
*/
|
||||
object ShadowsocksTileService {
|
||||
var running: Boolean = _
|
||||
}
|
||||
|
||||
@TargetApi(24)
|
||||
final class ShadowsocksTileService extends TileService with ServiceBoundContext {
|
||||
import ShadowsocksTileService._
|
||||
|
||||
private lazy val iconIdle = Icon.createWithResource(this, R.drawable.ic_start_idle).setTint(0x80ffffff)
|
||||
private lazy val iconBusy = Icon.createWithResource(this, R.drawable.ic_start_busy)
|
||||
private lazy val iconConnected = Icon.createWithResource(this, R.drawable.ic_start_connected)
|
||||
@@ -42,11 +48,19 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext
|
||||
|
||||
override def onServiceConnected = callback.stateChanged(bgService.getState, null)
|
||||
|
||||
override def onCreate {
|
||||
super.onCreate
|
||||
running = true
|
||||
}
|
||||
override def onDestroy {
|
||||
super.onDestroy
|
||||
running = false
|
||||
}
|
||||
|
||||
override def onStartListening {
|
||||
super.onStartListening
|
||||
attachService(callback)
|
||||
}
|
||||
|
||||
override def onStopListening {
|
||||
super.onStopListening
|
||||
detachService // just in case the user switches to NAT mode, also saves battery
|
||||
|
||||
Reference in New Issue
Block a user