From 0d927e4bebe9b0e19498b1862b680dffe62eaca0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Thu, 10 Oct 2024 02:49:45 +0000 Subject: [PATCH] Merge #1136 into sdk602patch0626 from refs/changes/1136/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/1136/head: (12 commits squashed) - 绑定弹窗增加按键监听,解决开机动画已经开始,被按键打断问题 - 1.修改查找手表定时器定时器未关闭bug 2.#915,解决,省电模式下,使用查找手表后,手表亮度会默认恢复,亮度不再是最低bug - 解决#966呼吸训练有改动,多了设置分钟,以及开始按钮,有问题。bug - 关闭ChangeSlice中showsStackSliceId打印 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 1.解决呼吸训练过程中出现消息弹窗而取消常亮屏,通过添加runtime解决 2.将呼吸训练常亮屏操作只在开始训练时开启,而不是进入就设置常亮屏 - 解决计时器和秒表图片是相反的问题 - #673,解决蓝牙设备搜索显示框没有自适应显示,导致需要下拉才知道有多个设备bug - 解决,#674蓝牙搜索界面,优化重新搜索字样显示位置bug,(绑定成功界面) - #928,解决,手电筒设置为闪烁,上滑的时候,背景亮度会根据手电筒亮度变bug - 优化蓝牙耳机显示列表 - #523,解决,录音列表,在只有几条不用滑动查看录音的时候,固定界面不允许滑动bug Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1136 --- .../nativelauncher/include/UiConfig.h | 4 +-- .../src/BluetoothCaseListAdapter.cpp | 2 +- .../bluetooth/src/BluetoothDeviceListView.cpp | 8 +++--- .../bluetooth/src/BluetoothItemView.cpp | 26 +++++++++++++++---- .../nativeui/bluetooth/src/BluetoothModel.cpp | 4 +++ .../flashlight/src/FlashlightPresenter.cpp | 4 ++- .../nativeui/message/src/MessageModel.cpp | 7 ++--- .../nativeui/record/src/RecordListView.cpp | 6 ++--- .../record/src/RecordingListAdapter.cpp | 4 +-- .../record/src/RecordingListitemView.cpp | 12 ++++++++- .../include/RespiratoryTrainingModel.h | 4 +-- .../src/RespiratoryTrainingModel.cpp | 9 ++++--- .../src/RespiratoryTrainingPresenter.cpp | 4 +-- .../src/RespiratoryTrainingView.cpp | 7 +++-- .../wearable/nativeabilityfwk/src/Ability.cpp | 2 +- .../include/notify/pairing_notification.h | 5 ++-- .../src/notify/findwatch_notification.cpp | 13 ++++++++-- .../src/notify/pairing_notification.cpp | 12 ++++++++- .../drivers/peripheral/utils/custom_runtime.c | 12 +++++++++ .../drivers/peripheral/utils/custom_runtime.h | 4 +++ 20 files changed, 112 insertions(+), 37 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index cd55ffe1e..9e5c260a0 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -487,8 +487,8 @@ namespace OHOS static constexpr const char *PNG_APPLIST_RECORD_IMAGE = APP_LIST_PATH "/recording.bin"; // 录音 static constexpr const char *PNG_APPLIST_TRAINING_IMAGE = APP_LIST_PATH "/training.bin"; // 训练 static constexpr const char *PNG_APPLIST_TRAINING_RECORD_IMAGE = APP_LIST_PATH "/record.bin"; // 训练记录 - static constexpr const char *PNG_APPLIST_STOPWATCH_IMAGE = APP_LIST_PATH "/clock.bin"; // 秒表 - static constexpr const char *PNG_APPLIST_COUNTDOWN_IMAGE = APP_LIST_PATH "/countdown.bin"; // 计时器 + static constexpr const char *PNG_APPLIST_STOPWATCH_IMAGE = APP_LIST_PATH "/countdown.bin"; // 秒表 + static constexpr const char *PNG_APPLIST_COUNTDOWN_IMAGE = APP_LIST_PATH "/clock.bin"; // 计时器 static constexpr const char *PNG_APPLIST_ALIPAY_IMAGE = APP_LIST_PATH "/alipay.bin"; // 支付宝 static constexpr const char *PNG_APPLIST_FINDPHONE_IMAGE = APP_LIST_PATH "/findphone.bin"; // 查找手机 static constexpr const char *PNG_APPLIST_DISTURB_IMAGE = APP_LIST_PATH "/disturb.bin"; // 勿扰模式 diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothCaseListAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothCaseListAdapter.cpp index 313221db6..51a126bbc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothCaseListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothCaseListAdapter.cpp @@ -176,8 +176,8 @@ UIView *BluetoothCaseListAdapter::GetView(UIView *inView, int16_t index) node->addr[2], node->addr[3], node->addr[4], node->addr[5]); // 没有%s类型,不做返回判断 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "addrTmp %s", addrTmp); // ClickAnimation(itemData, item); - item->SetItemInfo(itemData, true); item->SetViewIndex(index); + item->SetItemInfo(itemData, true); item->SetPairingtatus(); return item; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceListView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceListView.cpp index 263363c7b..e72f7789e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceListView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothDeviceListView.cpp @@ -89,7 +89,7 @@ namespace OHOS list->SetStyle(STYLE_BORDER_RADIUS, 50); list->SetDragACCLevel(5); list->SetSwipeACCLevel(800); - list->SetReboundSize(30); + // list->SetReboundSize(30); // list->SetScrollBlankSize(30); list->SetAdapter(adapterText); } @@ -138,7 +138,7 @@ namespace OHOS return; } } - newEquipmentButton->SetPosition(173, list->GetY() + list->GetHeight() + 20, 120, 40); + newEquipmentButton->SetPosition(173, 390, 120, 40); newEquipmentButton->SetTextId(STR_BT_HEADSET_RESCAN); // 重新搜索 newEquipmentButton->SetViewId(BLUETOOTH_NEWEQUIPMENT_BUTTON); newEquipmentButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); @@ -248,10 +248,10 @@ namespace OHOS list->Resize(380, 250); break; } - newEquipmentButton->SetY(list->GetY() + list->GetHeight() + 20); + // newEquipmentButton->SetY(list->GetY() + list->GetHeight() + 20); list->RefreshList(); list->Invalidate(); - newEquipmentButton->Invalidate(); + // newEquipmentButton->Invalidate(); } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothItemView.cpp index d73c4418a..26ed8385d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothItemView.cpp @@ -101,15 +101,31 @@ namespace OHOS } } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "index = %d", GetViewIndex()); - List &btConnedDevicesList_ = BluetoothModel::GetInstance()->GetConnedDevicesCase(); - std::list &btScansDevicesList_ = BluetoothModel::GetInstance()->GetCase(); - if (GetViewIndex() == btConnedDevicesList_.Size() - 1 || GetViewIndex() == btScansDevicesList_.size() - 1) + if(!isCaseList) { - lineImage.SetVisible(false); + //已连接的耳机界面 + List &btConnedDevicesList_ = BluetoothModel::GetInstance()->GetConnedDevicesCase(); + if (GetViewIndex() == btConnedDevicesList_.Size() - 1) + { + lineImage.SetVisible(false); + } + else + { + lineImage.SetVisible(true); + } } else { - lineImage.SetVisible(true); + //搜索出耳机的界面 + std::list &btScansDevicesList_ = BluetoothModel::GetInstance()->GetCase(); + if (GetViewIndex() == btScansDevicesList_.size() - 1) + { + lineImage.SetVisible(false); + } + else + { + lineImage.SetVisible(true); + } } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp index 0a9b3c13c..1a5f74375 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp @@ -323,6 +323,10 @@ void BluetoothModel::AddCase(BluetoothCaseInfo caseInfo) return; } else { btScansDevicesList_.push_back(caseInfo); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "btScansDevicesList_ num = %d",btScansDevicesList_.size()); + if(BluetoothEarListView::GetInstance()) //动态计算扫描出来的设备列表ui高度 + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&BluetoothEarListView::RefreshBluetoothEarListView, BluetoothEarListView::GetInstance())); } } //设置设备的信号强度 diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp index 1fa3fb3fa..8cbb45480 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-10 17:32:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-23 11:13:30 + * @LastEditTime: 2024-10-09 17:19:01 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightPresenter.cpp */ @@ -14,6 +14,7 @@ #include "common/key_code.h" #include #include "gfx_utils/mem_check.h" +#include "ConfigModel.h" namespace OHOS { @@ -196,6 +197,7 @@ namespace OHOS } else { + uapi_setScreenBrightness(ConfigModel::GetInstance()->GetBrightness());//滑动到手电筒设置页面需要将亮度恢复到ConfigModel中设置的亮度值 FlashlightModel::GetInstance().FlashlightStopTimer(); ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp index e98fd091f..49e0d4b0f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp @@ -1,7 +1,7 @@ /* * @Date: 2024-06-21 09:56:18 - * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-06-22 15:32:37 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-10-09 14:53:41 * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageModel.cpp */ @@ -130,10 +130,11 @@ extern "C" delete messageInfo; // 释放内存 // 发送信息进行弹窗 - if(uapi_dev_runtime_get_train_status()||uapi_dev_runtime_get_saveele_status()) + if(uapi_dev_runtime_get_train_status()||uapi_dev_runtime_get_saveele_status()|| uapi_dev_runtime_get_respiratory_training_status()) { //增加训练模式下,不弹窗 //省电模式,不弹窗 + //呼吸训练,不弹窗 return; } CustomEventPublish(TOPIC_EVENT_MESSAGENOTE, NULL, 0); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp index 4075e9ea7..7dc74799e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-27 09:16:50 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-30 17:06:25 + * @LastEditTime: 2024-10-09 17:53:56 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordListView.cpp */ @@ -284,8 +284,8 @@ namespace OHOS recordList->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。 recordList->SetDragACCLevel(5); recordList->SetSwipeACCLevel(800); /*设置手指抬起屏幕后的补偿距离。*/ - recordList->SetReboundSize(30); - recordList->SetScrollBlankSize(20); + // recordList->SetReboundSize(30); + // recordList->SetScrollBlankSize(20); recordList->SetIntercept(true); // 设置是否拦截输入事件。如果被截获,视图在本地处理后不会将输入事件传递给父视图。 recordList->SetAdapter(p_RecordingListAdapter); RecordListScrollView->Add(recordList); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListAdapter.cpp index e8cebf9d0..1e8faa61c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListAdapter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-31 09:26:00 + * @LastEditTime: 2024-10-09 18:11:09 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListAdapter.cpp */ #include "record/include/RecordingListAdapter.h" @@ -80,9 +80,9 @@ namespace OHOS { item = static_cast(inView); } + item->SetViewIndex(index); item->SetItemInfo(itemData); item->SetOnClickListener(itemClickListener); - item->SetViewIndex(index); return item; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp index 1b8b9c776..1dd8fa2a4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp @@ -2,10 +2,11 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-02 20:10:18 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-05 10:45:23 + * @LastEditTime: 2024-10-09 18:22:24 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingListitemView.cpp */ #include "record/include/RecordingListitemView.h" +#include "record/include/RecordingModel.h" #include "wearable_log.h" namespace OHOS @@ -41,6 +42,15 @@ namespace OHOS m_recordId.SetText(itemInfo.recordId.c_str()); m_recordTotalTime.SetText(itemInfo.recordTotalTime); m_recordTime.SetText(itemInfo.recordTime); + //防止list中元素超过3个后最后一个被遮住,且仅在最后一个元素设置其高度为160 + if (RecordingModel::GetInstance()->GetRecordingListNum() > 2 && GetViewIndex() == RecordingModel::GetInstance()->GetRecordingListNum() - 1) + { + SetHeight(160); + } + else + { + SetHeight(120); + } } void RecordingListitemView::SetUpChild() diff --git a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/RespiratoryTrainingModel.h b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/RespiratoryTrainingModel.h index 41e978783..a6ad2c5d6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/RespiratoryTrainingModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/RespiratoryTrainingModel.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-11 16:26:13 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-04 19:59:41 + * @LastEditTime: 2024-10-09 12:22:31 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/RespiratoryTrainingModel.h */ #ifndef RESPIRATORY_TRAINING_MODEL_H @@ -23,7 +23,7 @@ namespace OHOS void calculateHeartrateTotal(void); void ResumeStatus(); - void RT_StartTimer(uint32_t interval); + void RT_StartTimer(uint64_t interval); void RT_StopTimer(void); int GetRespiratoryTrainingSelectTime(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp index 47a4435c1..d054f787f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-11 16:26:20 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-04 20:05:04 + * @LastEditTime: 2024-10-09 15:09:06 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp */ #include "respiratorytraining/include/RespiratoryTrainingModel.h" @@ -24,6 +24,7 @@ #include #include #include +#include namespace OHOS { // 声明定时器变量 @@ -60,7 +61,7 @@ namespace OHOS { int time = RespiratoryTrainingModel::GetInstance().GetRespiratoryTrainingSelectTime(); uint64_t time_; - switch (time_) + switch (time) { case 1: time_ = ONE_MIN; @@ -146,6 +147,7 @@ namespace OHOS heartTotal = 0; count = 0; HeartModel::GetInstance()->Heart_Control(HeartState::End, HeartCheck::INITIATIVE); // 关闭心率检测 + uapi_dev_runtime_set_respiratory_training_status(0); // 如果直接退出也要设置为0 } /* -------------------------------------------------------------------------- */ /*定时器到期时的处理*/ @@ -157,6 +159,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_RespiratoryTrainingView is nullptr!!"); return; } + uapi_dev_runtime_set_respiratory_training_status(0); // 训练结束runtime设置为0 RespiratoryTrainingModel::GetInstance().RT_StopTimer(); // 停止定时器 RespiratoryTrainingModel::GetInstance().AddRespiratoryTrainingTimes(); // 呼吸训练次数加1 p_RespiratoryTrainingView->GetRespiratoryTrainingAnimator_()->Stop(); // 关闭呼吸动画 @@ -178,7 +181,7 @@ namespace OHOS * @brief 开启定时器函数 * @param interval 时间间隔,单位ms */ - void RespiratoryTrainingModel::RT_StartTimer(uint32_t interval) + void RespiratoryTrainingModel::RT_StartTimer(uint64_t interval) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RespiratoryTrainingModel::RT_StartTimer"); /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回 ------------------------- */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp index 739027423..d7c988c62 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:26:06 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-05 12:30:08 + * @LastEditTime: 2024-10-09 15:08:31 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/RespiratoryTraining/src/RespiratoryTrainingPresenter.cpp */ @@ -49,7 +49,7 @@ namespace OHOS void RespiratoryTrainingPresenter::OnStart() { Presenter::OnStart(); - ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); + // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } void RespiratoryTrainingPresenter::OnPause(void) diff --git a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp index 8e5f8d00f..64289037c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-05 12:37:07 + * @LastEditTime: 2024-10-09 15:07:50 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/RespiratoryTraining/src/RespiratoryTrainingView.cpp */ @@ -15,6 +15,8 @@ #include "respiratorytraining/include/RespiratoryTrainingModel.h" #include "heartrate/include/HeartModel.h" #include "vibrator_service.h" +#include +#include namespace OHOS { @@ -242,7 +244,8 @@ namespace OHOS RespiratoryTrainingStartNote_->SetVisible(true); RespiratoryTrainingImg_->SetVisible(true); } - + ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON);//开始训练后常亮屏 + uapi_dev_runtime_set_respiratory_training_status(1); // 训练开始runtime设置为1 StartRespiratoryTraining(); // 开始呼吸训练 HeartModel::GetInstance()->Heart_Control(HeartState::Start, HeartCheck::INITIATIVE); // 开启心率检测 RespiratoryTrainingModel::GetInstance().RT_StartTimer(RespiratoryTrainingModel::GetInstance().GetRespiratoryTrainingTime()); // 开启定时器 diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp index c2a1dd57a..c784476aa 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp @@ -144,7 +144,7 @@ namespace OHOS if(id!=VIEW_INCOMING_CALL) make_phone_push(id); } - showsStackSliceId(); + // showsStackSliceId(); /* if (GetCurSliceId() == targetSliceId) { return; diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h index 152fcc9e4..16449010e 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 09:48:07 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-11 17:22:48 + * @LastEditTime: 2024-10-09 09:54:34 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/pairing_notification.h */ #ifndef PAIRING_NOTIFICATION_H @@ -18,11 +18,12 @@ namespace OHOS void FreeDeviceBindingView(void); void FreeDeviceUnBindingView(void); void FreeDeviceUnbindingRequestGroupView(void); - class PairingViewEventListener : public OHOS::UIView::OnClickListener + class PairingViewEventListener : public OHOS::UIView::OnClickListener,public RootView::OnKeyActListener { public: static PairingViewEventListener &GetInstance(void); bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override; + bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 void SetDeviceName(char *Name); char *GetDeviceName(); void DeviceUnBindingViewIsVisible(bool state); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index 3db3e3ad6..dcf393dd6 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:33:47 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-14 17:31:21 + * @LastEditTime: 2024-10-09 11:21:37 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。 * 以下是基本的实现步骤: @@ -172,7 +172,15 @@ namespace OHOS const power_display_svr_api_t *display_api = power_display_svr_get_api(); if (display_api) { - int brightnessValue = ConfigModel::GetInstance()->GetBrightness(); + int brightnessValue; + if(uapi_dev_runtime_get_saveele_status()) //如果是省电模式状态下退出要把亮度设置为最低 + { + brightnessValue = 51; + } + else + { + brightnessValue= ConfigModel::GetInstance()->GetBrightness(); + } if (display_api->set_brightness(brightnessValue) != ERRCODE_SUCC) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FindWatchViewEventListener] resume_brightness fail!"); @@ -488,6 +496,7 @@ namespace OHOS } FindWatchViewEventListener::GetInstance().ResumeScreenBrightness(); + FindWatchViewEventListener::GetInstance().FindWatch_StopTimer(); } /* ----------------------- FindWatchRingPlayerListener ---------------------- */ diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp index e6090d89d..4ac3cc243 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 10:04:36 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-08 16:33:30 + * @LastEditTime: 2024-10-09 10:08:29 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp */ #include "notification_manager.h" @@ -163,6 +163,10 @@ namespace OHOS return false; } DeviceUnbindingRequestGroupView->SetVisible(false); + /* -------------------------------------------------------------------------- */ + RootView::GetInstance()->ClearOnKeyActListener(); + RootView::GetInstance()->SetOnKeyActListener(this); + /* -------------------------------------------------------------------------- */ RootView::GetInstance()->Add(ShutDownImageAnimatorGroupView); } ShutDownImageAnimatorView::GetInstance()->ShutDownImageAnimator_Start(3); @@ -175,6 +179,12 @@ namespace OHOS return true; } + bool PairingViewEventListener::OnKeyAct(UIView &view, const KeyEvent &event) // 增加按键事件 + { + //消耗按键事件 + return true; + } + static UIButton *CreateButton(unsigned int x, unsigned int y, unsigned int w, unsigned int h, const char *imageSrc) { UIButton *button = new UIButton(); diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.c b/code/sdk/drivers/peripheral/utils/custom_runtime.c index 253e3417e..8da01feb6 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.c +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.c @@ -95,6 +95,8 @@ typedef struct uint8_t lock_flag_sleep;//睡眠 uint8_t lock_flag_goal;//每日目标数据 5个数据一起锁 + + uint8_t respiratory_training_status;//呼吸训练开始状态 } runtime_status_t; @@ -416,6 +418,16 @@ uint8_t uapi_dev_runtime_get_motion_recognition_status(void) return g_runtime.motion_recognition_status; } +//设置呼吸训练状态 +void uapi_dev_runtime_set_respiratory_training_status(uint8_t status) +{ + g_runtime.respiratory_training_status = status; +} +uint8_t uapi_dev_runtime_get_respiratory_training_status(void) +{ + return g_runtime.respiratory_training_status; +} + // sleep mode flag void uapi_sleep_mode_flag_set(uint8_t flag) { diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.h b/code/sdk/drivers/peripheral/utils/custom_runtime.h index 0360c8e62..491376a3f 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.h @@ -162,6 +162,10 @@ uint8_t uapi_dev_runtime_get_goal_storage_status(void); void uapi_dev_runtime_set_motion_recognition_status(uint8_t status); uint8_t uapi_dev_runtime_get_motion_recognition_status(void); + +//呼吸训练 +void uapi_dev_runtime_set_respiratory_training_status(uint8_t status); +uint8_t uapi_dev_runtime_get_respiratory_training_status(void); /***************************************cat1 runtime 变量设置获取函数**************************************************/ -- 2.17.1