@@ -25,14 +25,13 @@ class QSTileService : TileService() {
25
25
* @param state The state to set.
26
26
*/
27
27
fun setState (state : Int ) {
28
+ qsTile?.icon = Icon .createWithResource(applicationContext, R .drawable.ic_stat_name)
28
29
if (state == Tile .STATE_INACTIVE ) {
29
30
qsTile?.state = Tile .STATE_INACTIVE
30
31
qsTile?.label = getString(R .string.app_name)
31
- qsTile?.icon = Icon .createWithResource(applicationContext, R .drawable.ic_stat_name)
32
32
} else if (state == Tile .STATE_ACTIVE ) {
33
33
qsTile?.state = Tile .STATE_ACTIVE
34
34
qsTile?.label = V2RayServiceManager .getRunningServerName()
35
- qsTile?.icon = Icon .createWithResource(applicationContext, R .drawable.ic_stat_name)
36
35
}
37
36
38
37
qsTile?.updateTile()
@@ -45,7 +44,11 @@ class QSTileService : TileService() {
45
44
override fun onStartListening () {
46
45
super .onStartListening()
47
46
48
- setState(Tile .STATE_INACTIVE )
47
+ if (V2RayServiceManager .isRunning()) {
48
+ setState(Tile .STATE_ACTIVE )
49
+ } else {
50
+ setState(Tile .STATE_INACTIVE )
51
+ }
49
52
mMsgReceive = ReceiveMessageHandler (this )
50
53
val mFilter = IntentFilter (AppConfig .BROADCAST_ACTION_ACTIVITY )
51
54
ContextCompat .registerReceiver(applicationContext, mMsgReceive, mFilter, Utils .receiverFlags())
0 commit comments