Codex/our car - #2
Merged
Merged
Conversation
移动摇杆 |y| <= |x| 时 (与水平夹角 <= 45°) 取反 moveX。 仅纯横向和平缓斜向受影响,竖直方向不变。
There was a problem hiding this comment.
Pull request overview
This PR enhances the car control UI’s widget system by adding edit/delete affordances, supporting long-press editing of custom widgets, and improving command normalization plus widget visibility management in the ViewModel.
Changes:
- Added per-widget edit/delete controls and the ability to long-press custom widgets to edit their metadata.
- Introduced “hide built-in widgets” behavior (instead of removing) and a “restore hidden widgets” action in edit mode.
- Improved
sendCustomCommandframing/normalization and adjusted some control sizing/layout.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| app/src/main/java/com/fangzhou/carcontrol/ui/ControlPanel.kt | Adds edit/delete UI affordances, custom-widget long-press editing, and restore-hidden-built-ins UI. |
| app/src/main/java/com/fangzhou/carcontrol/ui/AddCustomButtonDialog.kt | Extends the dialog to support edit use-cases (initial values, title/confirm text) and improves color picker layout. |
| app/src/main/java/com/fangzhou/carcontrol/MainViewModel.kt | Updates command framing, joystick axis adjustments, and adds widget metadata/visibility APIs plus “hide built-ins” semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+56
to
+58
| var label by remember { mutableStateOf(initialLabel) } | ||
| var command by remember { mutableStateOf(initialCommand) } | ||
| var selectedColor by remember { mutableStateOf(initialColorHex) } |
Comment on lines
132
to
136
| onClick = { | ||
| if (label.isNotBlank() && command.isNotBlank()) { | ||
| onAdd(label.trim(), command.trim(), selectedColor) | ||
| onDismiss() | ||
| } |
Comment on lines
+144
to
+148
| initialLabel = widget.label.orEmpty().ifBlank { widget.id }, | ||
| initialCommand = widget.command.orEmpty(), | ||
| initialColorHex = widget.colorHex, | ||
| title = if (widget.isCustom) "编辑自定义按钮" else "覆盖控件命令", | ||
| confirmText = "保存" |
Comment on lines
+363
to
+371
| val trimmed = command.trim() | ||
| if (trimmed.isEmpty()) return | ||
| val framed = when { | ||
| trimmed.endsWith("\r\n") -> trimmed | ||
| trimmed.startsWith("[") -> if (trimmed.endsWith("\n")) trimmed else "$trimmed\r\n" | ||
| else -> "[$trimmed]\r\n" | ||
| } | ||
| connectionManager.send(framed) | ||
| addLog("TX: ${framed.trim()}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.