From c1beb3b4134b46d65a1cf576680bcb1d6660a112 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Fri, 16 Aug 2024 01:25:32 +0000 Subject: [PATCH] Merge #703 into sdk602patch0626 from refs/changes/703/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/703/head: (12 commits squashed) - 1.呼吸训练在训练结束取消常亮屏 - 暂时关闭AI界面的常亮操作 - 指南针界面关闭常亮屏 - 蓝牙耳机界面中“蓝牙耳机设备未找到视图”优化修改。 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 查看已连接的蓝牙耳机视图UI修改 - 修改powerKey的返回条件为(powerKey&&按键按下&&亮屏状态),存在长按power键进入关机页面会先退出当前页面bug - 修复错误关闭了单击切换AI模型功能 - 功能键优化,修复在进入AI模型界面中切换模型时候屏幕息屏 - 优化久坐提醒 - AI语音的按钮背景与图片更新 - AI语音已经对照figma修改完成 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/703 --- .../add_card/src/AddCardPresenter.cpp | 2 +- .../aimodels/src/AiModelsPresenter.cpp | 2 +- .../nativeui/aivoice/include/AiVoiceView.h | 12 +- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 26 +- .../nativeui/aivoice/src/AiVoiceView.cpp | 74 ++- .../aivoice/src/apikeys/ApiKeysPresenter.cpp | 28 +- .../nativeui/alarm/src/AlarmPresenter.cpp | 2 +- .../src/BloodDetectionPresenter.cpp | 2 +- .../bluetooth/include/BluetoothItemView.h | 14 +- .../bluetooth/include/BluetoothModel.h | 9 +- .../bluetooth/include/BluetoothOptionsView.h | 75 ++- .../bluetooth/include/BluetoothPresenter.h | 4 +- .../bluetooth/include/TipsFailMessageView.h | 49 +- .../nativeui/bluetooth/src/BluetoothModel.cpp | 5 + .../bluetooth/src/BluetoothOptionsView.cpp | 513 ++++++++++++------ .../bluetooth/src/BluetoothPresenter.cpp | 5 +- .../bluetooth/src/MainBluetoothView.cpp | 4 +- .../bluetooth/src/TipsFailMessageView.cpp | 281 ++++++---- .../src/BrightnessLevelPresenter.cpp | 2 +- .../src/BluetoothServiceOptionsPresenter.cpp | 2 +- .../src/ClassicBlueToothPresenter.cpp | 2 +- .../compass/src/MainCompassPresenter.cpp | 8 +- .../countdown/src/MainCountDownPresenter.cpp | 2 +- .../src/DisplayBrightnessPresent.cpp | 2 +- .../dnotdisturb/src/DnotDisturbPresenter.cpp | 2 +- .../findphone/src/FindPhonePresenter.cpp | 2 +- .../flashlight/src/FlashlightPresenter.cpp | 2 +- .../nativeui/goal/src/Maingoalpresenter.cpp | 2 +- .../heartrate/src/HeartDetectionPresenter.cpp | 2 +- .../heartrate/src/HeartResultPresenter.cpp | 2 +- .../src/LanguageSwitchPresenter.cpp | 2 +- .../nativeui/message/src/MessagePresenter.cpp | 2 +- .../message/src/MessageShowPresenter.cpp | 2 +- .../src/MotionRecognitionPresenter.cpp | 2 +- .../musicplayer/src/MusicPlayerPresenter.cpp | 2 +- .../src/NetworkAndCallPresenter.cpp | 2 +- .../obumessage/src/OBUMessagePresenter.cpp | 2 +- .../phone/src/DialingMethodPresenter.cpp | 2 +- .../nativeui/phone/src/MainPhonePresenter.cpp | 2 +- .../nativeui/phone/src/PhoneCallPresenter.cpp | 2 +- .../nativeui/phone/src/PhoneDirPresenter.cpp | 2 +- .../nativeui/player/include/PlayersView.h | 4 +- .../nativeui/player/src/PlayersPresenter.cpp | 4 +- .../nativeui/player/src/PlayersView.cpp | 52 ++ .../src/RebootAndShutdownModel.cpp | 19 +- .../src/RebootAndShutdownPresenter.cpp | 2 +- .../rebootdevice/src/RebootPresenter.cpp | 2 +- .../record/src/RecordingPresenter.cpp | 2 +- .../src/RespiratoryTrainingModel.cpp | 4 +- .../src/RespiratoryTrainingPresenter.cpp | 4 +- .../nativeui/saveele/src/SaveElePresenter.cpp | 2 +- .../src/SecondaryFunctionPresenter.cpp | 2 +- .../set_dial/src/SetDialPresenter.cpp | 2 +- .../src/SetDialStylePresenter.cpp | 2 +- .../settings/src/SettingPresenter.cpp | 4 +- .../sleep/src/SleepControlPresenter.cpp | 2 +- .../src/CallVolumePresenter.cpp | 2 +- .../src/SoundAndVibrationPresenter.cpp | 2 +- .../src/SystemVolumePresenter.cpp | 2 +- .../stopwatch/src/MainStopWatchPresenter.cpp | 2 +- .../nativeui/system/src/SystemPresenter.cpp | 2 +- .../src/SystemUpdatePresenter.cpp | 2 +- .../takephotos/src/TakephotosPresenter.cpp | 2 +- .../themestyle/src/ThemeStylePresenter.cpp | 2 +- .../traing/src/TraingEnddataPresenter.cpp | 2 +- .../traing/src/TraingNomalPresenter.cpp | 2 +- .../traing/src/TraingSetPresenter.cpp | 2 +- .../src/TraingAquaticPresenter.cpp | 2 +- .../src/TraingBallPresenter.cpp | 2 +- .../src/TraingDancePresenter.cpp | 2 +- .../src/TraingFitnessPresenter.cpp | 2 +- .../src/TraingIcePresenter.cpp | 2 +- .../src/TraingLimitPresenter.cpp | 2 +- .../src/TraingMorePresenter.cpp | 2 +- .../src/TraingOtherPresenter.cpp | 2 +- .../src/TraingRestPresenter.cpp | 2 +- .../src/TraingRecordPresenter.cpp | 2 +- .../watchQRcode/src/WatchQRCodePresenter.cpp | 2 +- .../weather/src/MainWeatherPresenter.cpp | 2 +- .../msg_center/src/msg_center_customer.cpp | 9 +- .../notify/sedentaryReminder_notification.cpp | 1 + .../fs/user/res/AIVoice/ai_chart_icon.bin | 3 + .../fs/user/res/AIVoice/ai_chart_icon_bg.bin | 3 + .../res/AIVoice/aimodels/aimodels_chatgpt.bin | 2 +- .../res/AIVoice/aimodels/aimodels_kimi.bin | 2 +- 85 files changed, 875 insertions(+), 457 deletions(-) create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/ai_chart_icon.bin create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/ai_chart_icon_bg.bin diff --git a/code/sdk/application/wearable/fd230app/nativeui/add_card/src/AddCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/add_card/src/AddCardPresenter.cpp index 7da737cc0..893e4ccf2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/add_card/src/AddCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/add_card/src/AddCardPresenter.cpp @@ -139,7 +139,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { // 回退 NativeAbility::GetInstance().Back(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/aimodels/src/AiModelsPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aimodels/src/AiModelsPresenter.cpp index 07a338b2f..876c9a0eb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aimodels/src/AiModelsPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aimodels/src/AiModelsPresenter.cpp @@ -139,7 +139,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h index 1a5aeb436..62bddd874 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-08 09:36:01 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-09 20:14:30 + * @LastEditTime: 2024-08-15 18:58:40 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/include/AiVoiceView.h */ #ifndef AI_VOICE_VIEW_H @@ -159,13 +159,15 @@ namespace OHOS void ClearAll(void); void SetComponentVisibility(UIView *component, bool isVisible); UILabelExt *title{nullptr}; /*标题*/ - UILabelExt *startChatLabel{nullptr}; /*开始对话标签*/ + UILabelExt *startChatLabel{nullptr}; /*开始对话标签,暂时不用*/ UIButton *startChatButton{nullptr}; /*开始对话按钮*/ - UILabelExt *chatLabel{nullptr}; /*对话标签*/ + UILabelExt *chatLabel{nullptr}; /*对话标签,暂时不用*/ UIButton *chatButton{nullptr}; /*对话按钮*/ UIImageView *aiModelImage{nullptr}; /*ai模型图片*/ - UILabelExt *apiKeysLabel{nullptr}; /*API Keys标签*/ - UIButton *apiKeysButton{nullptr}; /*API Keys按钮*/ + UIImageView *buttonBgImage{nullptr}; /*按钮背景图片*/ + UIImageView *upImage{nullptr}; /*上拉箭头*/ + UILabelExt *apiKeysLabel{nullptr}; /*API Keys标签,暂时不用*/ + UIButton *apiKeysButton{nullptr}; /*API Keys按钮,,暂时不用*/ UIPicker *aiModelPicker{nullptr}; /*ai模型选择器*/ UIScrollView *AiVoiceScrollView[MAX_AIVOICE_VIEWID]{nullptr}; bool viewInitStatus{false}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp index e45741911..6f09ea77d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:11:17 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-09 20:23:58 + * @LastEditTime: 2024-08-15 18:53:14 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp */ #include "AppViewIDs.h" @@ -58,7 +58,7 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStart"); Presenter::OnStart(); - ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); + // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } // 页面已经展示后的调用逻辑 @@ -84,7 +84,7 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoicePresenter::OnStop"); Presenter::OnStop(); - ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); + // ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); model->StatusResume(); } @@ -265,7 +265,7 @@ namespace OHOS ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ return true; } - else if (viewId == AIVOICE_APIKEYS_BUTTON_VIEW_ID) // 如果点击的是API Keys按钮 + else if (viewId == AIVOICE_APIKEYS_BUTTON_VIEW_ID) // 如果点击的是API Keys按钮(注:暂时不用) { if (model->IsExistOpenAIAPIKeys() == true) { @@ -361,11 +361,11 @@ namespace OHOS { return false; } - if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT) + if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT) /*左滑*/ { DragRightToLetfChangeAIModel(); } - else if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && AiVoicePresenter::X_DRAG_FLAG) + else if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && AiVoicePresenter::X_DRAG_FLAG) /*右滑*/ { if (scrollView == view_->GetAiVoiceScrollView(AIVOICE_STARTCHAT_VIEWID)) { @@ -405,6 +405,18 @@ namespace OHOS } AiVoicePresenter::X_DRAG_FLAG = false; } + else if (model->GetAiModelTextId() == STR_AIMODES_CHATGPT && event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP) /*上滑*/ + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DIRECTION_BOTTOM_TO_TOP"); + if (model->IsExistOpenAIAPIKeys() == true) + { + ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_SETAPIKEYS); /*开始对话界面->API Keys set界面*/ + } + else + { + ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_NOTSETAPIKEYS); /*开始对话界面->API Keys notset界面*/ + } + } return true; } @@ -415,7 +427,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp index 63a19962b..7ecc61fef 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-03 16:45:06 + * @LastEditTime: 2024-08-15 19:05:26 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/AiVoice/src/AiVoiceView.cpp */ #include "aivoice/include/AiVoicePresenter.h" @@ -76,6 +76,12 @@ namespace OHOS delete aiModelPicker; aiModelPicker = nullptr; + delete buttonBgImage; + buttonBgImage = nullptr; + + delete upImage; + upImage = nullptr; + delete AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]; AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID] = nullptr; } @@ -182,8 +188,8 @@ namespace OHOS button->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h); button->SetViewId(buttonconfig.ViewId); button->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c); - button->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED); + button->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0x00, UIButton::PRESSED); button->SetOnTouchListener(presenter_); return button; @@ -293,7 +299,34 @@ namespace OHOS aiModelImage->SetTouchable(true); aiModelImage->SetViewId(AIVOICE_IMGAE_VIEW_ID); aiModelImage->SetOnClickListener(presenter_); - + /* -------------------------------- buttonBgImage -------------------------------- */ + imagecinfig = { + .x = 208, + .y = 340, + .w = 48, + .h = 56, + .src = "/user/res/AIVoice/ai_chart_icon.bin", + }; + buttonBgImage = AiVoiceViewImageView(imagecinfig); + if (buttonBgImage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::aiModelImage is nullptr!!"); + return false; + } + /* --------------------------------- upImage -------------------------------- */ + imagecinfig = { + .x = 213, + .y = static_cast(buttonBgImage->GetY() + buttonBgImage->GetHeight() + 10), + .w = 40, + .h = 40, + .src = "/user/res/Sleep/up.bin", + }; + upImage = AiVoiceViewImageView(imagecinfig); + if (upImage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceView::aiModelImage is nullptr!!"); + return false; + } return true; } @@ -302,10 +335,10 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AiVoiceView::CreateAiVoiceViewButton"); /* ----------------------------- startChatButton ---------------------------- */ ButtonConfig buttonconfig = { - .x = 93, - .y = 320, - .w = 280, - .h = 90, + .x = 43, + .y = 328, + .w = 380, + .h = 80, .ViewId = AIVOICE_START_CHAT_BUTTON_VIEW_ID, }; startChatButton = AiVoiceViewButtonInit(buttonconfig); @@ -315,12 +348,14 @@ namespace OHOS return false; } startChatButton->SetVisible(false); + const char *image = "/user/res/AIVoice/ai_chart_icon_bg.bin"; + startChatButton->SetImageSrc(image, image); /* ------------------------------- chatButton ------------------------------- */ buttonconfig = { - .x = 58, - .y = 320, - .w = 170, - .h = 90, + .x = 43, + .y = 328, + .w = 380, + .h = 80, .ViewId = AIVOICE_CHAT_BUTTON_VIEW_ID, }; chatButton = AiVoiceViewButtonInit(buttonconfig); @@ -330,6 +365,7 @@ namespace OHOS return false; } chatButton->SetVisible(false); + chatButton->SetImageSrc(image, image); /* ------------------------------ apiKeysButton ----------------------------- */ buttonconfig = { .x = 238, @@ -372,8 +408,8 @@ namespace OHOS aiModelPicker->RequestFocus(); aiModelPicker->RegisterSelectedListener(presenter_); aiModelPicker->SetTextColor(Color::GetColorFromRGBA(0x00, 0x00, 0x00, 0xff), Color::GetColorFromRGBA(0xff, 0x00, 0x00, 0xff)); - const char *uiPicker1Data[] = {"0", "1", "2", "3"}; - aiModelPicker->SetValues(uiPicker1Data, 4); + const char *uiPicker1Data[] = {"0", "1", "2", "3", "4", "5"}; + aiModelPicker->SetValues(uiPicker1Data, sizeof(uiPicker1Data) / sizeof(uiPicker1Data[0])); } return true; @@ -415,6 +451,8 @@ namespace OHOS AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(chatLabel); AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(apiKeysButton); AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(apiKeysLabel); + AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(buttonBgImage); + AiVoiceScrollView[AIVOICE_STARTCHAT_VIEWID]->Add(upImage); } void AiVoiceView::OnStart() @@ -780,11 +818,11 @@ namespace OHOS bool isAiModeChatGpt = (AiVoiceModel::GetInstance().GetAiModelTextId() == STR_AIMODES_CHATGPT); SetComponentVisibility(chatButton, isAiModeChatGpt); - SetComponentVisibility(chatLabel, isAiModeChatGpt); - SetComponentVisibility(apiKeysButton, isAiModeChatGpt); - SetComponentVisibility(apiKeysLabel, isAiModeChatGpt); + // SetComponentVisibility(chatLabel, isAiModeChatGpt); + // SetComponentVisibility(apiKeysButton, isAiModeChatGpt); + // SetComponentVisibility(apiKeysLabel, isAiModeChatGpt); - SetComponentVisibility(startChatLabel, !isAiModeChatGpt); + // SetComponentVisibility(startChatLabel, !isAiModeChatGpt); SetComponentVisibility(startChatButton, !isAiModeChatGpt); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/apikeys/ApiKeysPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/apikeys/ApiKeysPresenter.cpp index 8fac1a678..cc07de1d1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/apikeys/ApiKeysPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/apikeys/ApiKeysPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-29 16:14:16 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-30 15:52:11 + * @LastEditTime: 2024-08-15 18:26:04 * @FilePath: /xts_origin/FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/apikeys/ApiKeysPresenter.cpp */ @@ -80,24 +80,38 @@ namespace OHOS UNUSED(view); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApiKeysPresenter::OnDragEnd"); std::string viewId = view.GetViewId(); - + AiVoiceView *p_AiVoiceView = AiVoiceView::GetInstance(); + if (p_AiVoiceView == nullptr) + { + return false; + } if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && X_DRAG_FLAG) { - AiVoiceView *p_AiVoiceView = AiVoiceView::GetInstance(); - std::map> viewMap = { - {SETAPIKEYS_SCROLLVIEW_VIEWID, {AIVOICE_SETAPIKEYS, AIVOICE_STARTCHAT_VIEWID}}, - {NOTSETAPIKEYS_SCROLLVIEW_VIEWID, {AIVOICE_NOTSETAPIKEYS, AIVOICE_STARTCHAT_VIEWID}}, + // {SETAPIKEYS_SCROLLVIEW_VIEWID, {AIVOICE_SETAPIKEYS, AIVOICE_STARTCHAT_VIEWID}}, + // {NOTSETAPIKEYS_SCROLLVIEW_VIEWID, {AIVOICE_NOTSETAPIKEYS, AIVOICE_STARTCHAT_VIEWID}}, {APIKEYS_DELETE_SCROLLVIEW_VIEWID, {AIVOICE_APIKEYS_DELETE, AIVOICE_SETAPIKEYS}}, }; auto it = viewMap.find(viewId); - if (it != viewMap.end() && p_AiVoiceView != nullptr) + if (it != viewMap.end()) { p_AiVoiceView->ChangeView(it->second.first, it->second.second); } X_DRAG_FLAG = false; } + else if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM) /*下滑*/ + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DIRECTION_TOP_TO_BOTTOM"); + if (viewId == SETAPIKEYS_SCROLLVIEW_VIEWID) + { + p_AiVoiceView->ChangeView(AIVOICE_SETAPIKEYS, AIVOICE_STARTCHAT_VIEWID); /*API Keys set界面->开始对话界面*/ + } + else if (viewId == NOTSETAPIKEYS_SCROLLVIEW_VIEWID) + { + p_AiVoiceView->ChangeView(AIVOICE_NOTSETAPIKEYS, AIVOICE_STARTCHAT_VIEWID); /*API Keys notset界面->开始对话界面*/ + } + } return true; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp index 186a213ce..37f304cdd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmPresenter.cpp @@ -437,7 +437,7 @@ bool AlarmPresenter::OnKeyAct(UIView &view, const KeyEvent &event) uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp index 5d553f408..fd8713335 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodDetectionPresenter.cpp @@ -113,7 +113,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NavigateBack(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothItemView.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothItemView.h index 602897b2a..bfddc3f49 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothItemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothItemView.h @@ -1,10 +1,12 @@ /* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: BluetoothItem view - * Author: - * Create: 2021-10-13 + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-05 15:20:01 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-15 14:19:01 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothItemView.h */ + #ifndef BLUETOOTH_ITEM_VIEW_H #define BLUETOOTH_ITEM_VIEW_H @@ -35,9 +37,9 @@ private: ImageAnimatorInfo connectImageInfo[BLUETOOTH_CONNECT_IMAGE_NUM]; UIImageView image; UIButton button; - UILabel connectStateLabel; + UILabel connectStateLabel;/*连接状态标签*/ UILabel namelabel; - UIImageAnimatorView connectionAnimator; + UIImageAnimatorView connectionAnimator; /*连接动画*/ BluetoothCaseInfo itemInfo_{}; void BtConnectImageAnimator(); }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothModel.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothModel.h index 1857e0547..86ba57544 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothModel.h @@ -24,10 +24,11 @@ typedef enum : uint16_t { CALLERPLAYERS, } CallerFactor; +/*整合和存储与蓝牙设备相关的各种信息*/ typedef struct { unsigned char deviceName[BD_NAME_LEN]; /* Name of the device record, must be in UTF-8 */ - unsigned char addr[BD_ADDR_LEN]; - int16_t index; + unsigned char addr[BD_ADDR_LEN]; /*存储蓝牙设备的地址*/ + int16_t index;/*用于表示设备在某个特定列表或数据结构中的索引位置。*/ int16_t connIndex; int16_t temp; } BluetoothCaseInfo; @@ -94,8 +95,8 @@ private: void SetUpListCase(); void SetUpConnedDevicesList(); bool FindNameByAddr(BluetoothCaseInfo &listInfo, BluetoothCaseInfo *caseInfo); - bool aclConnected{false}; - BluetoothCaseInfo tempMacValue{}; + bool aclConnected{false};/*ACL(Asynchronous Connectionless,异步无连接)连接状态*/ + BluetoothCaseInfo tempMacValue{};/*临时蓝牙设备地址*/ bd_addr_t lastConnedAddr{}; bd_addr_t remoteConnectAddr{0}; BluetoothItemView *selectItemView{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothOptionsView.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothOptionsView.h index 7a6d17469..2f5294741 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothOptionsView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothOptionsView.h @@ -1,8 +1,10 @@ /* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: BluetoothOptions view - * Author: - * Create: 2021-10-13 + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-05 15:20:01 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-15 10:18:02 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothOptionsView.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ #ifndef BLUETOOTH_OPTIONS_VIEW_H #define BLUETOOTH_OPTIONS_VIEW_H @@ -10,34 +12,47 @@ #include "components/ui_view_group.h" #include "components/ui_label.h" #include "components/ui_label_ext.h" -#include "components/ui_label_button.h" +#include "components/ui_label_button_ext.h" #include "components/ui_image_animator.h" #include "BluetoothCaseListAdapter.h" -namespace OHOS { -class BluetoothOptionsView { -public: - BluetoothOptionsView(); - ~BluetoothOptionsView(); - static BluetoothOptionsView *GetInstance(); - UIViewGroup *InitShowUpView(void); - UILabelButton *GetOptionsOneButton(void); - UILabelButton *GetUnpairButton(void); - void SetUnpair(void); - void SetBtconnect(void); - void SetBtDisconnect(void); - void SetCurrentAddr(bd_addr_t addr); - bd_addr_t GetCurrentAddr(void); - void RefreshText(void); -private: - void InItTitleLabel(void); - void InItLabelButton(void); - UILabelButton *optionsOneButton{nullptr}; - UILabelButton *unpairButton{nullptr}; - UILabel *titleLabel{nullptr}; - UILabel *connectStateLabel{nullptr}; - UIViewGroup *group{nullptr}; - bd_addr_t currentAddr; -}; +namespace OHOS +{ + // 已连接的蓝牙耳机设备视图 + class BluetoothOptionsView + { + public: + BluetoothOptionsView(); + ~BluetoothOptionsView(); + static BluetoothOptionsView *GetInstance(); + UIViewGroup *CreateBluetoothOptionsView(void); + UILabelButtonExt *GetOptionsOneButton(void); + UILabelButtonExt *GetUnpairButton(void); + void SetUnpair(void); + void SetBtconnect(void); + void SetBtDisconnect(void); + void SetCurrentAddr(bd_addr_t addr); + bd_addr_t GetCurrentAddr(void); + void RefreshText(void); + + private: + bool CreateBluetoothOptionsLabelView(void); + bool CreateBluetoothOptionsLabelButton(void); + bool CreateBluetoothOptionsImageView(void); + + void InItTitleLabel(void); + void InItLabelButton(void); + UIViewGroup *group{nullptr}; + UILabelExt *titleLabel{nullptr}; /*标题:蓝牙耳机*/ + UIImageView *btHeadsetIconUmage{nullptr}; // 绿色耳机图标 + UILabelExt *EarPhoneDeviceName{nullptr}; // 蓝牙耳机设备名 + UILabelExt *pairState{nullptr}; // 已配对或者未配对 + UILabelButtonExt *unpairButton{nullptr}; // 取消配对按钮 + bd_addr_t currentAddr; + + /*下面两个组件暂时设为不可见待到需要时使用*/ + UILabelButtonExt *optionsOneButton{nullptr}; /*重新连接和断开连接按钮*/ + UILabel *connectStateLabel{nullptr}; /*已连接或未连接标签*/ + }; } // namespace OHOS #endif // BLUETOOTH_OPTIONS_VIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h index 05f05028e..c4ef7346d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothPresenter.h @@ -25,8 +25,8 @@ enum BluetoothPresenterNum : uint8_t { BLUETOOTHEARPHONEVIEW = 0, BLUETOOTHEARLISTVIEW, BLUETOOTHDEVICELISTVIEW, - BLUETOOTHEOPTIONSVIEW, - BLUETOOTHRECONNECTVIEW, + BLUETOOTHEOPTIONSVIEW,/*已连接的蓝牙耳机设备视图*/ + BLUETOOTHRECONNECTVIEW,/*蓝牙重新连接视图*/ TIPSSUCCMESSAGEVIEW, TIPSCONNFAILMESSAGEVIEW, TIPSFAILMESSAGEVIEW, diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/TipsFailMessageView.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/TipsFailMessageView.h index b99dba6a8..000cc6b42 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/TipsFailMessageView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/TipsFailMessageView.h @@ -1,31 +1,42 @@ /* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: TipsFailMessageView view - * Author: - * Create: 2021-10-13 + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-05 15:20:01 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-14 17:36:25 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/TipsFailMessageView.h */ + #ifndef TIPS_FAIL_MESSAGE_VIEW_H #define TIPS_FAIL_MESSAGE_VIEW_H #include "components/ui_view_group.h" #include "components/ui_label.h" #include "components/ui_label_ext.h" -#include "components/ui_label_button.h" +#include "components/ui_label_button_ext.h" #include "components/ui_image_view.h" -namespace OHOS { -class TipsFailMessageView { -public: - TipsFailMessageView(); - ~TipsFailMessageView(); - static TipsFailMessageView *GetInstance(); - UIViewGroup *ShowUpViewInit(void); -private: - int ShowUpButtonBack(void); - UILabel *titleLabel{nullptr}; - UILabelButton *backButton{nullptr}; - UIImageView *tipImg{nullptr}; - UIViewGroup *group{nullptr}; -}; +namespace OHOS +{ + /*蓝牙设备搜索不到视图*/ + class TipsFailMessageView + { + public: + TipsFailMessageView(); + ~TipsFailMessageView(); + static TipsFailMessageView *GetInstance(); + UIViewGroup *CreateTipsFailMessageView(void); + + private: + bool CreateTipsFailMessageLabelView(void); + bool CreateTipsFailMessageLabelButton(void); + bool CreateTipsFailMessageImageView(void); + + int ShowUpButtonBack(void); + UIViewGroup *group{nullptr}; + UILabelExt *titleLabel{nullptr}; /*标题:蓝牙耳机 */ + UIImageView *btIconImage{nullptr}; /*灰色的蓝牙图标*/ + UILabelExt *btHeadsetNotFoundLabel{nullptr}; /*当前搜索不到耳机蓝牙设备*/ + UILabelButtonExt *rescanButton{nullptr}; /*重新搜索按钮*/ + }; } // namespace OHOS #endif // TIPS_FAIL_MESSAGE_VIEW_H \ No newline at end of file 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 9981e57cf..325e7484b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothModel.cpp @@ -415,6 +415,11 @@ List& BluetoothModel::GetConnedDevicesCase() return *btConnedDevicesList_; } +/* +* @brief 用于检查特定蓝牙设备(其地址存储在 tempMacValue 中)是否处于 ACL 连接状态。 +* +*eg:如果是在控制与手机配对的蓝牙手环,通过这个函数就能确定手环当前与手机的连接情况。 +*/ void BluetoothModel::SetBtStatus(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetBtStatus tempMacValue: %02x%02x%02x%02x%02x%02x", diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothOptionsView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothOptionsView.cpp index a2c367198..050556df8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothOptionsView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothOptionsView.cpp @@ -4,224 +4,385 @@ * Author: * Create: 2021-10-13 */ -#include "BluetoothOptionsView.h" -#include "BluetoothModel.h" +#include "bluetooth/include/BluetoothOptionsView.h" +#include "bluetooth/include/BluetoothModel.h" #include "wearable_log.h" #include "UiConfig.h" -#include "PlayersPresenter.h" -#include "BluetoothPresenter.h" - -namespace OHOS { -static BluetoothOptionsView *g_pBluetoothOptionsView{nullptr}; - -BluetoothOptionsView::BluetoothOptionsView() +#include "player/include/PlayersPresenter.h" +#include "player/include/PlayersView.h" +#include "bluetooth/include/BluetoothPresenter.h" +#include "ui_resource_string.h" +#include "ui_resource_image.h" +namespace OHOS { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView::BluetoothOptionsView"); - g_pBluetoothOptionsView = this; -} + static BluetoothOptionsView *g_pBluetoothOptionsView{nullptr}; -BluetoothOptionsView::~BluetoothOptionsView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView::~BluetoothOptionsView"); - group->RemoveAll(); - delete titleLabel; - titleLabel = nullptr; - delete connectStateLabel; - connectStateLabel = nullptr; - delete optionsOneButton; - optionsOneButton = nullptr; - delete unpairButton; - unpairButton = nullptr; - delete group; - group = nullptr; - g_pBluetoothOptionsView = nullptr; -} - -BluetoothOptionsView *BluetoothOptionsView::GetInstance() -{ - return g_pBluetoothOptionsView; -} + BluetoothOptionsView::BluetoothOptionsView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView::BluetoothOptionsView"); + g_pBluetoothOptionsView = this; + } -void BluetoothOptionsView::RefreshText(void) -{ - // 刷新状态和文字 - BluetoothModel::GetInstance()->SetBtStatus(); - if (BluetoothModel::GetInstance()->GetAclConnected()) { - connectStateLabel->SetText("已连接"); - optionsOneButton->SetText("断开连接"); - } else { - connectStateLabel->SetText("已断开"); - optionsOneButton->SetText("重新连接"); + BluetoothOptionsView::~BluetoothOptionsView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView::~BluetoothOptionsView"); + if (group != nullptr) + { + group->RemoveAll(); + if (titleLabel) + { + delete titleLabel; + titleLabel = nullptr; + } + if (btHeadsetIconUmage) + { + delete btHeadsetIconUmage; + btHeadsetIconUmage = nullptr; + } + if (EarPhoneDeviceName) + { + delete EarPhoneDeviceName; + EarPhoneDeviceName = nullptr; + } + if (pairState) + { + delete pairState; + pairState = nullptr; + } + if (unpairButton) + { + delete unpairButton; + unpairButton = nullptr; + } + if (connectStateLabel) + { + delete connectStateLabel; + connectStateLabel = nullptr; + } + if (optionsOneButton) + { + delete optionsOneButton; + optionsOneButton = nullptr; + } + delete group; + group = nullptr; + } + g_pBluetoothOptionsView = nullptr; } - BluetoothCaseInfo *caseInfo = BluetoothModel::GetInstance()->GetTempMacValue(); - titleLabel->SetText(reinterpret_cast(caseInfo->deviceName)); - optionsOneButton->Invalidate(); -} -void BluetoothOptionsView::InItTitleLabel() -{ - if (titleLabel == nullptr) { - titleLabel = new UILabel(); - if (titleLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView titleLabel new fail"); - return; + BluetoothOptionsView *BluetoothOptionsView::GetInstance() + { + return g_pBluetoothOptionsView; + } + + bool BluetoothOptionsView::CreateBluetoothOptionsLabelView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView::CreateBluetoothOptionsLabelView"); + /* ------------------------------- titleLabel ------------------------------- */ + if (titleLabel == nullptr) + { + titleLabel = new UILabelExt(); + if (titleLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel new fail"); + return false; + } + } + titleLabel->SetPosition(83, 50, 300, 35); + titleLabel->SetStyle(STYLE_TEXT_FONT, 30); + titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + titleLabel->SetTextId(STR_BLUETOOTH_HEADPHONES); /*蓝牙耳机*/ + titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* --------------------------- EarPhoneDeviceName --------------------------- */ + if (EarPhoneDeviceName == nullptr) + { + EarPhoneDeviceName = new UILabelExt(); + if (EarPhoneDeviceName == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "EarPhoneDeviceName new fail"); + return false; + } } - titleLabel->SetPosition(60, 100, 333, 45); // 60:x 100:y 333:width 45:height + EarPhoneDeviceName->SetPosition(53, 246, 360, 35); + EarPhoneDeviceName->SetStyle(STYLE_TEXT_FONT, 30); + EarPhoneDeviceName->SetStyle(STYLE_LINE_HEIGHT, 35); BluetoothCaseInfo *caseInfo = BluetoothModel::GetInstance()->GetTempMacValue(); - titleLabel->SetText(reinterpret_cast(caseInfo->deviceName)); - titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); - titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_FORTY_SIZE); - titleLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); - titleLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - group->Add(titleLabel); - } - if (connectStateLabel == nullptr) { - connectStateLabel = new UILabel(); - if (connectStateLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView connectStateLabel new fail"); - return; + EarPhoneDeviceName->SetText(reinterpret_cast(caseInfo->deviceName)); + EarPhoneDeviceName->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + EarPhoneDeviceName->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + EarPhoneDeviceName->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* -------------------------------- pairState ------------------------------- */ + if (pairState == nullptr) + { + pairState = new UILabelExt(); + if (pairState == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "pairState new fail"); + return false; + } } - connectStateLabel->SetPosition(60, 148, 333, 33); // 60:x 148:y 333:width 33:height + pairState->SetPosition(53, 284, 360, 35); + pairState->SetStyle(STYLE_TEXT_FONT, 30); + pairState->SetStyle(STYLE_LINE_HEIGHT, 35); + pairState->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); + caseInfo = BluetoothModel::GetInstance()->GetTempMacValue(); + pairState->SetTextId(STR_PAIRED); + pairState->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + pairState->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + pairState->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ---------------------------- connectStateLabel 注:暂时不用--------------------------- */ + if (connectStateLabel == nullptr) + { + connectStateLabel = new UILabel(); + if (connectStateLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView connectStateLabel new fail"); + return false; + } + } + connectStateLabel->SetPosition(60, 148, 333, 33); connectStateLabel->SetText("已连接"); connectStateLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_THIRTY_SIZE); connectStateLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); connectStateLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - group->Add(connectStateLabel); + connectStateLabel->SetVisible(false); + /* -------------------------------------------------------------------------- */ + return true; } -} -void BluetoothOptionsView::InItLabelButton() -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::PlayersPresenter::GetInstance(); - UIView::OnClickListener *clickListener2 = (UIView::OnClickListener *)OHOS::BluetoothPresenter::GetInstance(); - if ((clickListener == nullptr) && (clickListener2 == nullptr)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance fail"); - return; - } - if (optionsOneButton == nullptr) { - optionsOneButton = new UILabelButton(); - if (optionsOneButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView optionsOneButton new fail"); - return; + bool BluetoothOptionsView::CreateBluetoothOptionsLabelButton(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView::CreateBluetoothOptionsLabelButton"); + UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::PlayersPresenter::GetInstance(); + UIView::OnClickListener *clickListener2 = (UIView::OnClickListener *)OHOS::BluetoothPresenter::GetInstance(); + if ((clickListener == nullptr) && (clickListener2 == nullptr)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance fail"); + return false; + } + /* ---------------------------- optionsOneButton 注:暂时不用---------------------------- */ + if (optionsOneButton == nullptr) + { + optionsOneButton = new UILabelButtonExt(); + if (optionsOneButton == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView optionsOneButton new fail"); + return false; + } } optionsOneButton->SetPosition(157, 210, 139, 47); // 157:x, 210:y, 139:width 47:height optionsOneButton->SetText("断开连接"); optionsOneButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_THIRTY_SIZE); optionsOneButton->SetViewId(BLUETOOTH_OPTIONONE_BUTTON); optionsOneButton->SetImageSrc(PNG_SELECTION_BOX, PNG_SELECTION_BOX); - if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) { + if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) + { optionsOneButton->SetTextColor(Color::Red()); optionsOneButton->SetOnClickListener(clickListener); - } else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) { + } + else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) + { optionsOneButton->SetTextColor(Color::Blue()); optionsOneButton->SetOnClickListener(clickListener2); } - group->Add(optionsOneButton); - } - if (unpairButton == nullptr) { - unpairButton = new UILabelButton(); - if (unpairButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView unpairButton new fail"); - return; - } - unpairButton->SetPosition(157, 284, 139, 47); // 157:x, 284:y, 139:width 47:height - unpairButton->SetText("取消配对"); - unpairButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_THIRTY_SIZE); + optionsOneButton->SetVisible(false); + /* ------------------------------ unpairButton ------------------------------ */ + if (unpairButton == nullptr) + { + unpairButton = new UILabelButtonExt(); + if (unpairButton == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView unpairButton new fail"); + return false; + } + } + unpairButton->SetPosition(0, 366, 466, 100); + unpairButton->SetTextId(STR_UNPAIR); // 取消配对 + unpairButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); unpairButton->SetViewId(BLUETOOTH_UNPAIR_BUTTON); - unpairButton->SetImageSrc(PNG_SELECTION_BOX, PNG_SELECTION_BOX); - if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) { - unpairButton->SetTextColor(Color::Red()); + unpairButton->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE); + unpairButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0x00, UIButton::PRESSED); + unpairButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff)); + if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) + { unpairButton->SetOnClickListener(clickListener); - } else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) { - unpairButton->SetTextColor(Color::Blue()); + } + else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) + { unpairButton->SetOnClickListener(clickListener2); } - group->Add(unpairButton); + return true; } -} -UIViewGroup *BluetoothOptionsView::InitShowUpView() -{ - // 获取currentBdAddr db值 model待开发 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView init"); - if (group == nullptr) { - group = new UIViewGroup(); - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); - return nullptr; + bool BluetoothOptionsView::CreateBluetoothOptionsImageView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView::CreateBluetoothOptionsImageView"); + /* --------------------------- btHeadsetIconUmage --------------------------- */ + if (btHeadsetIconUmage == nullptr) + { + btHeadsetIconUmage = new UIImageView(); + if (btHeadsetIconUmage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "btHeadsetIconUmage new fail"); + return false; + } + } + btHeadsetIconUmage->SetPosition(193, 134, 80, 80); + btHeadsetIconUmage->SetAutoEnable(false); + btHeadsetIconUmage->SetResizeMode(UIImageView::CENTER); + if (!PlayersView::LoadPlayerImage(btHeadsetIconUmage, PLAYER_EARPHONE)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "btHeadsetIconUmage LoadPlayerImage fail"); + return false; } - group->SetPosition(0, 0); - group->SetWidth(HORIZONTAL_RESOLUTION); - group->SetHeight(VERTICAL_RESOLUTION); + return true; } - InItLabelButton(); - InItTitleLabel(); - UIView::OnDragListener *earDragListener = (UIView::OnDragListener *)OHOS::PlayerOnDragListener::GetInstance(); - UIView::OnDragListener *earDragListener2 = (UIView::OnDragListener *)OHOS::BluetoothPresenter::GetInstance(); - if ((earDragListener == nullptr) && (earDragListener2 == nullptr)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "earDragListener GetInstance fail"); - return nullptr; + + // 刷新状态和文字 + void BluetoothOptionsView::RefreshText(void) + { + BluetoothModel::GetInstance()->SetBtStatus(); + if (BluetoothModel::GetInstance()->GetAclConnected()) + { + connectStateLabel->SetText("已连接"); + optionsOneButton->SetText("断开连接"); + } + else + { + connectStateLabel->SetText("已断开"); + optionsOneButton->SetText("重新连接"); + } + BluetoothCaseInfo *caseInfo = BluetoothModel::GetInstance()->GetTempMacValue(); + EarPhoneDeviceName->SetText(reinterpret_cast(caseInfo->deviceName)); + optionsOneButton->Invalidate(); } - if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) { - group->SetOnDragListener(earDragListener); - } else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) { - group->SetOnDragListener(earDragListener2); + + UIViewGroup *BluetoothOptionsView::CreateBluetoothOptionsView() + { + // 获取currentBdAddr db值 model待开发 + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothOptionsView init"); + if (group == nullptr) + { + group = new UIViewGroup(); + if (group == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); + return nullptr; + } + group->SetPosition(0, 0); + group->SetWidth(HORIZONTAL_RESOLUTION); + group->SetHeight(VERTICAL_RESOLUTION); + } + UIView::OnDragListener *earDragListener = (UIView::OnDragListener *)OHOS::PlayerOnDragListener::GetInstance(); + UIView::OnDragListener *earDragListener2 = (UIView::OnDragListener *)OHOS::BluetoothPresenter::GetInstance(); + if ((earDragListener == nullptr) && (earDragListener2 == nullptr)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "earDragListener GetInstance fail"); + return nullptr; + } + if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) + { + group->SetOnDragListener(earDragListener); + } + else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) + { + group->SetOnDragListener(earDragListener2); + } + group->SetViewId(BLUETOOTH_OPTIONS_VIEW); + group->SetDraggable(true); + group->SetTouchable(true); + /* -------------------------------------------------------------------------- */ + if (!CreateBluetoothOptionsLabelView() || !CreateBluetoothOptionsImageView() || !CreateBluetoothOptionsLabelButton()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::CreateTipsFailMessageView fail!!"); + return nullptr; + } + /* ----------------------------------- Add ---------------------------------- */ + group->Add(titleLabel); + group->Add(btHeadsetIconUmage); + group->Add(EarPhoneDeviceName); + group->Add(pairState); + group->Add(unpairButton); + group->Add(optionsOneButton); + group->Add(connectStateLabel); + + return group; } - group->SetViewId(BLUETOOTH_OPTIONS_VIEW); - group->SetDraggable(true); - group->SetTouchable(true); - return group; -} -UILabelButton *BluetoothOptionsView::GetOptionsOneButton(void) -{ - return optionsOneButton; -} + UILabelButtonExt *BluetoothOptionsView::GetOptionsOneButton(void) + { + return optionsOneButton; + } -UILabelButton *BluetoothOptionsView::GetUnpairButton(void) -{ - return unpairButton; -} + UILabelButtonExt *BluetoothOptionsView::GetUnpairButton(void) + { + return unpairButton; + } + /* + * @brief 获取蓝牙Model中的最后连接设备的地址,然后调用 gap_disconnect_remote_device 函数来断开与该远程设备的连接,并记录相关的日志信息。 + * + * eg:比如之前连接的设备是一个蓝牙耳机,当用户主动触发断开操作时,该函数就会执行,断开与该耳机的连接。 + */ + void BluetoothOptionsView::SetBtDisconnect(void) + { + bd_addr_t *lastAddr = BluetoothModel::GetInstance()->GetLastConnedAddr(); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetBtDisconnect Addr: %02x%02x%02x%02x%02x%02x", + lastAddr->addr[5], lastAddr->addr[4], lastAddr->addr[3], /* mac下标 0 1 2 3 4 5 */ + lastAddr->addr[2], lastAddr->addr[1], lastAddr->addr[0]); /* mac下标 0 1 2 3 4 5 */ + errcode_t retVal = gap_disconnect_remote_device(lastAddr); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_disconnect_remote_device %d", retVal); + } -void BluetoothOptionsView::SetBtDisconnect(void) -{ - bd_addr_t *lastAddr = BluetoothModel::GetInstance()->GetLastConnedAddr(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetBtDisconnect Addr: %02x%02x%02x%02x%02x%02x", - lastAddr->addr[5], lastAddr->addr[4], lastAddr->addr[3], /* mac下标 0 1 2 3 4 5 */ - lastAddr->addr[2], lastAddr->addr[1], lastAddr->addr[0]); /* mac下标 0 1 2 3 4 5 */ - errcode_t retVal = gap_disconnect_remote_device(lastAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_disconnect_remote_device %d", retVal); -} - -void BluetoothOptionsView::SetBtconnect(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetBtconnect currentAddr: %02x%02x%02x%02x%02x%02x", - currentAddr.addr[5], currentAddr.addr[4], currentAddr.addr[3], /* mac下标 0 1 2 3 4 5 */ - currentAddr.addr[2], currentAddr.addr[1], currentAddr.addr[0]); /* mac下标 0 1 2 3 4 5 */ - errcode_t retVal = BluetoothModel::GetInstance()->ConnectRemoteDevice(¤tAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetBtconnect ConnectRemoteDevice %d", retVal); -} - -void BluetoothOptionsView::SetUnpair(void) -{ - bool ret; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetUnpair currentAddr: %02x%02x%02x%02x%02x%02x", - currentAddr.addr[5], currentAddr.addr[4], currentAddr.addr[3], /* mac下标 0 1 2 3 4 5 */ - currentAddr.addr[2], currentAddr.addr[1], currentAddr.addr[0]); /* mac下标 0 1 2 3 4 5 */ - ret = gap_remove_pair(¤tAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetUnpair gap_remove_pair %d", ret); -} + /* + * @brief 记录当前要连接的设备地址的相关日志信息,然后通过蓝牙Model的 ConnectRemoteDevice 函数尝试连接该远程设备,并记录连接结果的日志。 + * + * 当用户选择连接一个新的蓝牙设备时,这个函数会被调用,尝试建立与该设备的连接。 + */ + void BluetoothOptionsView::SetBtconnect(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetBtconnect currentAddr: %02x%02x%02x%02x%02x%02x", + currentAddr.addr[5], currentAddr.addr[4], currentAddr.addr[3], /* mac下标 0 1 2 3 4 5 */ + currentAddr.addr[2], currentAddr.addr[1], currentAddr.addr[0]); /* mac下标 0 1 2 3 4 5 */ + errcode_t retVal = BluetoothModel::GetInstance()->ConnectRemoteDevice(¤tAddr); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetBtconnect ConnectRemoteDevice %d", retVal); + } + /* + * @brief 记录当前设备地址的日志,然后调用 gap_remove_pair 函数来解除与该设备的配对,并记录操作结果的日志。 + * + * 如果用户不再希望与某个已配对的蓝牙设备保持配对关系,例如一个旧手机,触发此操作时该函数执行。 + */ + void BluetoothOptionsView::SetUnpair(void) + { + bool ret; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetUnpair currentAddr: %02x%02x%02x%02x%02x%02x", + currentAddr.addr[5], currentAddr.addr[4], currentAddr.addr[3], /* mac下标 0 1 2 3 4 5 */ + currentAddr.addr[2], currentAddr.addr[1], currentAddr.addr[0]); /* mac下标 0 1 2 3 4 5 */ + ret = gap_remove_pair(¤tAddr); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetUnpair gap_remove_pair %d", ret); + } -void BluetoothOptionsView::SetCurrentAddr(bd_addr_t addr) -{ - (void)memcpy_s(currentAddr.addr, BD_ADDR_LEN, - addr.addr, BD_ADDR_LEN); // 源和目标内存长度一样,不做返回值判断 -} + /* + * @brief 使用 memcpy_s 函数将传入的地址 addr 复制到 currentAddr 中。 + * + * 当获取到新的有效的蓝牙设备地址时,通过这个函数更新当前要操作的地址。 + */ + void BluetoothOptionsView::SetCurrentAddr(bd_addr_t addr) + { + (void)memcpy_s(currentAddr.addr, BD_ADDR_LEN, + addr.addr, BD_ADDR_LEN); // 源和目标内存长度一样,不做返回值判断 + } -bd_addr_t BluetoothOptionsView::GetCurrentAddr(void) -{ - return currentAddr; -} + /* + * @brief 返回当前保存的蓝牙设备地址。 + * + * 其他函数需要获取当前正在操作的蓝牙地址时,会调用这个函数来获取。 + */ + bd_addr_t BluetoothOptionsView::GetCurrentAddr(void) + { + return currentAddr; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothPresenter.cpp index 18b5baebf..878c2e22a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothPresenter.cpp @@ -136,6 +136,7 @@ void BluetoothPresenter::ClickUnpairButton(void) view_->ChangeView(BLUETOOTHEOPTIONSVIEW, BLUETOOTHDEVICELISTVIEW); } +/*已连接的蓝牙耳机设备视图中【重新连接或断开连接】按钮*/ void BluetoothPresenter::ClickOptionsOneButton(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothPresenter::OnClick BLUETOOTH_OPTIONONE_BUTTON"); @@ -147,7 +148,7 @@ void BluetoothPresenter::ClickOptionsOneButton(void) bluetoothMode_->SetBtStatus(); if (bluetoothMode_->GetAclConnected()) { bluetoothMode_->SetTagConnectNew(false); - bluetoothOptionsView->SetBtDisconnect(); + bluetoothOptionsView->SetBtDisconnect();/*断开与该远程设备的连接*/ view_->ChangeView(BLUETOOTHEOPTIONSVIEW, BLUETOOTHDEVICELISTVIEW); } else { bluetoothMode_->SetTagReconnectJump(true); @@ -224,7 +225,7 @@ bool BluetoothPresenter::OnKeyAct(UIView &view, const KeyEvent &event) uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/MainBluetoothView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/MainBluetoothView.cpp index 3c6aa8cac..27846c3f6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/MainBluetoothView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/MainBluetoothView.cpp @@ -155,7 +155,7 @@ bool MainBluetoothView::ChangeTipsFailMessageView(int16_t hideView, int16_t this return false; } // init view - UIViewGroup *group = tipsFailMessageView->ShowUpViewInit(); + UIViewGroup *group = tipsFailMessageView->CreateTipsFailMessageView(); if (group == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail"); return false; @@ -281,7 +281,7 @@ bool MainBluetoothView::ChangeBluetoothOptionsView(int16_t hideView, int16_t thi return false; } // init view - UIViewGroup *group = bluetoothOptionsView->InitShowUpView(); + UIViewGroup *group = bluetoothOptionsView->CreateBluetoothOptionsView(); if (group == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail"); return false; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/TipsFailMessageView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/TipsFailMessageView.cpp index 4d732b85d..49982ff0e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/TipsFailMessageView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/TipsFailMessageView.cpp @@ -8,120 +8,205 @@ #include "BluetoothModel.h" #include "wearable_log.h" #include "UiConfig.h" -#include "PlayersPresenter.h" -#include "BluetoothPresenter.h" +#include "player/include/PlayersPresenter.h" +#include "player/include/PlayersView.h" +#include "bluetooth/include/BluetoothPresenter.h" +#include "ui_resource_string.h" +#include "ui_resource_image.h" -namespace OHOS { -static TipsFailMessageView *g_pFailMessageView{nullptr}; -TipsFailMessageView::TipsFailMessageView() +namespace OHOS { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::TipsFailMessageView"); - g_pFailMessageView = this; -} + static TipsFailMessageView *g_pFailMessageView{nullptr}; + TipsFailMessageView::TipsFailMessageView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::TipsFailMessageView"); + g_pFailMessageView = this; + } -TipsFailMessageView::~TipsFailMessageView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::~TipsFailMessageView"); - group->RemoveAll(); - delete titleLabel; - titleLabel = nullptr; - delete backButton; - backButton = nullptr; - delete group; - group = nullptr; - delete tipImg; - tipImg = nullptr; - g_pFailMessageView = nullptr; -} + TipsFailMessageView::~TipsFailMessageView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::~TipsFailMessageView"); + if (group != nullptr) + { + group->RemoveAll(); + if (titleLabel) + { + delete titleLabel; + titleLabel = nullptr; + } + if (btIconImage) + { + delete btIconImage; + btIconImage = nullptr; + ImageCacheManager::GetInstance().UnloadOneInMultiRes(PLAYER_BLUETOOTH_GRAY, PLAYER_IAMGES); + } + if (btHeadsetNotFoundLabel) + { + delete btHeadsetNotFoundLabel; + btHeadsetNotFoundLabel = nullptr; + } + if (rescanButton) + { + delete rescanButton; + rescanButton = nullptr; + } + delete group; + group = nullptr; + } + g_pFailMessageView = nullptr; + } -TipsFailMessageView *TipsFailMessageView::GetInstance() -{ - return g_pFailMessageView; -} + TipsFailMessageView *TipsFailMessageView::GetInstance() + { + return g_pFailMessageView; + } -int TipsFailMessageView::ShowUpButtonBack() -{ - if (backButton == nullptr) { - backButton = new UILabelButton(); - if (backButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView backButton new fail"); - return OHOS_FAILURE; + bool TipsFailMessageView::CreateTipsFailMessageLabelView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::CreateTipsFailMessageLabelView"); + /* ------------------------------- titleLabel ------------------------------- */ + if (titleLabel == nullptr) + { + titleLabel = new UILabelExt(); + if (titleLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel new fail"); + return false; + } } - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::PlayersPresenter::GetInstance(); - UIView::OnClickListener *clickListener2 = (UIView::OnClickListener *)OHOS::BluetoothPresenter::GetInstance(); - if ((clickListener == nullptr) && (clickListener2 == nullptr)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance fail"); - return OHOS_FAILURE; + titleLabel->SetPosition(83, 50, 300, 35); + titleLabel->SetStyle(STYLE_TEXT_FONT, 30); + titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + titleLabel->SetTextId(STR_BLUETOOTH_HEADPHONES); /*蓝牙耳机*/ + titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ------------------------- btHeadsetNotFoundLabel ------------------------- */ + if (btHeadsetNotFoundLabel == nullptr) + { + btHeadsetNotFoundLabel = new UILabelExt(); + if (btHeadsetNotFoundLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel new fail"); + return false; + } } - backButton->SetPosition(65, 359, 324, 101); // 65:x, 359:y, 324:width 101:height - backButton->SetText("重试"); - backButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); // 40:font data - backButton->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE); - backButton->SetViewId(BLUETOOTH_FAIL_BACK_BUTTON); - if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) { - backButton->SetTextColor(Color::Red()); - backButton->SetOnClickListener(clickListener); - } else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) { - backButton->SetTextColor(Color::Blue()); - backButton->SetOnClickListener(clickListener2); + btHeadsetNotFoundLabel->SetPosition(53, 305, 360, 30); + btHeadsetNotFoundLabel->SetStyle(STYLE_TEXT_FONT, 26); + btHeadsetNotFoundLabel->SetStyle(STYLE_LINE_HEIGHT, 30); + btHeadsetNotFoundLabel->SetTextId(STR_BT_HEADSET_NOFOND); /*当前搜索不到耳机蓝牙设备*/ + btHeadsetNotFoundLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff)); + btHeadsetNotFoundLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + btHeadsetNotFoundLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + btHeadsetNotFoundLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); + + return true; + } + + bool TipsFailMessageView::CreateTipsFailMessageImageView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::CreateTipsFailMessageImageView"); + if (btIconImage == nullptr) + { + btIconImage = new UIImageView(); + if (btIconImage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); + return false; + } + btIconImage->SetPosition(163, 126, 140, 140); + btIconImage->SetAutoEnable(false); + btIconImage->SetResizeMode(UIImageView::CENTER); + if (!PlayersView::LoadPlayerImage(btIconImage, PLAYER_BLUETOOTH_GRAY)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "btIconImage LoadPlayerImage fail"); + return false; + } } - group->Add(backButton); + return true; } - if (tipImg == nullptr) { - tipImg = new UIImageView(); - if (tipImg == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView tipImg new fail"); - return OHOS_FAILURE; + + bool TipsFailMessageView::CreateTipsFailMessageLabelButton() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::CreateTipsFailMessageLabelButton"); + if (rescanButton == nullptr) + { + rescanButton = new UILabelButtonExt(); + if (rescanButton == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView rescanButton new fail"); + return false; + } + UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::PlayersPresenter::GetInstance(); + UIView::OnClickListener *clickListener2 = (UIView::OnClickListener *)OHOS::BluetoothPresenter::GetInstance(); + if ((clickListener == nullptr) && (clickListener2 == nullptr)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance fail"); + return false; + } + rescanButton->SetPosition(73, 350, 320, 100); + rescanButton->SetTextId(STR_BT_HEADSET_RESCAN); /*重新搜索*/ + rescanButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + rescanButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + rescanButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + rescanButton->SetViewId(BLUETOOTH_FAIL_BACK_BUTTON); + rescanButton->SetTextColor(Color::GetColorFromRGBA(0x35, 0x49, 0xff, 0xff)); + rescanButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) + { + rescanButton->SetOnClickListener(clickListener); + } + else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) + { + rescanButton->SetOnClickListener(clickListener2); + } } - tipImg->SetPosition(181, 111, 90, 90); // 181:x 111:y 90:width 90:height - tipImg->SetSrc(PNG_GANTAN); - group->Add(tipImg); + return true; } - return OHOS_SUCCESS; -} -UIViewGroup *TipsFailMessageView::ShowUpViewInit(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::ShowUpViewInit"); - if (group == nullptr) { - group = new UIViewGroup(); - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); + UIViewGroup *TipsFailMessageView::CreateTipsFailMessageView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::CreateTipsFailMessageView"); + if (group == nullptr) + { + group = new UIViewGroup(); + if (group == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); + return nullptr; + } + group->SetPosition(0, 0, 466, 466); + } + UIView::OnDragListener *tipsDragListener = (UIView::OnDragListener *)OHOS::PlayerOnDragListener::GetInstance(); + UIView::OnDragListener *tipsDragListener2 = (UIView::OnDragListener *)OHOS::BluetoothPresenter::GetInstance(); + if ((tipsDragListener == nullptr) && (tipsDragListener2 == nullptr)) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "tipsDragListener GetInstance fail"); return nullptr; } - group->SetPosition(0, 0); - group->SetWidth(HORIZONTAL_RESOLUTION); - group->SetHeight(VERTICAL_RESOLUTION); - } - if (titleLabel == nullptr) { - titleLabel = new UILabel(); - if (titleLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView titleLabel new fail"); + if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) + { + group->SetOnDragListener(tipsDragListener); + } + else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) + { + group->SetOnDragListener(tipsDragListener2); + } + group->SetViewId(TIPS_FAIL_MESSAGE_VIEW); + group->SetDraggable(true); + group->SetTouchable(true); + /* -------------------------------------------------------------------------- */ + if (!CreateTipsFailMessageLabelView() || !CreateTipsFailMessageImageView() || !CreateTipsFailMessageLabelButton()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TipsFailMessageView::CreateTipsFailMessageView fail!!"); return nullptr; } - titleLabel->SetPosition(0, 234, HORIZONTAL_RESOLUTION, 45); // 0:x 234:y 454:width 45:height - titleLabel->SetText("未发现蓝牙耳机"); - titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); // 40:font data - titleLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); - titleLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); + /* ----------------------------------- Add ---------------------------------- */ group->Add(titleLabel); + group->Add(btIconImage); + group->Add(btHeadsetNotFoundLabel); + group->Add(rescanButton); + /* -------------------------------------------------------------------------- */ + return group; } - ShowUpButtonBack(); - UIView::OnDragListener *tipsDragListener = (UIView::OnDragListener *)OHOS::PlayerOnDragListener::GetInstance(); - UIView::OnDragListener *tipsDragListener2 = (UIView::OnDragListener *)OHOS::BluetoothPresenter::GetInstance(); - if ((tipsDragListener == nullptr) && (tipsDragListener2 == nullptr)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "tipsDragListener GetInstance fail"); - return nullptr; - } - if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERPLAYERS) { - group->SetOnDragListener(tipsDragListener); - } else if (BluetoothModel::GetInstance()->GetBluetoothCalleridStatus() == CALLERSETTING) { - group->SetOnDragListener(tipsDragListener2); - } - group->SetViewId(TIPS_FAIL_MESSAGE_VIEW); - group->SetDraggable(true); - group->SetTouchable(true); - return group; -} } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp index 54241b427..ffbb19ba1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/brightnesslevel/src/BrightnessLevelPresenter.cpp @@ -81,7 +81,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp index ce09b4c41..5fb38d73b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsPresenter.cpp @@ -150,7 +150,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp index b63e96800..aa764e3dc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp @@ -139,7 +139,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp index a8ed9d59c..bdd21b443 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-14 15:02:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-27 09:37:31 + * @LastEditTime: 2024-08-14 10:07:26 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/compass/src/MainCompassPresenter.cpp */ @@ -30,7 +30,7 @@ namespace OHOS void MainCompassPresenter::OnStart() { Presenter::OnStart(); - ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); + // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } void MainCompassPresenter::OnPause(void) {} @@ -39,7 +39,7 @@ namespace OHOS void MainCompassPresenter::OnStop(void) { - ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); + // ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); } MainCompassPresenter *MainCompassPresenter::GetInstance() @@ -81,7 +81,7 @@ bool MainCompassPresenter::OnKeyAct(UIView &view, const KeyEvent &event) uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp index 84aa804ac..333afb5fb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownPresenter.cpp @@ -231,7 +231,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp index 1a61702fc..102fc092f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp @@ -244,7 +244,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp index 095499692..f9d1ab0f2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp @@ -106,7 +106,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp index 4b53e9735..4c9f25f55 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp @@ -102,7 +102,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { // 发送指令停止震动 if (FindPhoneModel::GetInstance().GetBlueToothConnectedState()) 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 d96dc1a7f..083e87d76 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp @@ -96,7 +96,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalpresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalpresenter.cpp index fcc4b049f..f57041a36 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalpresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/goal/src/Maingoalpresenter.cpp @@ -90,7 +90,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartDetectionPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartDetectionPresenter.cpp index d1dc5cc7f..8406d011a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartDetectionPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartDetectionPresenter.cpp @@ -112,7 +112,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NavigateBack(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartResultPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartResultPresenter.cpp index 7c9e38d47..8b1295eb6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartResultPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartResultPresenter.cpp @@ -117,7 +117,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); NativeAbility::GetInstance().Back(TransitionType::TRANSITION_ZOOM); diff --git a/code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp index 711f3a99b..c291f4354 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/languagecode/src/LanguageSwitchPresenter.cpp @@ -156,7 +156,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp index 7ad9329fd..f06a2dc5f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp @@ -131,7 +131,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_ZOOM); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowPresenter.cpp index a513d40b2..01518048e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowPresenter.cpp @@ -89,7 +89,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { // NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); NativeAbility::GetInstance().Back(TransitionType::TRANSITION_ZOOM); diff --git a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp index 42059989e..846cfcc71 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/motionrecognition/src/MotionRecognitionPresenter.cpp @@ -143,7 +143,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp index 2d2b0e0b2..53065b91f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/musicplayer/src/MusicPlayerPresenter.cpp @@ -105,7 +105,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp index 39526c799..331ef6252 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp @@ -156,7 +156,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessagePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessagePresenter.cpp index 3deabbb9c..68451cde2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessagePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessagePresenter.cpp @@ -113,7 +113,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp index 985b61339..10f51439c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/DialingMethodPresenter.cpp @@ -189,7 +189,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); set_address_number(NULL); diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhonePresenter.cpp index fe02bfd88..a80a2945e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/MainPhonePresenter.cpp @@ -114,7 +114,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp index 93328c05b..34d94e01f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneCallPresenter.cpp @@ -224,7 +224,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirPresenter.cpp index 20f9bf9e2..0203d1a92 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/PhoneDirPresenter.cpp @@ -114,7 +114,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h index 28bf93cf8..d8b5f973a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-13 16:11:48 + * @LastEditTime: 2024-08-14 11:26:39 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h */ @@ -100,6 +100,7 @@ namespace OHOS void UpdatePlayerView(bool musicSourceType, bool phoneMusicConnectStatus); void UpdateMusicListStatus(void); + void OnClickBackKeyToMainMusicPlayerView(void); VolumeSettingView *GetVolumeSettingView(); PlayerListDelSongView *GetPlayerListDelSongView(); @@ -113,6 +114,7 @@ namespace OHOS bool ChangeToMusicDeleteView(int16_t thisView); bool ChangeToMusicBluetoothDisConnectView(int16_t thisView); bool ChangeToMusicBluetoothConnectFailedView(int16_t thisView); + bool ChangeToMusicConnectingView(int16_t thisView); private: UIButton *PlayerViewButtonInit(ButtonConfig &buttonconfig); diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp index b6ddbeae1..2190639a0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp @@ -185,7 +185,7 @@ bool JumpView::ChangeBluetoothOptionsView(int16_t hideView, int16_t thisView) return false; } // init view - UIViewGroup *group = bluetoothOptionsView->InitShowUpView(); + UIViewGroup *group = bluetoothOptionsView->CreateBluetoothOptionsView(); if (group == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail"); return false; @@ -338,7 +338,7 @@ bool JumpView::ChangeTipsFailMessageView(int16_t hideView, int16_t thisView) return false; } // init view - UIViewGroup *group = tipsFailMessageView->ShowUpViewInit(); + UIViewGroup *group = tipsFailMessageView->CreateTipsFailMessageView(); if (group == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail"); return false; diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp index 443ba94d3..6cde8c3ad 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -882,6 +882,34 @@ namespace OHOS } } + /*点击返回键回到音乐主视图*/ + void PlayersView::OnClickBackKeyToMainMusicPlayerView(void) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayersView::OnClickBackKeyToMainMusicPlayerView"); + int index = 0; + for (int i = MAIN_MUSICPLAYER_VIEW; i < MUSICPLAYERJUMPVIEWID_MAX; i++) + { + if (group[i] != nullptr) + { + if (group[index]->IsVisible() == true) + { + index = i; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group[%d] IsVisible ", index); + break; + } + } + else + { + continue; + } + } + if (index == MAIN_MUSICPLAYER_VIEW) /*如果是音乐主视图是可见的不做ChangeView*/ + { + return; + } + ChangeView(index, MAIN_MUSICPLAYER_VIEW); + } + /*刷新播放器界面的组件状态*/ void PlayersView::UpdatePlayerView(bool musicSourceType, bool phoneMusicConnectStatus) { @@ -1407,4 +1435,28 @@ namespace OHOS } return true; } + + /*切换到蓝牙未连接视图*/ + bool PlayersView::ChangeToMusicConnectingView(int16_t thisView) + { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayersView::ChangeToMusicBluetoothConnectFailedView"); + // if (group[thisView] == nullptr) + // { + // musicPlayerBTConnectFailedView = new MusicPlayerBTConnectFailedView(); + // if (musicPlayerBTConnectFailedView == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new playerListDelSongView fail"); + // return false; + // } + // UIViewGroup *groupview = musicPlayerBTConnectFailedView->CreateMusicPlayerBTConnectFailedView(); + // if (groupview == nullptr) + // { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new group[%d] fail", thisView); + // return false; + // } + // group[thisView] = groupview; + // Add(group[thisView]); + // } + return true; + } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 70c4868e4..b258fd907 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:55:27 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-03 20:21:43 + * @LastEditTime: 2024-08-15 16:22:03 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp */ @@ -171,7 +171,22 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "power_display_svr_get_api returned nullptr"); return; } + /* -------------------------------------------------------------------------- */ display_api->turn_on_screen(); + /* -------------------------------------------------------------------------- */ + if(display_api->get_screen_state() == SCREEN_ON) + { + uint16_t curSliceId = NativeAbility::GetInstance().GetCurSliceId(); + if (curSliceId == VIEW_AI_VOICE) // 如果当前已在ai语音界面不做切换 + { + AiVoiceModel::GetInstance().FunctionKeyOnClickToChangeAIModel(); + } + else + { + NativeAbility::GetInstance().EnterSlice(VIEW_AI_VOICE); // 切换到Ai语音界面 + } + } + return; } @@ -370,7 +385,7 @@ namespace OHOS RegisterPowerKeyLongPressEvent(); RegisterFuncKeyPressEvent(); // RegisterFuncKeyLongPressEvent(); - RegisterFuncKeyClickEvent(); + // RegisterFuncKeyClickEvent(); // RegisterFuncKeyDoubleClickEvent(); } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp index 460f98e89..edffae194 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp @@ -212,7 +212,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { if (!isShutDownImageAnimatorStart) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp index b2f20fec8..d137eaafa 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootdevice/src/RebootPresenter.cpp @@ -130,7 +130,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { // uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); // NativeAbility::GetInstance().ChangeSlice(preSlice); diff --git a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp index 4bc4ef8a2..ba0020720 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/record/src/RecordingPresenter.cpp @@ -263,7 +263,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } 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 0b30109f0..2ab0dfa59 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-06-13 15:10:37 + * @LastEditTime: 2024-08-14 10:21:32 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/respiratorytraining/src/RespiratoryTrainingModel.cpp */ #include "respiratorytraining/include/RespiratoryTrainingModel.h" @@ -14,6 +14,7 @@ #include #include "respiratorytraining/include/RespiratoryTrainingView.h" #include "heartrate/include/HeartModel.h" +#include namespace OHOS { // 声明定时器变量 @@ -80,6 +81,7 @@ namespace OHOS p_RespiratoryTrainingView->GetRespiratoryTrainingAnimator_()->Stop(); // 关闭呼吸动画 HeartModel::GetInstance()->Heart_Control(HeartState::End,HeartCheck::INITIATIVE); // 关闭心率检测 p_RespiratoryTrainingView->ChangeView(RESPIRATORYTRAINING, RESPIRATORYTRAININGCOMPLETED); + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON);/*取消常亮屏*/ } else { 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 0a3412b80..1cf5bb927 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-06-13 15:17:08 + * @LastEditTime: 2024-08-14 10:24:30 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/RespiratoryTraining/src/RespiratoryTrainingPresenter.cpp */ @@ -102,7 +102,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveElePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveElePresenter.cpp index 963e645a0..02ae0c0d5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveElePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveElePresenter.cpp @@ -91,7 +91,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp index 68c4dbf43..0feea05f7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp @@ -122,7 +122,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp index 30ca758e5..a62750de3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp @@ -108,7 +108,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { // 回退 NativeAbility::GetInstance().Back(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStylePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStylePresenter.cpp index e3bb50381..d89c52e25 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStylePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStylePresenter.cpp @@ -64,7 +64,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { // 回退 NativeAbility::GetInstance().Back(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp index 8761ed31f..6ef81bc38 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-12 11:44:04 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-22 11:08:39 + * @LastEditTime: 2024-08-15 14:28:46 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp */ /* @@ -104,7 +104,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnKeyAct"); uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepControlPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepControlPresenter.cpp index 5179e7c6b..25120a99f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepControlPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/sleep/src/SleepControlPresenter.cpp @@ -94,7 +94,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp index ef7b5bc4c..805c22a11 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp @@ -95,7 +95,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp index 2258d9c4e..159ab1222 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp @@ -110,7 +110,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp index 04c1351ce..1a9edf1ff 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp @@ -98,7 +98,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp index db22636f4..d9284b70f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp @@ -285,7 +285,7 @@ namespace OHOS uint16_t keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp index 5d96810a5..3bb688b7d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp @@ -206,7 +206,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdatePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdatePresenter.cpp index 17b9ff1ff..f25e35472 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdatePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/systemupdate/src/SystemUpdatePresenter.cpp @@ -109,7 +109,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosPresenter.cpp index 091d5266b..e758edea1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/takephotos/src/TakephotosPresenter.cpp @@ -101,7 +101,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); /*如果是拍照界面需要发送拍照结束的消息*/ diff --git a/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp index ed2ae474b..13aa916b1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/themestyle/src/ThemeStylePresenter.cpp @@ -129,7 +129,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16 keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataPresenter.cpp index 0b6736eca..f9782fc56 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataPresenter.cpp @@ -94,7 +94,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NavigateBack(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp index 140290df7..ce9546167 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp @@ -113,7 +113,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NavigateBack(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetPresenter.cpp index fea9365b1..b2a8d2170 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetPresenter.cpp @@ -88,7 +88,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NavigateBack(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_aquatic/src/TraingAquaticPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_aquatic/src/TraingAquaticPresenter.cpp index 0486265e8..adc489d90 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_aquatic/src/TraingAquaticPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_aquatic/src/TraingAquaticPresenter.cpp @@ -111,7 +111,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ball/src/TraingBallPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ball/src/TraingBallPresenter.cpp index 6ef37b495..cd788bf47 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ball/src/TraingBallPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ball/src/TraingBallPresenter.cpp @@ -112,7 +112,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDancePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDancePresenter.cpp index 9972a62d6..0696242bd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDancePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDancePresenter.cpp @@ -111,7 +111,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessPresenter.cpp index f4119500b..59d73958e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessPresenter.cpp @@ -123,7 +123,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIcePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIcePresenter.cpp index 455947bb6..577a2c400 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIcePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIcePresenter.cpp @@ -110,7 +110,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitPresenter.cpp index 6e43f475c..59468d098 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitPresenter.cpp @@ -109,7 +109,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMorePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMorePresenter.cpp index 5e9a99b53..b2ea91b3a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMorePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMorePresenter.cpp @@ -171,7 +171,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NavigateBack(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_other/src/TraingOtherPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_other/src/TraingOtherPresenter.cpp index 4ad1fd782..cd4989e85 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_other/src/TraingOtherPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_other/src/TraingOtherPresenter.cpp @@ -125,7 +125,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_rest/src/TraingRestPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_rest/src/TraingRestPresenter.cpp index 3a560e5cb..d121c340c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_rest/src/TraingRestPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_rest/src/TraingRestPresenter.cpp @@ -110,7 +110,7 @@ namespace OHOS unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordPresenter.cpp index 3e714fc2f..a2b121000 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordPresenter.cpp @@ -146,7 +146,7 @@ namespace OHOS unsigned short keyID = event.GetKeyId(); unsigned short keyState = event.GetState(); // 如果是power键,且是亮屏状态,按键释放就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NavigateBack(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp index 2b8d02441..65491b63f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/watchQRcode/src/WatchQRCodePresenter.cpp @@ -86,7 +86,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp index edeae73b5..9f867b281 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/weather/src/MainWeatherPresenter.cpp @@ -90,7 +90,7 @@ namespace OHOS uint16 keyID = event.GetKeyId(); uint16_t keyState = event.GetState(); // 如果是power键就返回上一级 - if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0) + if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); } diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 8dd532932..be9207fa4 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -1152,19 +1152,12 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "cywee_Inactivity_Info->output_number = %d", cywee_Inactivity_Info->output_number); - static int interval = 0;//久坐间隔时间 switch (cywee_Inactivity_Info->output_number) { case INACTIVITY_MODE_SEDENTARY_OUTPUT: if(cywee_Inactivity_Info->status == 1) { - //NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true); - //根据久坐间隔时间和是否在设置的提醒时间段内判断是否弹出久坐视图 - interval++; - if( interval % SedentaryReminderViewEventListener::GetInstance().GetIntervalTime() == 0){ - SedentaryReminderViewEventListener::GetInstance().SetSedentaryReminderNoteIntervalTime(interval); - NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true); - } + NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true); } else if(cywee_Inactivity_Info->status==9) { diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp index 004fa7a5a..5a28f093a 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp @@ -194,6 +194,7 @@ namespace OHOS SedentaryReminderNoteLabel->SetTextId(STR_SEDENTARY_REMINDER_NOTE); #endif // UpdateLabel(SedentaryReminderNoteLabel,"1",STR_SEDENTARY_REMINDER_NOTE); + SedentaryReminderViewEventListener::GetInstance().SetSedentaryReminderNoteIntervalTime(SedentaryReminderViewEventListener::GetInstance().GetIntervalTime()); SedentaryReminderNoteLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); SedentaryReminderNoteLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); SedentaryReminderNoteLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/ai_chart_icon.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/ai_chart_icon.bin new file mode 100644 index 000000000..0b1706104 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/ai_chart_icon.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b7152b9dfd5e2ee0c45c36e98a54778910358b39617880779ceee7d60a907b2 +size 1944 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/ai_chart_icon_bg.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/ai_chart_icon_bg.bin new file mode 100644 index 000000000..e17f48ce7 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/ai_chart_icon_bg.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b7a2a2a12eb5042502cd7a345ece2fa16fb0dcd7601f7ce4eeddabd45d7c4ae +size 20504 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_chatgpt.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_chatgpt.bin index 95c04b9a3..680ae8dc0 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_chatgpt.bin +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_chatgpt.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fa5149094c14526b56913b4267664319b80efaaa2c25b502efbc040bfcfe823e +oid sha256:8f48b849f7783dd946a8752d329c9d49b37a86ae19a9d4cf763bf7d67f1c45bf size 9624 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_kimi.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_kimi.bin index f121c8f06..8f6bff1a5 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_kimi.bin +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/AIVoice/aimodels/aimodels_kimi.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2edeb79f68820099d597ccfbeabd81466a2e5dec856792fa6cdc5cc5e3130e41 +oid sha256:2e3e7508a7d93e80ea7005122524b28641c77834539d82036291463db059b79b size 9624 -- 2.17.1