Refine code style
This commit is contained in:
@@ -63,7 +63,7 @@ sealed class TetheringTileService : TetherListeningTileService(), TetheringManag
|
|||||||
} else {
|
} else {
|
||||||
val binder = binder ?: return
|
val binder = binder ?: return
|
||||||
state = Tile.STATE_ACTIVE
|
state = Tile.STATE_ACTIVE
|
||||||
icon = if (interested.all { binder.isActive(it) }) tileOn else tileOff
|
icon = if (interested.all(binder::isActive)) tileOn else tileOff
|
||||||
}
|
}
|
||||||
label = getText(labelString)
|
label = getText(labelString)
|
||||||
updateTile()
|
updateTile()
|
||||||
@@ -91,7 +91,7 @@ sealed class TetheringTileService : TetherListeningTileService(), TetheringManag
|
|||||||
if (interested.isEmpty()) safeInvoker { start() } else {
|
if (interested.isEmpty()) safeInvoker { start() } else {
|
||||||
val binder = binder
|
val binder = binder
|
||||||
if (binder == null) tapPending = true else {
|
if (binder == null) tapPending = true else {
|
||||||
val inactive = interested.filter { !binder.isActive(it) }
|
val inactive = interested.filterNot(binder::isActive)
|
||||||
if (inactive.isEmpty()) safeInvoker { stop() }
|
if (inactive.isEmpty()) safeInvoker { stop() }
|
||||||
else ContextCompat.startForegroundService(this, Intent(this, TetheringService::class.java)
|
else ContextCompat.startForegroundService(this, Intent(this, TetheringService::class.java)
|
||||||
.putExtra(TetheringService.EXTRA_ADD_INTERFACES, inactive.toTypedArray()))
|
.putExtra(TetheringService.EXTRA_ADD_INTERFACES, inactive.toTypedArray()))
|
||||||
@@ -147,7 +147,7 @@ sealed class TetheringTileService : TetherListeningTileService(), TetheringManag
|
|||||||
val binder = binder ?: return
|
val binder = binder ?: return
|
||||||
state = Tile.STATE_ACTIVE
|
state = Tile.STATE_ACTIVE
|
||||||
val interested = interested
|
val interested = interested
|
||||||
icon = if (interested.isNotEmpty() && interested.all { binder.isActive(it) }) tileOn else tileOff
|
icon = if (interested.isNotEmpty() && interested.all(binder::isActive)) tileOn else tileOff
|
||||||
}
|
}
|
||||||
false -> {
|
false -> {
|
||||||
state = Tile.STATE_INACTIVE
|
state = Tile.STATE_INACTIVE
|
||||||
@@ -164,7 +164,7 @@ sealed class TetheringTileService : TetherListeningTileService(), TetheringManag
|
|||||||
true -> {
|
true -> {
|
||||||
val binder = binder
|
val binder = binder
|
||||||
if (binder == null) tapPending = true else {
|
if (binder == null) tapPending = true else {
|
||||||
val inactive = interested.filter { !binder.isActive(it) }
|
val inactive = interested.filterNot(binder::isActive)
|
||||||
if (inactive.isEmpty()) safeInvoker { stop() }
|
if (inactive.isEmpty()) safeInvoker { stop() }
|
||||||
else ContextCompat.startForegroundService(this, Intent(this, TetheringService::class.java)
|
else ContextCompat.startForegroundService(this, Intent(this, TetheringService::class.java)
|
||||||
.putExtra(TetheringService.EXTRA_ADD_INTERFACES, inactive.toTypedArray()))
|
.putExtra(TetheringService.EXTRA_ADD_INTERFACES, inactive.toTypedArray()))
|
||||||
|
|||||||
Reference in New Issue
Block a user