Commit 10725c39 authored by Mygod's avatar Mygod

Check QsTile is null

parent 4b5c9402
...@@ -25,24 +25,26 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext ...@@ -25,24 +25,26 @@ final class ShadowsocksTileService extends TileService with ServiceBoundContext
def trafficUpdated(txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) = () def trafficUpdated(txRate: Long, rxRate: Long, txTotal: Long, rxTotal: Long) = ()
def stateChanged(state: Int, msg: String) { def stateChanged(state: Int, msg: String) {
val tile = getQsTile val tile = getQsTile
state match { if (tile != null) {
case State.STOPPED => state match {
tile.setIcon(iconIdle) case State.STOPPED =>
tile.setLabel(getString(R.string.app_name)) tile.setIcon(iconIdle)
tile.setState(Tile.STATE_INACTIVE) tile.setLabel(getString(R.string.app_name))
case State.CONNECTED => tile.setState(Tile.STATE_INACTIVE)
tile.setIcon(iconConnected) case State.CONNECTED =>
tile.setLabel(app.currentProfile match { tile.setIcon(iconConnected)
case Some(profile) => profile.name tile.setLabel(app.currentProfile match {
case None => getString(R.string.app_name) case Some(profile) => profile.name
}) case None => getString(R.string.app_name)
tile.setState(Tile.STATE_ACTIVE) })
case _ => tile.setState(Tile.STATE_ACTIVE)
tile.setIcon(iconBusy) case _ =>
tile.setLabel(getString(R.string.app_name)) tile.setIcon(iconBusy)
tile.setState(Tile.STATE_UNAVAILABLE) tile.setLabel(getString(R.string.app_name))
tile.setState(Tile.STATE_UNAVAILABLE)
}
tile.updateTile
} }
tile.updateTile
} }
} }
......
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