Skip to content

Commit

Permalink
Add how to use to remote controls (#937)
Browse files Browse the repository at this point in the history
**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
  • Loading branch information
makeevrserg committed Sep 6, 2024
1 parent 4dfd61a commit 838796f
Show file tree
Hide file tree
Showing 7 changed files with 951 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
- [Feature] Skip infrared signals on setup screen
- [Refactor] Load RemoteControls from flipper, emulating animation
- [Refactor] Update to Kotlin 2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ import com.flipperdevices.core.ui.res.R as SharedRes
@Composable
@Suppress("LongMethod")
internal fun ComposableInfraredDropDown(
onRemoteInfo: () -> Unit,
onRename: () -> Unit,
onShare: () -> Unit,
onDelete: () -> Unit,
isEmulating: Boolean,
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
Expand Down Expand Up @@ -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()
}
)
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 838796f

Please sign in to comment.