Skip to content

Commit 838796f

Browse files
authored
Add how to use to remote controls (#937)
**Background** How to use dialog will help new users to understand **Changes** - Add how to use dialog **Test plan** - Open saved remote and click how to use
1 parent 4dfd61a commit 838796f

File tree

7 files changed

+951
-11
lines changed

7 files changed

+951
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Attention: don't forget to add the flag for F-Droid before release
1010
- [Feature] Add onetap widget
1111
- [Feature] Save, edit, share remote control
1212
- [Feature] More UI elements for remote-controls
13+
- [Feature] Add How to Use dialog into remote-controls
1314
- [Feature] Skip infrared signals on setup screen
1415
- [Refactor] Load RemoteControls from flipper, emulating animation
1516
- [Refactor] Update to Kotlin 2.0

components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/LocalGridComposable.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ fun LocalGridComposable(
6666
onCallback.invoke(LocalGridScreenDecomposeComponent.Callback.Deleted)
6767
}
6868
},
69-
onRemoteInfo = {
70-
onCallback.invoke(
71-
LocalGridScreenDecomposeComponent.Callback.ViewRemoteInfo(
72-
loadedModel.keyPath
73-
)
74-
)
75-
},
7669
onShare = onShare,
7770
isEmulating = loadedModel.emulatedKey != null,
7871
isConnected = loadedModel.isConnected
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.flipperdevices.remotecontrols.impl.grid.local.composable.components
2+
3+
import androidx.compose.material.MaterialTheme
4+
import androidx.compose.runtime.Composable
5+
import com.flipperdevices.core.ui.dialog.composable.FlipperDialog
6+
import com.flipperdevices.remotecontrols.grid.saved.impl.R
7+
8+
@Composable
9+
internal fun ComposableRemoteDialogHowToUse(
10+
isShowDialog: Boolean,
11+
onClose: () -> Unit,
12+
) {
13+
if (!isShowDialog) {
14+
return
15+
}
16+
17+
val imageId = if (MaterialTheme.colors.isLight) {
18+
R.drawable.ir_flipper_format_light
19+
} else {
20+
R.drawable.ir_flipper_format_dark
21+
}
22+
23+
FlipperDialog(
24+
buttonTextId = R.string.rc_dialog_how_to_use_btn,
25+
onClickButton = onClose,
26+
onDismissRequest = onClose,
27+
imageId = imageId,
28+
titleId = R.string.rc_dialog_how_to_use_title,
29+
textId = R.string.rc_dialog_how_to_use_text,
30+
)
31+
}

components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/GridOptions.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ import com.flipperdevices.core.ui.res.R as SharedRes
3636
@Composable
3737
@Suppress("LongMethod")
3838
internal fun ComposableInfraredDropDown(
39-
onRemoteInfo: () -> Unit,
4039
onRename: () -> Unit,
4140
onShare: () -> Unit,
4241
onDelete: () -> Unit,
4342
isEmulating: Boolean,
4443
isConnected: Boolean,
4544
modifier: Modifier = Modifier,
4645
) {
46+
var isShowHowToUseDialog by remember { mutableStateOf(false) }
47+
ComposableRemoteDialogHowToUse(isShowHowToUseDialog) { isShowHowToUseDialog = false }
48+
4749
var isShowMoreOptions by remember { mutableStateOf(false) }
4850
val onChangeState = { isShowMoreOptions = !isShowMoreOptions }
4951
val isDropDownEnabled = isConnected && !isEmulating
@@ -75,10 +77,10 @@ internal fun ComposableInfraredDropDown(
7577
onDismissRequest = { isShowMoreOptions = false }
7678
) {
7779
ComposableInfraredDropDownItem(
78-
text = stringResource(R.string.option_remote_info),
80+
text = stringResource(R.string.option_how_to_use),
7981
painter = painterResource(R.drawable.ic_how_to_use),
8082
onClick = {
81-
onRemoteInfo.invoke()
83+
isShowHowToUseDialog = !isShowHowToUseDialog
8284
onChangeState.invoke()
8385
}
8486
)

components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_dark.xml

Lines changed: 455 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)