feat(scene): add scene editor, executor and fakes (phase 1) (#5)
## Summary Adds scene integration phase 1: domain model, fakes, UI, navigation, and tests. ## Changes - **domain**: Add `Scene`, `SceneAction` (SocketPower/InfraredKey), `SceneRepository`, `SceneExecutor`, and execution result models. - **testing/fakes**: Add `FakeSceneRepository` (isolated by `ProviderProfileId`, seeded defaults for the local profile) and `FakeSceneExecutor` (sequential execution, continue-on-failure). - **android/app**: Add scene UI module - list screen, editor screen, execution progress screen - with Hilt-bound ViewModels. - **navigation**: Wire scene routes into `ABoxManagerApp` NavHost. - **strings**: Add `scene_*` entries for en and zh-rCN. - **tests**: Cover `FakeSceneRepository` CRUD/isolation and `FakeSceneExecutor` ordering/continue-on-failure. ## Test plan - [x] `./gradlew :testing:fakes:test` passes. - [x] `FakeSceneRepository` isolates scenes by provider profile. - [x] `FakeSceneExecutor` runs actions in order and continues on failure. ## Notes Phase 1 ships fakes only; real repository/executor backed by the abox gateway will land in a follow-up. --------- Co-authored-by: KremeCN <3265494849@qq.com> Co-authored-by: mxhsnd <2049295946@qq.com> Reviewed-on: #5 Co-authored-by: tzh <3091898014@qq.com>
This commit was merged in pull request #5.
This commit is contained in:
@@ -42,6 +42,167 @@
|
||||
<string name="activity_placeholder_title">活动记录</string>
|
||||
<string name="activity_placeholder_description">未记录任何事件。</string>
|
||||
|
||||
<!-- Scene & Automation strings -->
|
||||
<string name="scene_list_title">自动化与情景</string>
|
||||
<string name="scene_tab_all">全部</string>
|
||||
<string name="scene_tab_manual">一键指令</string>
|
||||
<string name="scene_tab_automatic">自动指令</string>
|
||||
<string name="scene_create_manual">建立一键指令</string>
|
||||
<string name="scene_create_automatic">建立自动指令</string>
|
||||
<string name="scene_create_action">新建指令</string>
|
||||
<string name="scene_action_count">%1$d 个动作</string>
|
||||
<string name="scene_edit">编辑指令</string>
|
||||
<string name="scene_delete">删除指令</string>
|
||||
<string name="scene_empty_title">还没有自动化指令</string>
|
||||
<string name="scene_empty_message">点击右下角按钮,建立一键指令或带触发器的自动指令。</string>
|
||||
<string name="scene_action_run_now">立即执行</string>
|
||||
<string name="scene_toast_executed">指令已触发执行</string>
|
||||
|
||||
<!-- Scene: delete dialog -->
|
||||
<string name="scene_delete_dialog_title">删除指令</string>
|
||||
<string name="scene_delete_dialog_message">确定要删除该指令吗?此操作无法撤销。</string>
|
||||
<string name="scene_delete_confirm">删除</string>
|
||||
<string name="scene_delete_cancel">取消</string>
|
||||
|
||||
<!-- Scene: editor -->
|
||||
<string name="scene_editor_manual_title">建立一键指令</string>
|
||||
<string name="scene_editor_auto_title">建立自动指令</string>
|
||||
<string name="scene_editor_edit_title">编辑指令</string>
|
||||
<string name="scene_back">返回</string>
|
||||
<string name="scene_name_label">标题</string>
|
||||
<string name="scene_name_hint">请输入指令标题(如:回家一键开灯、高温自动降温)</string>
|
||||
<string name="scene_description_label">描述</string>
|
||||
<string name="scene_description_hint">可填写该指令的详细说明或备注</string>
|
||||
|
||||
<!-- Sections -->
|
||||
<string name="scene_section_triggers">触发器</string>
|
||||
<string name="scene_section_conditions">条件(可选)</string>
|
||||
<string name="scene_section_actions">动作</string>
|
||||
<string name="scene_section_advanced">进阶选项</string>
|
||||
<string name="scene_section_other">其他选项与外观</string>
|
||||
|
||||
<!-- Add Buttons -->
|
||||
<string name="scene_add_trigger">+ 新增触发器</string>
|
||||
<string name="scene_add_condition">+ 新增条件</string>
|
||||
<string name="scene_add_action_btn">+ 新增动作</string>
|
||||
<string name="scene_add_action">添加</string>
|
||||
<string name="scene_save_action">保存指令</string>
|
||||
|
||||
<!-- Strategies & Toggles -->
|
||||
<string name="scene_repeat_strategy">重复执行策略</string>
|
||||
<string name="scene_strategy_continue">继续执行新任务</string>
|
||||
<string name="scene_concurrency_mode">多指令同步策略</string>
|
||||
<string name="scene_concurrency_sync">同步 (串行执行)</string>
|
||||
<string name="scene_concurrency_async">异步 (并发执行)</string>
|
||||
<string name="scene_error_policy">遇到错误时</string>
|
||||
<string name="scene_policy_continue">继续执行后续动作</string>
|
||||
<string name="scene_policy_abort">立即中止剩余动作</string>
|
||||
<string name="scene_appearance_icon">图示</string>
|
||||
<string name="scene_appearance_color">图示背景色</string>
|
||||
<string name="scene_enable_rule">启用该自动指令</string>
|
||||
<string name="scene_enable_logging">开启指令执行记录</string>
|
||||
|
||||
<!-- Trigger Types & Dialog -->
|
||||
<string name="scene_dialog_add_trigger_title">选择触发器类型</string>
|
||||
<string name="scene_trigger_type_time">⏰ 定时时间触发</string>
|
||||
<string name="scene_trigger_type_temp">🌡️ 环境温度触发</string>
|
||||
<string name="scene_trigger_type_humidity">💧 环境湿度触发</string>
|
||||
<string name="scene_trigger_type_device">🔌 插座状态变更触发</string>
|
||||
<string name="scene_trigger_time_label">触发时间点(如:07:30)</string>
|
||||
<string name="scene_trigger_temp_threshold">温度阈值 (°C)</string>
|
||||
<string name="scene_trigger_humidity_threshold">湿度阈值 (%)</string>
|
||||
<string name="scene_operator_label">比较条件</string>
|
||||
<string name="scene_operator_gt">高于 (>)</string>
|
||||
<string name="scene_operator_lt">低于 (<)</string>
|
||||
<string name="scene_operator_eq">等于 (=)</string>
|
||||
|
||||
<!-- Condition Types & Dialog -->
|
||||
<string name="scene_dialog_add_condition_title">选择限制条件</string>
|
||||
<string name="scene_condition_type_temp">🌡️ 环境温度范围</string>
|
||||
<string name="scene_condition_type_humidity">💧 环境湿度范围</string>
|
||||
<string name="scene_condition_type_socket">🔌 插座当前电源状态</string>
|
||||
<string name="scene_condition_type_time_range">🕒 生效时间区间</string>
|
||||
<string name="scene_condition_start_time">起始时间(如:22:00)</string>
|
||||
<string name="scene_condition_end_time">结束时间(如:07:00)</string>
|
||||
|
||||
<!-- Action Types & Dialog -->
|
||||
<string name="scene_dialog_add_action_title">选择执行动作</string>
|
||||
<string name="scene_action_type_socket">🔌 智能插座控制</string>
|
||||
<string name="scene_action_type_virtual_remote">📺 红外遥控按键</string>
|
||||
<string name="scene_action_type_delay">⏱️ 延时等待 (缓冲)</string>
|
||||
<string name="scene_action_type_notification">🔔 发送系统提示</string>
|
||||
<string name="scene_select_socket">选择目标插座</string>
|
||||
<string name="scene_socket_power_state">设定电源状态</string>
|
||||
<string name="scene_select_virtual_remote">选择虚拟遥控器</string>
|
||||
<string name="scene_select_remote_button">选择遥控器功能按键</string>
|
||||
<string name="scene_delay_duration_label">等待时长 (秒)</string>
|
||||
<string name="scene_notification_title_label">提示标题</string>
|
||||
<string name="scene_notification_msg_label">提示消息内容</string>
|
||||
<string name="scene_unit_seconds">%1$d 秒</string>
|
||||
|
||||
<!-- Action Card Displays -->
|
||||
<string name="scene_action_socket">插座【%1$s】: 设为 %2$s</string>
|
||||
<string name="scene_action_remote">遥控【%1$s】: 发送 %2$s</string>
|
||||
<string name="scene_action_infrared">红外【%1$s】: 槽位 %2$s</string>
|
||||
<string name="scene_action_delay">⏱️ 等待 %1$d 秒</string>
|
||||
<string name="scene_action_notification">🔔 提示: %1$s</string>
|
||||
|
||||
<!-- Scene: execution -->
|
||||
<string name="scene_execution_title">执行指令</string>
|
||||
<string name="scene_execution_run">执行</string>
|
||||
<string name="scene_execution_running">正在执行:%1$s…</string>
|
||||
<string name="scene_execution_summary">%3$d 个动作中成功 %1$d 个,失败 %2$d 个</string>
|
||||
<string name="scene_execution_done">执行完成</string>
|
||||
<string name="scene_execution_duration">总耗时:%1$s ms</string>
|
||||
<string name="scene_step_pending">排队中</string>
|
||||
<string name="scene_step_running">正在执行…</string>
|
||||
<string name="scene_step_delaying">正在延时等待 (%1$d s)…</string>
|
||||
<string name="scene_step_success">已完成</string>
|
||||
<string name="scene_step_failed">执行失败</string>
|
||||
<string name="scene_step_skipped">已跳过</string>
|
||||
|
||||
<!-- 校验与弹窗选项/占位文案 -->
|
||||
<string name="scene_trigger_time_error">时间格式无效(请按 HH:mm 格式输入,如 07:30)</string>
|
||||
<string name="scene_condition_time_error">时间格式无效(请按 HH:mm 格式输入,如 22:00)</string>
|
||||
<string name="scene_chip_time">⏰ 定时</string>
|
||||
<string name="scene_chip_temp">🌡️ 温度</string>
|
||||
<string name="scene_chip_humidity">💧 湿度</string>
|
||||
<string name="scene_chip_socket">🔌 插座</string>
|
||||
<string name="scene_chip_remote">📺 遥控</string>
|
||||
<string name="scene_chip_delay">⏱️ 延时</string>
|
||||
<string name="scene_chip_notify">🔔 提示</string>
|
||||
<string name="scene_chip_above">> 高于</string>
|
||||
<string name="scene_chip_below">< 低于</string>
|
||||
<string name="scene_chip_power_on">开启</string>
|
||||
<string name="scene_chip_power_off">关闭</string>
|
||||
<string name="scene_threshold_temp">设定阈值:%1$d °C</string>
|
||||
<string name="scene_threshold_hum">设定阈值:%1$d %%</string>
|
||||
<string name="scene_target_socket_state">要求插座当前状态为:</string>
|
||||
<string name="scene_no_virtual_remotes">未找到虚拟遥控器,将默认使用红外控制器</string>
|
||||
<string name="scene_remote_button_slot_label">按键名称/槽位</string>
|
||||
<string name="scene_remote_button_name_label">按键名称</string>
|
||||
<string name="scene_empty_triggers_hint">尚未添加触发器,请点击下方按钮添加</string>
|
||||
<string name="scene_empty_conditions_hint">尚未添加限制条件,请点击下方按钮添加</string>
|
||||
<string name="scene_empty_actions_hint">尚未添加执行动作,请点击下方按钮添加</string>
|
||||
<string name="scene_summary_triggers_and_actions">⚡ %1$d 个触发器 • %2$d 个动作</string>
|
||||
<string name="scene_summary_actions_only">%1$d 个执行动作</string>
|
||||
<string name="scene_exec_ready_hint">点击下方按钮立即开始执行</string>
|
||||
<string name="scene_exec_rerun">重新执行</string>
|
||||
<string name="scene_step_format">步骤 %1$d:%2$s</string>
|
||||
<string name="scene_trigger_desc_temp">温度 %1$s %2$s°C</string>
|
||||
<string name="scene_trigger_desc_humidity">湿度 %1$s %2$s%%</string>
|
||||
<string name="scene_trigger_desc_device">%1$s 状态变为 %2$s</string>
|
||||
<string name="scene_condition_desc_temp">温度需 %1$s %2$s°C</string>
|
||||
<string name="scene_condition_desc_humidity">湿度需 %1$s %2$s%%</string>
|
||||
<string name="scene_condition_desc_socket">%1$s 处于 %2$s</string>
|
||||
<string name="scene_condition_desc_time">时间在 %1$s ~ %2$s 之间</string>
|
||||
<string name="scene_device_name_label">设备名称(网关配对标识)</string>
|
||||
<string name="scene_loading_scene">正在加载情景配置…</string>
|
||||
<string name="scene_load_failed">无法加载情景配置。</string>
|
||||
<string name="scene_default_button_power">电源</string>
|
||||
<string name="scene_default_notify_title">情景完成</string>
|
||||
<string name="scene_default_notify_msg">自动化任务执行完成</string>
|
||||
|
||||
<!-- 设备列表 -->
|
||||
<string name="device_list_title">设备列表</string>
|
||||
<string name="device_list_description">选择需要控制或查看状态的 ABox 终端设备。</string>
|
||||
|
||||
@@ -42,6 +42,167 @@
|
||||
<string name="activity_placeholder_title">Activity Log</string>
|
||||
<string name="activity_placeholder_description">No recorded events yet.</string>
|
||||
|
||||
<!-- Scene & Automation strings -->
|
||||
<string name="scene_list_title">Automation & Scenes</string>
|
||||
<string name="scene_tab_all">All</string>
|
||||
<string name="scene_tab_manual">Manual</string>
|
||||
<string name="scene_tab_automatic">Automatic</string>
|
||||
<string name="scene_create_manual">New Manual Command</string>
|
||||
<string name="scene_create_automatic">New Automatic Rule</string>
|
||||
<string name="scene_create_action">New Command</string>
|
||||
<string name="scene_action_count">%1$d actions</string>
|
||||
<string name="scene_edit">Edit Command</string>
|
||||
<string name="scene_delete">Delete Command</string>
|
||||
<string name="scene_empty_title">No automation commands yet</string>
|
||||
<string name="scene_empty_message">Tap the button below to create instant commands or trigger-based automatic rules.</string>
|
||||
<string name="scene_action_run_now">Run Now</string>
|
||||
<string name="scene_toast_executed">Command triggered</string>
|
||||
|
||||
<!-- Scene: delete dialog -->
|
||||
<string name="scene_delete_dialog_title">Delete Command</string>
|
||||
<string name="scene_delete_dialog_message">Are you sure you want to delete this command? This cannot be undone.</string>
|
||||
<string name="scene_delete_confirm">Delete</string>
|
||||
<string name="scene_delete_cancel">Cancel</string>
|
||||
|
||||
<!-- Scene: editor -->
|
||||
<string name="scene_editor_manual_title">Create Manual Command</string>
|
||||
<string name="scene_editor_auto_title">Create Automatic Rule</string>
|
||||
<string name="scene_editor_edit_title">Edit Command</string>
|
||||
<string name="scene_back">Back</string>
|
||||
<string name="scene_name_label">Title</string>
|
||||
<string name="scene_name_hint">Enter title (e.g. Movie Night, High Temp Auto Cooling)</string>
|
||||
<string name="scene_description_label">Description</string>
|
||||
<string name="scene_description_hint">Optional notes or details about this rule</string>
|
||||
|
||||
<!-- Sections -->
|
||||
<string name="scene_section_triggers">Triggers</string>
|
||||
<string name="scene_section_conditions">Conditions (Optional)</string>
|
||||
<string name="scene_section_actions">Actions</string>
|
||||
<string name="scene_section_advanced">Advanced Options</string>
|
||||
<string name="scene_section_other">Other Options & Appearance</string>
|
||||
|
||||
<!-- Add Buttons -->
|
||||
<string name="scene_add_trigger">+ Add Trigger</string>
|
||||
<string name="scene_add_condition">+ Add Condition</string>
|
||||
<string name="scene_add_action_btn">+ Add Action</string>
|
||||
<string name="scene_add_action">Add</string>
|
||||
<string name="scene_save_action">Save Command</string>
|
||||
|
||||
<!-- Strategies & Toggles -->
|
||||
<string name="scene_repeat_strategy">Repeat Execution Strategy</string>
|
||||
<string name="scene_strategy_continue">Continue new task</string>
|
||||
<string name="scene_concurrency_mode">Concurrency Mode</string>
|
||||
<string name="scene_concurrency_sync">Synchronous (Sequential)</string>
|
||||
<string name="scene_concurrency_async">Asynchronous (Parallel)</string>
|
||||
<string name="scene_error_policy">On Error Policy</string>
|
||||
<string name="scene_policy_continue">Continue subsequent actions</string>
|
||||
<string name="scene_policy_abort">Abort remaining actions</string>
|
||||
<string name="scene_appearance_icon">Icon</string>
|
||||
<string name="scene_appearance_color">Icon Background Color</string>
|
||||
<string name="scene_enable_rule">Enable this automatic rule</string>
|
||||
<string name="scene_enable_logging">Enable command execution logs</string>
|
||||
|
||||
<!-- Trigger Types & Dialog -->
|
||||
<string name="scene_dialog_add_trigger_title">Select Trigger Type</string>
|
||||
<string name="scene_trigger_type_time">⏰ Time / Schedule Trigger</string>
|
||||
<string name="scene_trigger_type_temp">🌡️ Temperature Threshold</string>
|
||||
<string name="scene_trigger_type_humidity">💧 Humidity Threshold</string>
|
||||
<string name="scene_trigger_type_device">🔌 Socket State Changed</string>
|
||||
<string name="scene_trigger_time_label">Trigger Time (e.g. 07:30)</string>
|
||||
<string name="scene_trigger_temp_threshold">Temperature Threshold (°C)</string>
|
||||
<string name="scene_trigger_humidity_threshold">Humidity Threshold (%)</string>
|
||||
<string name="scene_operator_label">Condition</string>
|
||||
<string name="scene_operator_gt">Greater than (>)</string>
|
||||
<string name="scene_operator_lt">Less than (<)</string>
|
||||
<string name="scene_operator_eq">Equals (=)</string>
|
||||
|
||||
<!-- Condition Types & Dialog -->
|
||||
<string name="scene_dialog_add_condition_title">Select Condition</string>
|
||||
<string name="scene_condition_type_temp">🌡️ Temperature Range</string>
|
||||
<string name="scene_condition_type_humidity">💧 Humidity Range</string>
|
||||
<string name="scene_condition_type_socket">🔌 Current Socket Power</string>
|
||||
<string name="scene_condition_type_time_range">🕒 Active Time Range</string>
|
||||
<string name="scene_condition_start_time">Start Time (e.g. 22:00)</string>
|
||||
<string name="scene_condition_end_time">End Time (e.g. 07:00)</string>
|
||||
|
||||
<!-- Action Types & Dialog -->
|
||||
<string name="scene_dialog_add_action_title">Select Action</string>
|
||||
<string name="scene_action_type_socket">🔌 Smart Socket Control</string>
|
||||
<string name="scene_action_type_virtual_remote">📺 Infrared Remote Button</string>
|
||||
<string name="scene_action_type_delay">⏱️ Delay / Buffer Timer</string>
|
||||
<string name="scene_action_type_notification">🔔 System Notification</string>
|
||||
<string name="scene_select_socket">Select Target Socket</string>
|
||||
<string name="scene_socket_power_state">Target Power State</string>
|
||||
<string name="scene_select_virtual_remote">Select Virtual Remote</string>
|
||||
<string name="scene_select_remote_button">Select Remote Key</string>
|
||||
<string name="scene_delay_duration_label">Delay Duration (seconds)</string>
|
||||
<string name="scene_notification_title_label">Notification Title</string>
|
||||
<string name="scene_notification_msg_label">Notification Message</string>
|
||||
<string name="scene_unit_seconds">%1$d sec</string>
|
||||
|
||||
<!-- Action Card Displays -->
|
||||
<string name="scene_action_socket">Socket [%1$s]: Set %2$s</string>
|
||||
<string name="scene_action_remote">Remote [%1$s]: Send %2$s</string>
|
||||
<string name="scene_action_infrared">Infrared [%1$s]: Slot %2$s</string>
|
||||
<string name="scene_action_delay">⏱️ Delay %1$d seconds</string>
|
||||
<string name="scene_action_notification">🔔 Notify: %1$s</string>
|
||||
|
||||
<!-- Scene: execution -->
|
||||
<string name="scene_execution_title">Execute Command</string>
|
||||
<string name="scene_execution_run">Run</string>
|
||||
<string name="scene_execution_running">Running: %1$s…</string>
|
||||
<string name="scene_execution_summary">%1$d succeeded, %2$d failed of %3$d actions</string>
|
||||
<string name="scene_execution_done">Execution Completed</string>
|
||||
<string name="scene_execution_duration">Total Elapsed: %1$s ms</string>
|
||||
<string name="scene_step_pending">Pending</string>
|
||||
<string name="scene_step_running">Running…</string>
|
||||
<string name="scene_step_delaying">Waiting (%1$d s)…</string>
|
||||
<string name="scene_step_success">Completed</string>
|
||||
<string name="scene_step_failed">Failed</string>
|
||||
<string name="scene_step_skipped">Skipped</string>
|
||||
|
||||
<!-- Validation & dialog chips / placeholders -->
|
||||
<string name="scene_trigger_time_error">Invalid time format (use HH:mm, e.g. 07:30)</string>
|
||||
<string name="scene_condition_time_error">Invalid time format (use HH:mm, e.g. 22:00)</string>
|
||||
<string name="scene_chip_time">⏰ Schedule</string>
|
||||
<string name="scene_chip_temp">🌡️ Temperature</string>
|
||||
<string name="scene_chip_humidity">💧 Humidity</string>
|
||||
<string name="scene_chip_socket">🔌 Socket</string>
|
||||
<string name="scene_chip_remote">📺 Remote</string>
|
||||
<string name="scene_chip_delay">⏱️ Delay</string>
|
||||
<string name="scene_chip_notify">🔔 Notify</string>
|
||||
<string name="scene_chip_above">> Above</string>
|
||||
<string name="scene_chip_below">< Below</string>
|
||||
<string name="scene_chip_power_on">Turn ON</string>
|
||||
<string name="scene_chip_power_off">Turn OFF</string>
|
||||
<string name="scene_threshold_temp">Target threshold: %1$d °C</string>
|
||||
<string name="scene_threshold_hum">Target threshold: %1$d %%</string>
|
||||
<string name="scene_target_socket_state">Require socket state to be:</string>
|
||||
<string name="scene_no_virtual_remotes">No virtual remotes found; using infrared controller by default.</string>
|
||||
<string name="scene_remote_button_slot_label">Button Name / Slot</string>
|
||||
<string name="scene_remote_button_name_label">Button Name</string>
|
||||
<string name="scene_empty_triggers_hint">No triggers configured. Tap + below to add.</string>
|
||||
<string name="scene_empty_conditions_hint">No conditions configured. Tap + below to add.</string>
|
||||
<string name="scene_empty_actions_hint">No actions configured. Tap + below to add.</string>
|
||||
<string name="scene_summary_triggers_and_actions">⚡ %1$d triggers • %2$d actions</string>
|
||||
<string name="scene_summary_actions_only">%1$d actions</string>
|
||||
<string name="scene_exec_ready_hint">Tap the button below to run immediately</string>
|
||||
<string name="scene_exec_rerun">Re-run</string>
|
||||
<string name="scene_step_format">Step %1$d: %2$s</string>
|
||||
<string name="scene_trigger_desc_temp">Temp %1$s %2$s°C</string>
|
||||
<string name="scene_trigger_desc_humidity">Humidity %1$s %2$s%%</string>
|
||||
<string name="scene_trigger_desc_device">%1$s state changed to %2$s</string>
|
||||
<string name="scene_condition_desc_temp">Temp must be %1$s %2$s°C</string>
|
||||
<string name="scene_condition_desc_humidity">Humidity must be %1$s %2$s%%</string>
|
||||
<string name="scene_condition_desc_socket">%1$s is %2$s</string>
|
||||
<string name="scene_condition_desc_time">Time is between %1$s ~ %2$s</string>
|
||||
<string name="scene_device_name_label">Device Name (Gateway Identifier)</string>
|
||||
<string name="scene_loading_scene">Loading scene...</string>
|
||||
<string name="scene_load_failed">Failed to load scene.</string>
|
||||
<string name="scene_default_button_power">Power</string>
|
||||
<string name="scene_default_notify_title">Scene Completed</string>
|
||||
<string name="scene_default_notify_msg">Automation task executed successfully</string>
|
||||
|
||||
<!-- Device list -->
|
||||
<string name="device_list_title">Device List</string>
|
||||
<string name="device_list_description">Select an ABox terminal device to control or check status.</string>
|
||||
|
||||
Reference in New Issue
Block a user