Skip to content

Commit 33380a6

Browse files
committed
#1596 fix: Do not show the option for front flashlight if the device does not have one.
1 parent 151617f commit 33380a6

2 files changed

Lines changed: 23 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Do not hide floating button when the quick settings are showing if the key map action can collapse the status bar.
1212
- Do not show floating buttons on the always-on display or when the display is "off".
1313
- Prompt to unlock device when tapping "Go back" on the floating menu.
14+
- #1596 Do not show the option for front flashlight if the device does not have one.
1415

1516
## [3.0 Beta 2](https://github.com/sds100/KeyMapper/releases/tag/v3.0.0-beta.2)
1617

app/src/main/java/io/github/sds100/keymapper/actions/FlashlightActionBottomSheet.kt

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -371,28 +371,30 @@ private fun FlashlightActionBottomSheet(
371371

372372
Spacer(modifier = Modifier.height(8.dp))
373373

374-
OptionsHeaderRow(
375-
modifier = Modifier.padding(horizontal = 16.dp),
376-
icon = Icons.Rounded.CameraFront,
377-
text = stringResource(R.string.action_config_flashlight_choose_side),
378-
)
379-
380-
Row(modifier = Modifier.padding(horizontal = 8.dp)) {
381-
RadioButtonText(
382-
modifier = Modifier,
383-
text = stringResource(R.string.lens_front),
384-
isSelected = selectedLens == CameraLens.FRONT,
385-
onSelected = { onSelectLens(CameraLens.FRONT) },
386-
isEnabled = availableLenses.contains(CameraLens.FRONT),
374+
if (availableLenses.size > 1) {
375+
OptionsHeaderRow(
376+
modifier = Modifier.padding(horizontal = 16.dp),
377+
icon = Icons.Rounded.CameraFront,
378+
text = stringResource(R.string.action_config_flashlight_choose_side),
387379
)
388380

389-
RadioButtonText(
390-
modifier = Modifier,
391-
text = stringResource(R.string.lens_back),
392-
isSelected = selectedLens == CameraLens.BACK,
393-
onSelected = { onSelectLens(CameraLens.BACK) },
394-
isEnabled = availableLenses.contains(CameraLens.BACK),
395-
)
381+
Row(modifier = Modifier.padding(horizontal = 8.dp)) {
382+
RadioButtonText(
383+
modifier = Modifier,
384+
text = stringResource(R.string.lens_front),
385+
isSelected = selectedLens == CameraLens.FRONT,
386+
onSelected = { onSelectLens(CameraLens.FRONT) },
387+
isEnabled = availableLenses.contains(CameraLens.FRONT),
388+
)
389+
390+
RadioButtonText(
391+
modifier = Modifier,
392+
text = stringResource(R.string.lens_back),
393+
isSelected = selectedLens == CameraLens.BACK,
394+
onSelected = { onSelectLens(CameraLens.BACK) },
395+
isEnabled = availableLenses.contains(CameraLens.BACK),
396+
)
397+
}
396398
}
397399

398400
Spacer(modifier = Modifier.height(8.dp))

0 commit comments

Comments
 (0)