From 0aec07d4f176fd00f8a2c94b83db80e44df885b0 Mon Sep 17 00:00:00 2001 From: Roman Makeev Date: Fri, 6 Sep 2024 09:02:18 +0300 Subject: [PATCH 1/2] add how to use --- .../local/composable/LocalGridComposable.kt | 7 - .../ComposableRemoteDialogHowToUse.kt | 31 ++ .../composable/components/GridOptions.kt | 8 +- .../res/drawable/ir_flipper_format_dark.xml | 455 ++++++++++++++++++ .../res/drawable/ir_flipper_format_light.xml | 455 ++++++++++++++++++ .../impl/src/main/res/values/strings.xml | 5 +- 6 files changed, 950 insertions(+), 11 deletions(-) create mode 100644 components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/ComposableRemoteDialogHowToUse.kt create mode 100644 components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_dark.xml create mode 100644 components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_light.xml diff --git a/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/LocalGridComposable.kt b/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/LocalGridComposable.kt index adc8263c55..35eff52526 100644 --- a/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/LocalGridComposable.kt +++ b/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/LocalGridComposable.kt @@ -66,13 +66,6 @@ fun LocalGridComposable( onCallback.invoke(LocalGridScreenDecomposeComponent.Callback.Deleted) } }, - onRemoteInfo = { - onCallback.invoke( - LocalGridScreenDecomposeComponent.Callback.ViewRemoteInfo( - loadedModel.keyPath - ) - ) - }, onShare = onShare, isEmulating = loadedModel.emulatedKey != null, isConnected = loadedModel.isConnected diff --git a/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/ComposableRemoteDialogHowToUse.kt b/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/ComposableRemoteDialogHowToUse.kt new file mode 100644 index 0000000000..4910098aee --- /dev/null +++ b/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/ComposableRemoteDialogHowToUse.kt @@ -0,0 +1,31 @@ +package com.flipperdevices.remotecontrols.impl.grid.local.composable.components + +import androidx.compose.material.MaterialTheme +import androidx.compose.runtime.Composable +import com.flipperdevices.core.ui.dialog.composable.FlipperDialog +import com.flipperdevices.remotecontrols.grid.saved.impl.R + +@Composable +internal fun ComposableRemoteDialogHowToUse( + isShowDialog: Boolean, + onClose: () -> Unit, +) { + if (!isShowDialog) { + return + } + + val imageId = if (MaterialTheme.colors.isLight) { + R.drawable.ir_flipper_format_light + } else { + R.drawable.ir_flipper_format_dark + } + + FlipperDialog( + buttonTextId = R.string.rc_dialog_how_to_use_btn, + onClickButton = onClose, + onDismissRequest = onClose, + imageId = imageId, + titleId = R.string.rc_dialog_how_to_use_title, + textId = R.string.rc_dialog_how_to_use_text, + ) +} diff --git a/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/GridOptions.kt b/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/GridOptions.kt index 8d073a8ff4..004fc330be 100644 --- a/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/GridOptions.kt +++ b/components/remote-controls/grid/saved/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/grid/local/composable/components/GridOptions.kt @@ -36,7 +36,6 @@ import com.flipperdevices.core.ui.res.R as SharedRes @Composable @Suppress("LongMethod") internal fun ComposableInfraredDropDown( - onRemoteInfo: () -> Unit, onRename: () -> Unit, onShare: () -> Unit, onDelete: () -> Unit, @@ -44,6 +43,9 @@ internal fun ComposableInfraredDropDown( isConnected: Boolean, modifier: Modifier = Modifier, ) { + var isShowHowToUseDialog by remember { mutableStateOf(false) } + ComposableRemoteDialogHowToUse(isShowHowToUseDialog) { isShowHowToUseDialog = false } + var isShowMoreOptions by remember { mutableStateOf(false) } val onChangeState = { isShowMoreOptions = !isShowMoreOptions } val isDropDownEnabled = isConnected && !isEmulating @@ -75,10 +77,10 @@ internal fun ComposableInfraredDropDown( onDismissRequest = { isShowMoreOptions = false } ) { ComposableInfraredDropDownItem( - text = stringResource(R.string.option_remote_info), + text = stringResource(R.string.option_how_to_use), painter = painterResource(R.drawable.ic_how_to_use), onClick = { - onRemoteInfo.invoke() + isShowHowToUseDialog = !isShowHowToUseDialog onChangeState.invoke() } ) diff --git a/components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_dark.xml b/components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_dark.xml new file mode 100644 index 0000000000..bc768d4f0e --- /dev/null +++ b/components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_dark.xml @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_light.xml b/components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_light.xml new file mode 100644 index 0000000000..6126081b9d --- /dev/null +++ b/components/remote-controls/grid/saved/impl/src/main/res/drawable/ir_flipper_format_light.xml @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/remote-controls/grid/saved/impl/src/main/res/values/strings.xml b/components/remote-controls/grid/saved/impl/src/main/res/values/strings.xml index 5d1dc21cae..fa70b5b8f2 100644 --- a/components/remote-controls/grid/saved/impl/src/main/res/values/strings.xml +++ b/components/remote-controls/grid/saved/impl/src/main/res/values/strings.xml @@ -4,10 +4,13 @@ Flipper not connected Syncing… Synced! - Remote Info + How to use Rename Share Delete Loading Remote… Remote + Got it + How to Use + Point Flipper Zero at the device. Tap or hold the button on your phone to send the signal remotely. \ No newline at end of file From 26fcab844e21bbd7f6e9e113dc8c981a8c92a9f6 Mon Sep 17 00:00:00 2001 From: Roman Makeev Date: Fri, 6 Sep 2024 09:58:51 +0300 Subject: [PATCH 2/2] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 332953ad9b..70b389f71c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Attention: don't forget to add the flag for F-Droid before release - [Feature] Add onetap widget - [Feature] Save, edit, share remote control - [Feature] More UI elements for remote-controls +- [Feature] Add How to Use dialog into remote-controls - [Refactor] Load RemoteControls from flipper, emulating animation - [Refactor] Update to Kotlin 2.0 - [Refactor] Replace Ktorfit with Ktor requests in remote-controls