Skip to content

Commit

Permalink
Reformat code to Android Studio conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Aug 12, 2024
1 parent 66dcb8b commit bb7b195
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/src/main/java/au/id/colby/nfcquicksettings/NfcTileService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ class NfcTileService : TileService() {
* Application Details activity (`ACTION_APPLICATION_DETAILS_SETTINGS`)).
*/
private fun updatePreferencesActivity() {
val newState = if (permissionGranted(WRITE_SECURE_SETTINGS))
PackageManager.COMPONENT_ENABLED_STATE_ENABLED
else
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
val newState =
if (permissionGranted(WRITE_SECURE_SETTINGS)) PackageManager.COMPONENT_ENABLED_STATE_ENABLED
else PackageManager.COMPONENT_ENABLED_STATE_DISABLED
Log.d(TAG, "Setting preferences activity enabled setting to $newState")
applicationContext.packageManager.setComponentEnabledSetting(
ComponentName(applicationContext, NfcTilePreferencesActivity::class.java),
newState, PackageManager.DONT_KILL_APP
newState,
PackageManager.DONT_KILL_APP
)
}

Expand Down Expand Up @@ -213,8 +213,10 @@ class NfcTileService : TileService() {
* @param adapter The adapter to reflect the state of.
*/
private fun updateTile(adapter: NfcAdapter? = NfcAdapter.getDefaultAdapter(this)) {
adapter?.apply { updateTile(isEnabled) } ?:
updateTile(Tile.STATE_INACTIVE, string.tile_subtitle_unavailable)
adapter?.apply { updateTile(isEnabled) } ?: updateTile(
Tile.STATE_INACTIVE,
string.tile_subtitle_unavailable
)
}

/**
Expand Down

0 comments on commit bb7b195

Please sign in to comment.