From: 罗正 <1732036298@qq.com> Date: Tue, 20 Aug 2024 11:14:49 +0000 (+0000) Subject: Merge #742 into sdk602patch0626 from refs/changes/742/head X-Git-Tag: release_V1.2.70_20241020_135402~617^2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=bf5886e2f1e36c74f1235235a414ed019f14bba7;p=mirrors%2FFD230.git Merge #742 into sdk602patch0626 from refs/changes/742/head Code review from 罗正 * refs/changes/742/head: (17 commits squashed) - 1. 优化连接中的gif动画,由原来的20帧修改为现在的20帧 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 修改连接动画为60帧 - 添加手机同步歌曲到手表,手表音乐列表同步刷新。 - 音乐列表刷新机制优化在每次切换到音乐列表刷新一次,list高度会根据歌曲数量自适应 - 显示方式界面添加弧形列表样式,并添加对应资源 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 倒计时界面配置多国语言 - 1.运动识别弹窗根据弹窗汇总设置显示时长为10s,并添加震动 2.修复开始按钮的视图Id - 倒计时界面优化修改 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 倒计时优化修改 - 倒计时配置多国语言 - APPlist应用顺序按照KUMI已经重新排列,放入设置中的四个Slice暂未屏蔽等之后加入后再屏蔽 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 1.音乐播放器在切换通道时添加主动连接和断开手机a2dp功能 2.播放器添加连接动画,手表连接手机音乐超时时间设置为5s - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 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/742 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h index fc0599e31..974f2c6e6 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h @@ -531,7 +531,20 @@ enum UIResourceTextId : uint16_t { STR_IGNORE = 518, STR_START = 519, STR_ARC_SCALE_LIST_DISPLAY = 520, - STR_MAX_ID = 521, + STR_COUNT_DOWN = 521, + STR_CUSTOM_TIME = 522, + STR_QUICK_START = 523, + STR_1_MIN = 524, + STR_5_MIN = 525, + STR_10_MIN = 526, + STR_30_MIN = 527, + STR_SET_COUNT_DOWN_NOTE = 528, + STR_COUNTDOWN_ENDS = 529, + STR_MAXIMUM_TIME_REACH = 530, + STR_STOPWATCH_STOP_NOTE = 531, + STR_TMCHBR = 532, + STR_MAXIMUM_TIME_REACH_NOTE = 533, + STR_MAX_ID = 534, }; // UIResourceTextId enum FontLanguageId : uint8_t { diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp index a3b1bcec2..b84bc5eb1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp @@ -55,11 +55,12 @@ namespace OHOS #ifdef A5133_DEMO_CLIENT {VIEW_OBU_MESSAGE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_DEFAULT_IMG, "OBU", STR_OBU_MESSAGE, nullptr}, #endif - {VIEW_MAIN_PHONE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_DEFAULT_IMG, "手机", STR_PHONE, nullptr}, + {VIEW_MAIN_PHONE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_DEFAULT_IMG, "电话", STR_PHONE, nullptr}, #if HEART_APPLIST {VIEW_HEART_CHART, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_DEFAULT_IMG, "心率", STR_HEART_RATE, nullptr}, #endif {VIEW_BLOOD_RESULT, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_DEFAULT_IMG, "血氧", STR_BLOOD_OXYGEN, nullptr}, + {VIEW_SLEEP, PNG_APPLIST_SLEEP_IMAGE, PNG_APPLIST_SLEEP_IMAGE, PNG_APPLIST_DEFAULT_IMG, "睡眠", STR_SLEEP, nullptr}, {VIEW_TRAINING, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_DEFAULT_IMG, "训练", STR_TRAINING, nullptr}, {VIEW_TRAINING_RECORD, PNG_APPLIST_TRAINING_RECORD_IMAGE, PNG_APPLIST_TRAINING_RECORD_IMAGE, PNG_APPLIST_DEFAULT_IMG, "训练记录", STR_TRAINING_RECORD, nullptr}, {VIEW_GOAL, PNG_APPLIST_GOAL_IMAGE, PNG_APPLIST_GOAL_IMAGE, PNG_APPLIST_DEFAULT_IMG, "活动", STR_ACTIVITY, nullptr}, @@ -67,9 +68,9 @@ namespace OHOS #ifdef SUPPORT_ALIPAY_SEC {VIEW_MAIN_ALIPAY, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_DEFAULT_IMG, "支付宝", STR_ALIPAY, nullptr}, #endif - {VIEW_CALCULATOR, PNG_APPLIST_INFORMATION_IMAGE, PNG_APPLIST_INFORMATION_IMAGE, PNG_APPLIST_DEFAULT_IMG, "计算器", STR_CALCULATOR, nullptr}, {VIEW_MESSAGE, PNG_APPLIST_MESSAGE_IMAGE, PNG_APPLIST_MESSAGE_IMAGE, PNG_APPLIST_DEFAULT_IMG, "消息通知", STR_MESSAGE_NOTIFICATION, nullptr}, {VIEW_COMPASS, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_DEFAULT_IMG, "指南针", STR_COMPASS, nullptr}, + {VIEW_CALCULATOR, PNG_APPLIST_INFORMATION_IMAGE, PNG_APPLIST_INFORMATION_IMAGE, PNG_APPLIST_DEFAULT_IMG, "计算器", STR_CALCULATOR, nullptr}, {VIEW_RECORD, PNG_APPLIST_RECORD_IMAGE, PNG_APPLIST_RECORD_IMAGE, PNG_APPLIST_DEFAULT_IMG, "录音", STR_RECORD, nullptr}, {VIEW_FLASHLIGHT, PNG_APPLIST_FLASHLIGHT_IMAGE, PNG_APPLIST_FLASHLIGHT_IMAGE, PNG_APPLIST_DEFAULT_IMG, "手电筒", STR_FLASHLIGHT, nullptr}, {VIEW_WEATHER, PNG_APPLIST_WEATHER_IMAGE, PNG_APPLIST_WEATHER_IMAGE, PNG_APPLIST_DEFAULT_IMG, "天气", STR_WEATHER, nullptr}, @@ -78,19 +79,20 @@ namespace OHOS {VIEW_RESPIRATORY_TRAINING, PNG_APPLIST_BREATHE_IMAGE, PNG_APPLIST_BREATHE_IMAGE, PNG_APPLIST_DEFAULT_IMG, "呼吸训练", STR_BREATH_TRAINING, nullptr}, {VIEW_TAKEPHOTOS, PNG_APPLIST_TACKEPHOTOS_IMAGE, PNG_APPLIST_TACKEPHOTOS_IMAGE, PNG_APPLIST_DEFAULT_IMG, "遥控拍照", STR_REMOTE_SHOOTING, nullptr}, {VIEW_MAIN_ALARM, PNG_APPLIST_ALARM_IMAGE, PNG_APPLIST_ALARM_IMAGE, PNG_APPLIST_DEFAULT_IMG, "闹钟", STR_ALARM, nullptr}, - {VIEW_SOUND_VIBRATION, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_DEFAULT_IMG, "声音", STR_SOUND, nullptr}, {VIEW_FIND_PHONE, PNG_APPLIST_FINDPHONE_IMAGE, PNG_APPLIST_FINDPHONE_IMAGE, PNG_APPLIST_DEFAULT_IMG, "查找手机", STR_FIND_PHONE, nullptr}, + /* ------------------------------- 放入设置中后将会屏蔽 ------------------------------- */ {VIEW_DNOTDISTURB, PNG_APPLIST_DISTURB_IMAGE, PNG_APPLIST_DISTURB_IMAGE, PNG_APPLIST_DEFAULT_IMG, "勿扰模式", STR_DO_NOT_DISTURB, nullptr}, {VIEW_ADD_CARD, PNG_APPLIST_CARDSET_IMAGE, PNG_APPLIST_CARDSET_IMAGE, PNG_APPLIST_DEFAULT_IMG, "卡片管理", STR_CARD_MANAGEMENT, nullptr}, {VIEW_SET_DIAL_STYLE, PNG_APPLIST_CHANGEDIAL_IMAGE, PNG_APPLIST_CHANGEDIAL_IMAGE, PNG_APPLIST_DEFAULT_IMG, "更换表盘", STR_WATCH_FACE, nullptr}, {VIEW_SAVEELE, PNG_APPLIST_SAVEELE_IMAGE, PNG_APPLIST_SAVEELE_IMAGE, PNG_APPLIST_DEFAULT_IMG, "省电模式", STR_POWER_SAVE_MODE, nullptr}, - {VIEW_SLEEP, PNG_APPLIST_SLEEP_IMAGE, PNG_APPLIST_SLEEP_IMAGE, PNG_APPLIST_DEFAULT_IMG, "睡眠", STR_SLEEP, nullptr}, + /* -------------------------------------------------------------------------- */ // {VIEW_MUSIC_PLAYER, PNG_APPLIST_MUSIC_IMAGE, PNG_APPLIST_MUSIC_IMAGE, PNG_APPLIST_DEFAULT_IMG, "音乐播放器", STR_MUSIC, nullptr}, {VIEW_OFFLINEVOICE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_DEFAULT_IMG, "语音助手", STR_VOICE_ASSISTANT, nullptr}, // {VIEW_SCHEDULE, PNG_APPLIST_SCHEDULE_IMAGE, PNG_APPLIST_SCHEDULE_IMAGE, PNG_APPLIST_DEFAULT_IMG, "schedule", STR_SCHEDULE, nullptr}, {VIEW_SETTING, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_DEFAULT_IMG, "设置", STR_SETTINGS, nullptr}, #if 0 /*屏蔽Slice*/ + {VIEW_SOUND_VIBRATION, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_DEFAULT_IMG, "声音", STR_SOUND, nullptr}, {VIEW_PHONEDIR, PNG_APPLIST_CALLLOG_IMAGE, PNG_APPLIST_CALLLOG_IMAGE, PNG_APPLIST_DEFAULT_IMG, "常用联系人", STR_FAVORITE_CONTACTS, nullptr}, {VIEW_THEME_STYLE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_DEFAULT_IMG, "显示方式", STR_DISPLAY_MODE, nullptr}, {VIEW_BRIGHTNESSLEVEL, PNG_APPLIST_BRIGHTNESSLEVEL_IMAGE, PNG_APPLIST_BRIGHTNESSLEVEL_IMAGE, PNG_APPLIST_DEFAULT_IMG, "亮度调节", STR_BRIGHTNESS_ADJUSTMENT, nullptr}, diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h index d946e7b39..c87e4a417 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-07 18:15:53 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-07 19:57:56 + * @LastEditTime: 2024-08-20 10:17:35 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownPresenter.h */ #ifndef MAIN_COUNTDOWN_PRESENTER_H @@ -11,7 +11,7 @@ #include "View.h" #include "Presenter.h" #include "MainCountDownView.h" - +#include "ui_resource_string.h" /*倒计时的主界面*/ namespace OHOS { diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownView.h b/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownView.h index 2eaf8ca2a..0b43fbb59 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-07 18:15:53 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-08 16:15:10 + * @LastEditTime: 2024-08-20 10:48:28 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/include/MainCountDownView.h */ #ifndef MAIN_COUNTDOWN_VIEW_H @@ -67,7 +67,7 @@ namespace OHOS private: void MainCountDownViewInit(void); void ClearAll(void); - UILabelButtonExt *SetUILabelButton(int x, int y, int w, int h, const char *id, const char *text); + UILabelButtonExt *SetUILabelButton(int x, int y, int w, int h, const char *id, const char *text,int textId); UIViewGroup *group = nullptr; UIScrollView *scrollView[COUNTDOWN_MAX_VIEW]{nullptr}; UILabelExt *Title{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp index b93a47fc0..a8a031f74 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-07 18:15:53 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-09 15:38:14 + * @LastEditTime: 2024-08-20 15:16:40 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp */ #include "countdown/include/CountDownModel.h" @@ -12,8 +12,8 @@ #include "wearable_log.h" #include "countdown/include/MainCountDownView.h" #include -#include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h" - +#include "ConfigModel.h" +#include "ui_resource_string.h" namespace OHOS { /* -------------------------------------------------------------------------- */ @@ -354,7 +354,7 @@ namespace OHOS static void CountDown_TimerCallbackProc(int data) { CountDownModel::g_CountDownTimes--; // 每次回调减少1秒 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "g_CountDownTimes:%d\n", CountDownModel::g_CountDownTimes); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "g_CountDownTimes:%d\n", CountDownModel::g_CountDownTimes); if (MainCountDownView::GetInstance() == nullptr) { @@ -386,7 +386,8 @@ namespace OHOS MainCountDownView::GetInstance()->GetStartCountDownView()->GetPlayOrPauseToggleButton()->SetVisible(false); MainCountDownView::GetInstance()->GetStartCountDownView()->GetRepeatButton()->SetVisible(true); CountDownModel::GetInstance()->CountDown_StopTimer(); // 停止定时器 - MainCountDownView::GetInstance()->GetStartCountDownView()->GetShowCountDownTimelabel()->SetText("倒计时结束"); + MainCountDownView::GetInstance()->GetStartCountDownView()->GetShowCountDownTimelabel()->SetTextId(STR_COUNTDOWN_ENDS);//倒计时结束 + MainCountDownView::GetInstance()->GetStartCountDownView()->GetShowCountDownTimelabel()->ForceResetText(); // 进行倒计时结束时的额外操作,比如播放声音、显示通知等 // CountDownModel::GetInstance()->StartRingtonePlayback(); CountDownModel::GetInstance()->RequestStartRingtone(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownTimeConfigView.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownTimeConfigView.cpp index da9348c0e..3863c7917 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownTimeConfigView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownTimeConfigView.cpp @@ -91,13 +91,13 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTimeConfigView::Title is new fail!!"); return nullptr; } - Title->SetPosition(83, 52, 300, 40); + Title->SetPosition(83, 50, 300, 35); Title->SetStyle(STYLE_TEXT_FONT, 30); Title->SetStyle(STYLE_LINE_HEIGHT, 35); - Title->SetText("倒计时"); - Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + Title->SetTextId(STR_COUNT_DOWN);//倒计时 + Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - Title->SetRollSpeed(40); + Title->SetRollSpeed(70); Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ timePicker = new UITimePicker(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownTimeNotNullView.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownTimeNotNullView.cpp index dbb2cd97b..f2d4dc97a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownTimeNotNullView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownTimeNotNullView.cpp @@ -73,13 +73,13 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTimeNotNullView::Title is new fail!!"); return nullptr; } - Title->SetPosition(83, 52, 300, 40); + Title->SetPosition(83, 50, 300, 35); Title->SetStyle(STYLE_TEXT_FONT, 30); Title->SetStyle(STYLE_LINE_HEIGHT, 35); - Title->SetText("倒计时"); - Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + Title->SetTextId(STR_COUNT_DOWN); // 倒计时 + Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - Title->SetRollSpeed(40); + Title->SetRollSpeed(70); Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ Attention = new UIImageView(); @@ -98,27 +98,34 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTimeNotNullView::AttentionLabel is new fail!!"); return nullptr; } - AttentionLabel->SetPosition(33, 253, 400, 40); + AttentionLabel->SetPosition(53, 253, 360, 35); AttentionLabel->SetStyle(STYLE_TEXT_FONT, 30); AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - AttentionLabel->SetText("请先设置好倒计时间"); - AttentionLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + AttentionLabel->SetTextId(STR_SET_COUNT_DOWN_NOTE); // 请先设置好倒计时间 + AttentionLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - AttentionLabel->SetRollSpeed(40); + AttentionLabel->SetRollSpeed(70); AttentionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ + button = new UILabelButtonExt(); if (button == nullptr) { - button = new UILabelButtonExt(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTimeNotNullView::button is new fail!!"); + return nullptr; } button->SetPosition(0, 366, 466, 100); button->SetViewId(COUNTDOWNTIMENOTNULLVIEWRETURNBUTTON); button->SetImageSrc(PNG_466x100BUTTON_IMAGE, PNG_466x100BUTTON_IMAGE); - button->SetText("知道了"); + button->SetTextId(STR_KONW); // 知道了 button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); button->SetStyle(STYLE_LINE_HEIGHT, 35); button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED); UIView::OnClickListener *buttonClick = static_cast(MainCountDownPresenter::GetInstance()); + if (buttonClick == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTimeNotNullView::buttonClick is new fail!!"); + return nullptr; + } button->SetOnClickListener(buttonClick); /* ----------------------------------- Add ---------------------------------- */ scrollView->Add(Title); diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp index 2680cbae7..6a7674a9e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/MainCountDownView.cpp @@ -142,13 +142,13 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Title is new fail!!"); return; } - Title->SetPosition(83, 55, 300, 40); + Title->SetPosition(83, 50, 300, 35); Title->SetStyle(STYLE_TEXT_FONT, 30); Title->SetStyle(STYLE_LINE_HEIGHT, 35); - Title->SetText("倒计时"); - Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + Title->SetTextId(STR_COUNT_DOWN); // 倒计时 + Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - Title->SetRollSpeed(40); + Title->SetRollSpeed(70); Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------- CUSTOM_COUNTDOWN ------------------------- */ CUSTOM_COUNTDOWN = new UILabelButtonExt(); @@ -161,7 +161,7 @@ namespace OHOS CUSTOM_COUNTDOWN->SetViewId(COUNTDOWN_LABELBUTTON_VIEWID); CUSTOM_COUNTDOWN->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffa800); CUSTOM_COUNTDOWN->SetStyle(STYLE_BORDER_RADIUS, 100); - CUSTOM_COUNTDOWN->SetText("自定义时间"); + CUSTOM_COUNTDOWN->SetTextId(STR_CUSTOM_TIME); // 自定义时间 CUSTOM_COUNTDOWN->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); CUSTOM_COUNTDOWN->SetStyle(STYLE_LINE_HEIGHT, 35); CUSTOM_COUNTDOWN->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED); @@ -172,37 +172,37 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QuickStart is new fail!!"); return; } - QuickStart->SetPosition(83, 270, 300, 40); + QuickStart->SetPosition(83, 270, 300, 35); QuickStart->SetStyle(STYLE_TEXT_FONT, 30); QuickStart->SetStyle(STYLE_LINE_HEIGHT, 35); - QuickStart->SetText("快速开始"); - QuickStart->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + QuickStart->SetTextId(STR_QUICK_START); + QuickStart->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); QuickStart->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - QuickStart->SetRollSpeed(40); + QuickStart->SetRollSpeed(70); QuickStart->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* ----------------------- COUNTDOWN_ONE_MINUTE_BUTTON ---------------------- */ - COUNTDOWN_ONE_MINUTE_BUTTON = SetUILabelButton(43, 345, 180, 150, COUNTDOWN_ONE_MINUTE_BUTTON_VIEWID, "1分钟"); + COUNTDOWN_ONE_MINUTE_BUTTON = SetUILabelButton(43, 345, 180, 150, COUNTDOWN_ONE_MINUTE_BUTTON_VIEWID, "1分钟", STR_1_MIN); if (COUNTDOWN_ONE_MINUTE_BUTTON == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "COUNTDOWN_ONE_MINUTE_BUTTON is new fail!!"); return; } /* ---------------------- COUNTDOWN_FIVE_MINUTE_BUTTON ---------------------- */ - COUNTDOWN_FIVE_MINUTE_BUTTON = SetUILabelButton(243, 345, 180, 150, COUNTDOWN_FIVE_MINUTE_BUTTON_VIEWID, "5分钟"); + COUNTDOWN_FIVE_MINUTE_BUTTON = SetUILabelButton(243, 345, 180, 150, COUNTDOWN_FIVE_MINUTE_BUTTON_VIEWID, "5分钟", STR_5_MIN); if (COUNTDOWN_FIVE_MINUTE_BUTTON == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "COUNTDOWN_FIVE_MINUTE_BUTTON is new fail!!"); return; } /* ----------------------- COUNTDOWN_TEN_MINUTE_BUTTON ---------------------- */ - COUNTDOWN_TEN_MINUTE_BUTTON = SetUILabelButton(43, 515, 180, 150, COUNTDOWN_TEN_MINUTE_BUTTON_VIEWID, "10分钟"); + COUNTDOWN_TEN_MINUTE_BUTTON = SetUILabelButton(43, 515, 180, 150, COUNTDOWN_TEN_MINUTE_BUTTON_VIEWID, "10分钟", STR_10_MIN); if (COUNTDOWN_TEN_MINUTE_BUTTON == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "COUNTDOWN_TEN_MINUTE_BUTTON is new fail!!"); return; } /* --------------------- COUNTDOWN_THIRTY_MINUTE_BUTTON --------------------- */ - COUNTDOWN_THIRTY_MINUTE_BUTTON = SetUILabelButton(243, 515, 180, 150, COUNTDOWN_THIRTY_MINUTE_BUTTON_VIEWID, "30分钟"); + COUNTDOWN_THIRTY_MINUTE_BUTTON = SetUILabelButton(243, 515, 180, 150, COUNTDOWN_THIRTY_MINUTE_BUTTON_VIEWID, "30分钟", STR_30_MIN); if (COUNTDOWN_THIRTY_MINUTE_BUTTON == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "COUNTDOWN_THIRTY_MINUTE_BUTTON is new fail!!"); @@ -218,7 +218,7 @@ namespace OHOS } } - UILabelButtonExt *MainCountDownView::SetUILabelButton(int x, int y, int w, int h, const char *id, const char *text) + UILabelButtonExt *MainCountDownView::SetUILabelButton(int x, int y, int w, int h, const char *id, const char *text, int textId) { UILabelButtonExt *button = new UILabelButtonExt(); if (button == nullptr) @@ -232,7 +232,8 @@ namespace OHOS button->SetImagePosition(72, 30); ImageInfo *img = ImageCacheManager::GetInstance().LoadSingleRes(COUNTDOWM_TIMER_ICON); button->SetImageSrc(img, img); - button->SetText(text); + // button->SetText(text); + button->SetTextId(textId); button->SetAlign(TEXT_ALIGNMENT_LEFT); button->SetLabelPosition(51, 61); button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); diff --git a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp index e93ec1234..d5b3083f5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/countdown/src/StartCountDownView.cpp @@ -95,13 +95,13 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CountDownTimeNotNullView::Title is is new fail!!"); return nullptr; } - Title->SetPosition(83, 52, 300, 40); + Title->SetPosition(83, 50, 300, 35); Title->SetStyle(STYLE_TEXT_FONT, 30); Title->SetStyle(STYLE_LINE_HEIGHT, 35); - Title->SetText("倒计时"); - Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + Title->SetTextId(STR_COUNT_DOWN); // 倒计时 + Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - Title->SetRollSpeed(40); + Title->SetRollSpeed(70); Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ showCountDownTimelabel = new UILabelExt(); @@ -114,9 +114,10 @@ namespace OHOS showCountDownTimelabel->SetStyle(STYLE_TEXT_FONT, 80); showCountDownTimelabel->SetStyle(STYLE_LINE_HEIGHT, 94); showCountDownTimelabel->SetText(CountDownModel::GetInstance()->GetCountDownTime().c_str()); - showCountDownTimelabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + showCountDownTimelabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); showCountDownTimelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); showCountDownTimelabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 80); + showCountDownTimelabel->SetRollSpeed(70); /* -------------------------------------------------------------------------- */ vectorImage = new UIImageView(); if (vectorImage == nullptr) @@ -142,9 +143,11 @@ namespace OHOS showTheRingTime->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); showTheRingTime->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); /* -------------------------------------------------------------------------- */ + play_or_pause_toggleButton = new UIToggleButton(); if (play_or_pause_toggleButton == nullptr) { - play_or_pause_toggleButton = new UIToggleButton(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "play_or_pause_toggleButton is new fail!!"); + return nullptr; } play_or_pause_toggleButton->SetPosition(248, 321, 100, 100); play_or_pause_toggleButton->SetViewId(PlayOrPauseToggleButton_ViewID); @@ -156,13 +159,13 @@ namespace OHOS play_or_pause_toggleButton->SetVisible(true); /* -------------------------------------------------------------------------- */ - // Add Button to App + endbutton = new UIButton(); if (endbutton == nullptr) { - endbutton = new UIButton(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "endbutton is new fail!!"); + return nullptr; } - endbutton->SetPosition(118, 321); - endbutton->Resize(100, 100); + endbutton->SetPosition(118, 321, 100, 100); endbutton->SetViewId(STARTCOUNTDOWNVIEWRETURNBUTTON); endbutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); endbutton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); @@ -171,15 +174,19 @@ namespace OHOS endbutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED); endbutton->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED); UIView::OnClickListener *buttonClick = static_cast(MainCountDownPresenter::GetInstance()); + if (buttonClick == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "buttonClick is new fail!!"); + return nullptr; + } endbutton->SetOnClickListener(buttonClick); - /* ----------------------------------- Add ---------------------------------- */ - + RepeatButton = new UIButton(); if (nullptr == RepeatButton) { - RepeatButton = new UIButton(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "endbutton is new fail!!"); + return nullptr; } - RepeatButton->SetPosition(248, 321); - RepeatButton->Resize(100, 100); + RepeatButton->SetPosition(248, 321, 100, 100); RepeatButton->SetViewId(RepeatButtonViewID); RepeatButton->SetStyle(STYLE_BACKGROUND_COLOR, 0x00); RepeatButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); @@ -187,10 +194,11 @@ namespace OHOS RepeatButton->SetImageSrc(RepeatButtonImagePath, RepeatButtonImagePath); RepeatButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED); RepeatButton->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED); - UIView::OnClickListener * RepeatButtonClick = static_cast(MainCountDownPresenter::GetInstance()); + UIView::OnClickListener *RepeatButtonClick = static_cast(MainCountDownPresenter::GetInstance()); RepeatButton->SetOnClickListener(RepeatButtonClick); RepeatButton->SetVisible(false); + /* ----------------------------------- Add ---------------------------------- */ scrollView->Add(Title); scrollView->Add(showCountDownTimelabel); scrollView->Add(vectorImage); @@ -220,7 +228,7 @@ namespace OHOS return play_or_pause_toggleButton; } - UIButton * StartCountDownView::GetRepeatButton(void) + UIButton *StartCountDownView::GetRepeatButton(void) { return RepeatButton; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h index 37be7a259..27b1d98a7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.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 17:11:32 + * @LastEditTime: 2024-08-20 17:18:32 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h */ @@ -101,6 +101,8 @@ public: void SetMusicSource(bool value); void UpdateMusicPlayerList(void); bool GetCurrentMusicIsPlaying(void); + void PlayerMusic_StartTimer(uint32_t interval = 1000); + void PlayerMusic_StopTimer(void); private: bool musicSourceFlag{false};//音乐来源标志:false:默认为手表音乐,true:手机音乐 private: diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h index 519943b3e..31b761ebb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.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:10:15 + * @LastEditTime: 2024-08-20 17:57:54 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersPresenter.h */ @@ -240,7 +240,6 @@ public: void OnClickSuccBack(void); void OnClickConnFailBack(void); void OnClickFailBack(void); - void UpdatePlayerView(bool musicSourceType, bool phoneMusicConnectStatus); void SetPlaybackProgress(int64_t value); void SetPlayerState(bool value); void PlayerbackReset(void); 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 d8b5f973a..5e1304da1 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-14 11:26:39 + * @LastEditTime: 2024-08-20 17:39:13 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h */ @@ -34,6 +34,7 @@ #include "player/include/MusicPlayerSourceView.h" #include "player/include/MusicPlayerBluetoothDisConView.h" #include "player/include/MusicPlayerBTConnectFailedView.h" +#include "aivoice/include/AiVoiceConnectingView.h" namespace OHOS { #define PLAY_PROGRESS_MIN 0 @@ -98,7 +99,7 @@ namespace OHOS UICircleProgress *GetPlaybackProgress(void); UICheckBox::UICheckBoxState GetPlayerButtonState(void); - void UpdatePlayerView(bool musicSourceType, bool phoneMusicConnectStatus); + void UpdatePlayerView(void); void UpdateMusicListStatus(void); void OnClickBackKeyToMainMusicPlayerView(void); @@ -152,6 +153,7 @@ namespace OHOS UIViewGroup *musicListGroupView{nullptr}; // 音乐列表视图 MusicPlayerBluetoothDisConView *musicPlayerBluetoothDisConView{nullptr}; // 蓝牙未连接视图 MusicPlayerBTConnectFailedView *musicPlayerBTConnectFailedView{nullptr}; // 蓝牙连接失败视图 + AiVoiceConnectingView *musicPlayerConnectingView{nullptr}; // 连接动画 private: UIView::OnClickListener *clickListener{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp index bb47b64d4..1bef02af6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp @@ -67,15 +67,16 @@ namespace OHOS // 1.a2dp未连接,向手机发起a2dp连接 // 如果蓝牙没连接直接是跳转到蓝牙连接失败视图,连接了就有一个主动去连手机的a2dp过程,5秒超市 - playersPresenter->UpdatePlayerView(PlayersModel::GetInstance()->GetMusicSource(), phonebluetoothcon && a2dp); - if (!phonebluetoothcon) { playersView->ChangeView(PlayersView::MUSIC_SOURCE_VIEW, PlayersView::MUSIC_BLUETOOTH_DISCONN_VIEW); } - else if (phonebluetoothcon && !a2dp) + else if (phonebluetoothcon && !a2dp) // 如果手机蓝牙已连接但手表与手机的a2dp未连接手表主动去连接a2dp { - playersView->ChangeView(PlayersView::MUSIC_SOURCE_VIEW, PlayersView::MUSIC_BT_CONNECTFAILED_VIEW); + /* -------------------------------------------------------------------------- */ + uapi_a2dp_snk_connect(); // 切换通道主动连接atdp + /* -------------------------------------------------------------------------- */ + playersView->ChangeView(PlayersView::MUSIC_SOURCE_VIEW, PlayersView::MUISC_CONNECTING); } else if (phonebluetoothcon && a2dp) { @@ -87,8 +88,12 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick watchLableButton"); PlayersModel::GetInstance()->SetMusicSource(false); UpdateBluetoothHeadSetViewIsVisible(); - - playersPresenter->UpdatePlayerView(PlayersModel::GetInstance()->GetMusicSource(), phonebluetoothcon && a2dp); + /* -------------------------------------------------------------------------- */ + if (a2dp) + { + uapi_a2dp_snk_disconnect(); // 切换通道主动断开atdp + } + /* -------------------------------------------------------------------------- */ } else if (button == bluetoothHeadsetLableButton) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp index 3e2aa2c79..e2dd531dd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp @@ -15,6 +15,9 @@ #include "bluetooth/include/BluetoothModel.h" #include #include +#include "cmsis_os.h" +#include +#include namespace OHOS { static constexpr int VOLUME_MAXIMUM = 100; @@ -801,6 +804,92 @@ bool PlayersModel::GetCurrentMusicIsPlaying(void) } return false; } + + /* -------------------------------------------------------------------------- */ + static osTimerId_t g_timer = NULL; + static int g_PlayerTimes = 5; + + static void PlayerMusic_TimerCallbackProc(int data) + { + g_PlayerTimes--; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "g_PlayerTimes = %d",g_PlayerTimes); + PlayersView *playersView = PlayersView::GetInstance(); + if (playersView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView nullptr err"); + return; + } + if(g_PlayerTimes < 0) /*5秒超时*/ + { + playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MUSIC_BT_CONNECTFAILED_VIEW); + } + else + { + bool a2dp = uapi_a2dp_snk_get_device_connect_state();// 获取a2dp连接状态 + if(a2dp) + { + playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MAIN_MUSICPLAYER_VIEW); + } + } + return; + } + static void PlayerMusic_TimerCallback(int data) + { + GraphicService::GetInstance()->PostGraphicEvent(std::bind(PlayerMusic_TimerCallbackProc, data)); + } + + void PlayersModel::PlayerMusic_StartTimer(uint32_t interval) + { + /* -------------------------- 1.检查定时器是否已经存在,如果存在则返回 ------------------------- */ + if (g_timer != NULL) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersModel::StopWatch_StartTimer Timer already exists!!"); + return; + } + + /* --------------------------------- 2.创建定时器 -------------------------------- */ + g_timer = osTimerNew((osTimerFunc_t)PlayerMusic_TimerCallback, osTimerPeriodic, NULL, NULL); + // 检查定时器创建是否成功 + if (g_timer == NULL) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayersModel::StopWatch_StartTimer Timer create failed!!"); + return; + } + + /* ----------------------------- 3.将毫秒转换为系统时钟节拍数 ---------------------------- */ + int tick = osMs2Tick(interval); + + /* --------------------------------- 4.启动定时器 -------------------------------- */ + // g_timerStartTimestamp = GetCurrentTimestamp(); // 假设GetCurrentTimestamp()是获取当前时间戳的函数 + osStatus_t ret = osTimerStart(g_timer, tick); + /* -------------------- 5.检查定时器启动是否成功,如果启动失败,删除定时器并置为 NULL -------------------- */ + if (ret != osOK) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[StopWatch_StartTimer]osTimerDelete failed, ret = %lx!!", ret); + if (g_timer != NULL) + { + ret = osTimerDelete(g_timer); + } + g_timer = NULL; + return; + } + return; + } + + void PlayersModel::PlayerMusic_StopTimer(void) + { + // 检查定时器是否存在 + if (g_timer != NULL) + { + // 删除定时器并置为 NULL + osStatus_t ret = osTimerDelete(g_timer); + if (ret != osOK) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); + } + g_timer = NULL; + g_PlayerTimes = 5; + } + } } #ifdef __cplusplus 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 858364f59..27beed95a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp @@ -1474,16 +1474,6 @@ bool PlayersPresenter::OnClick(UIView &view, const ClickEvent &event) return false; } -void PlayersPresenter::UpdatePlayerView(bool musicSourceType, bool phoneMusicConnectStatus) -{ - PlayersView *playersView = PlayersView::GetInstance(); - if (playersView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView GetInstance fail"); - return; - } - playersView->UpdatePlayerView(musicSourceType,phoneMusicConnectStatus); -} - void PlayersPresenter::SetPlaybackProgress(int64_t value) { PlayersView *playersView = PlayersView::GetInstance(); 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 204cce835..f981c7dc8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -488,6 +488,12 @@ namespace OHOS delete musicPlayerBTConnectFailedView; musicPlayerBTConnectFailedView = nullptr; } + if (musicPlayerConnectingView != nullptr) + { + PlayersModel::GetInstance()->PlayerMusic_StopTimer(); + delete musicPlayerConnectingView; + musicPlayerConnectingView = nullptr; + } for (int i = MAIN_MUSICPLAYER_VIEW; i < MUSICPLAYERJUMPVIEWID_MAX; i++) { @@ -922,11 +928,15 @@ namespace OHOS } /*刷新播放器界面的组件状态*/ - void PlayersView::UpdatePlayerView(bool musicSourceType, bool phoneMusicConnectStatus) + void PlayersView::UpdatePlayerView(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdatePlayerView"); // 1.a2dp未连接,向手机发起a2dp连接 + bool phonebluetoothcon = SettingModel::GetInstance().GetPhoneConnectStatus(); // 获取手机连接状态 + bool a2dp = uapi_a2dp_snk_get_device_connect_state(); // 获取a2dp连接状态 + bool phoneMusicConnectStatus = phonebluetoothcon && a2dp; + bool musicSourceType = PlayersModel::GetInstance()->GetMusicSource(); // 2. ImageInfo *image; if (musicSourceType) @@ -989,9 +999,7 @@ namespace OHOS return false; } /* -------------------------------------------------------------------------- */ - bool phonebluetoothcon = SettingModel::GetInstance().GetPhoneConnectStatus(); // 获取手机连接状态 - bool a2dp = uapi_a2dp_snk_get_device_connect_state(); // 获取a2dp连接状态 - UpdatePlayerView(PlayersModel::GetInstance()->GetMusicSource(), phonebluetoothcon && a2dp); + UpdatePlayerView(); /* -------------------------------------------------------------------------- */ PlayersListGroup::GetInstance()->SetUpListCase(); @@ -1238,6 +1246,7 @@ namespace OHOS {PlayersView::MUSIC_DELETE_VIEW, &PlayersView::ChangeToMusicDeleteView}, {PlayersView::MUSIC_BLUETOOTH_DISCONN_VIEW, &PlayersView::ChangeToMusicBluetoothDisConnectView}, {PlayersView::MUSIC_BT_CONNECTFAILED_VIEW, &PlayersView::ChangeToMusicBluetoothConnectFailedView}, + {PlayersView::MUISC_CONNECTING, &PlayersView::ChangeToMusicConnectingView}, }; /*根据传入的 interface 值,在 ViewMapper 数组中查找匹配的 viewId*/ @@ -1278,10 +1287,37 @@ namespace OHOS return true; } + static const short PlayerDestroyMapper[] = { + PlayersView::MUISC_CONNECTING, + }; + /*删除临时视图*/ void PlayersView::DestroyTempView(int16_t hideView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersView::DestroyTempView"); + int viewSize = sizeof(PlayerDestroyMapper) / sizeof(PlayerDestroyMapper[0]); + for (int i = 0; i < viewSize; i++) + { + if (hideView == PlayerDestroyMapper[i]) + { + Remove(group[hideView]); + group[hideView] = nullptr; + break; + } + } + switch (hideView) + { + case PlayersView::MUISC_CONNECTING: + PlayersModel::GetInstance()->PlayerMusic_StopTimer(); + if (musicPlayerConnectingView) + { + delete musicPlayerConnectingView; + musicPlayerConnectingView = nullptr; + } + break; + default: + break; + } } /*视图切换*/ @@ -1313,6 +1349,7 @@ namespace OHOS { Add(group[thisView]); } + UpdatePlayerView(); return true; } @@ -1372,7 +1409,7 @@ namespace OHOS group[thisView] = groupview; Add(group[thisView]); } - UpdateMusicListStatus();/*每次切换到音乐列表都将更新一次列表*/ + UpdateMusicListStatus(); /*每次切换到音乐列表都将更新一次列表*/ return true; } @@ -1448,27 +1485,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]); - // } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayersView::ChangeToMusicConnectingView"); + if (group[thisView] == nullptr) + { + musicPlayerConnectingView = new AiVoiceConnectingView(); + if (musicPlayerConnectingView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new playerListDelSongView fail"); + return false; + } + UIViewGroup *groupview = musicPlayerConnectingView->CreateAiVoiceConnectingView(1); + if (groupview == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "new group[%d] fail", thisView); + return false; + } + group[thisView] = groupview; + Add(group[thisView]); + } + PlayersModel::GetInstance()->PlayerMusic_StartTimer(); return true; } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp index f8fc69b0c..2dfd7d38d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp @@ -2,13 +2,14 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-18 09:09:13 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-22 10:51:12 + * @LastEditTime: 2024-08-20 17:42:37 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp */ #include "settings/include/SettingModel.h" #include "main/include/PullUpDownView.h" #include "ui_resource_string.h" #include "classicbluetooth/include/BluetoothServiceOptionsView.h" +#include "player/include/PlayersView.h" namespace OHOS { SettingModel::SettingModel() {} @@ -99,5 +100,9 @@ namespace OHOS { BluetoothServiceOptionsView::GetInstance()->Button_UPdata(); } + if(PlayersView::GetInstance()) + { + PlayersView::GetInstance()->UpdatePlayerView(); + } } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h index f866b60ae..dc906baa6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-04 15:13:51 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-07 17:07:38 + * @LastEditTime: 2024-08-20 11:25:11 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/stopwatch/include/MainStopWatchPresenter.h */ #ifndef MAIN_STOPWATCH_PRESENTER_H @@ -12,6 +12,7 @@ #include "View.h" #include "MainStopWatchView.h" #include +#include "ui_resource_string.h" /*秒表主视图*/ namespace OHOS { 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 d9284b70f..4c32e7d27 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchPresenter.cpp @@ -272,7 +272,7 @@ namespace OHOS { StopWatchModel::GetInstance()->StopWatch_PauseTimer(); // 暂停定时器 m_button->SetViewId(ResetOrMarkButton_RESET2_VIEWID); - m_button->SetImageSrc(ResetOrMarkButtonImg_Reset2, nullptr); + m_button->SetImageSrc(ResetOrMarkButtonImg_Reset2, ResetOrMarkButtonImg_Reset2); m_button->Invalidate(); } return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp index 165ae0266..cfac70da8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/MainStopWatchView.cpp @@ -30,78 +30,83 @@ namespace OHOS void MainStopWatchView::ClearAll() { - group->RemoveAll(); - scrollView[MAIN_STOPWATCH]->RemoveAll(); - - if (stopWatchlabel != nullptr) + if (group != nullptr) { - delete stopWatchlabel; - stopWatchlabel = nullptr; - } + group->RemoveAll(); + scrollView[MAIN_STOPWATCH]->RemoveAll(); - if (showTimelabel != nullptr) - { - delete showTimelabel; - showTimelabel = nullptr; - } + if (stopWatchlabel != nullptr) + { + delete stopWatchlabel; + stopWatchlabel = nullptr; + } - if (PlayOrPausecheckBox != nullptr) - { - delete PlayOrPausecheckBox; - PlayOrPausecheckBox = nullptr; - } + if (showTimelabel != nullptr) + { + delete showTimelabel; + showTimelabel = nullptr; + } - if (ResetOrMarkbutton != nullptr) - { - delete ResetOrMarkbutton; - ResetOrMarkbutton = nullptr; - } + if (PlayOrPausecheckBox != nullptr) + { + delete PlayOrPausecheckBox; + PlayOrPausecheckBox = nullptr; + } - if (LineImage != nullptr) - { - delete LineImage; - LineImage = nullptr; - } + if (ResetOrMarkbutton != nullptr) + { + delete ResetOrMarkbutton; + ResetOrMarkbutton = nullptr; + } - if (list != nullptr) - { - delete list; - list = nullptr; - } + if (LineImage != nullptr) + { + delete LineImage; + LineImage = nullptr; + } - if (listadapter != nullptr) - { - delete listadapter; - listadapter = nullptr; - } + if (list != nullptr) + { + delete list; + list = nullptr; + } - if (listdata != nullptr) - { - listdata->Clear(); - delete listdata; - listdata = nullptr; - } + if (listadapter != nullptr) + { + delete listadapter; + listadapter = nullptr; + } - if (scrollView[MAIN_STOPWATCH] != nullptr) - { - delete scrollView[MAIN_STOPWATCH]; - scrollView[MAIN_STOPWATCH] = nullptr; - } + if (listdata != nullptr) + { + listdata->Clear(); + delete listdata; + listdata = nullptr; + } - if (p_StopWatchRecordCycleToLimitView != nullptr) - { - delete p_StopWatchRecordCycleToLimitView; - p_StopWatchRecordCycleToLimitView = nullptr; - } + if (scrollView[MAIN_STOPWATCH] != nullptr) + { + delete scrollView[MAIN_STOPWATCH]; + scrollView[MAIN_STOPWATCH] = nullptr; + } - if (p_StopWatchRecordTimeToLimitView != nullptr) - { - delete p_StopWatchRecordTimeToLimitView; - p_StopWatchRecordTimeToLimitView = nullptr; - } + if (p_StopWatchRecordCycleToLimitView != nullptr) + { + delete p_StopWatchRecordCycleToLimitView; + p_StopWatchRecordCycleToLimitView = nullptr; + } + + if (p_StopWatchRecordTimeToLimitView != nullptr) + { + delete p_StopWatchRecordTimeToLimitView; + p_StopWatchRecordTimeToLimitView = nullptr; + } + + for (int i = MAIN_STOPWATCH; i < STOPWATCH_MAXVIEWID; i++) + { + scrollView[MAIN_STOPWATCH] = nullptr; + } - if (group != nullptr) - { delete group; group = nullptr; } @@ -251,13 +256,13 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "stopWatchlabel new fail!!"); return; } - stopWatchlabel->SetPosition(83, 52, 300, 40); + stopWatchlabel->SetPosition(83, 50, 300, 35); stopWatchlabel->SetStyle(STYLE_TEXT_FONT, 30); stopWatchlabel->SetStyle(STYLE_LINE_HEIGHT, 35); - stopWatchlabel->SetText("秒表"); - stopWatchlabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + stopWatchlabel->SetTextId(STR_STOPWATCH); // 秒表 + stopWatchlabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); stopWatchlabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - stopWatchlabel->SetRollSpeed(40); + stopWatchlabel->SetRollSpeed(70); stopWatchlabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); stopWatchlabel->SetVisible(true); /* ------------------------------ showTimelabel ----------------------------- */ @@ -295,6 +300,11 @@ namespace OHOS list->SetPosition(56, 170, 360, 100); list->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); list->SetReboundSize(30); + list->SetThrowDrag(true); + list->SetIntercept(true); + list->SetMaxScrollDistance(1000); + list->SetDragACCLevel(5); + list->SetSwipeACCLevel(800); /*设置手指抬起屏幕后的补偿距离。*/ list->SetVisible(false); /* ------------------------------- listadapter ------------------------------ */ listadapter = new TextAdapter(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchModel.cpp index 3b64f189e..d7276cf39 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchModel.cpp @@ -82,7 +82,7 @@ namespace OHOS static void StopWatch_TimerCallbackProc(int data) { g_StopWatchTimes += 10; // 每次回调增加10毫秒 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "g_StopWatchTimes:%d\n", g_StopWatchTimes); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "g_StopWatchTimes:%d\n", g_StopWatchTimes); if (MainStopWatchView::GetInstance() == nullptr) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchRecordCycleToLimitView.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchRecordCycleToLimitView.cpp index feca45ee8..276d7f90c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchRecordCycleToLimitView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchRecordCycleToLimitView.cpp @@ -1,6 +1,7 @@ #include "stopwatch/include/StopWatchRecordCycleToLimitView.h" #include "stopwatch/include/MainStopWatchPresenter.h" #include "UiConfig.h" +#include "wearable_log.h" /*弹窗视图:到达最高圈数99时弹出*/ namespace OHOS { @@ -9,19 +10,19 @@ namespace OHOS StopWatchRecordCycleToLimitView::StopWatchRecordCycleToLimitView() { - + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StopWatchRecordCycleToLimitView::StopWatchRecordCycleToLimitView"); g_pStopWatchRecordCycleToLimitView = this; } StopWatchRecordCycleToLimitView::~StopWatchRecordCycleToLimitView() { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StopWatchRecordCycleToLimitView::~StopWatchRecordCycleToLimitView"); ClearAll(); g_pStopWatchRecordCycleToLimitView = nullptr; } StopWatchRecordCycleToLimitView *StopWatchRecordCycleToLimitView::GetInstance() { - return g_pStopWatchRecordCycleToLimitView; } // 初始化秒表到达最高圈数时弹出的视图 @@ -37,19 +38,29 @@ namespace OHOS if (Title == nullptr) { Title = new UILabelExt(); + if (Title == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Title new fail"); + return nullptr; + } } - Title->SetPosition(83, 52, 300, 40); + Title->SetPosition(83, 50, 300, 35); Title->SetStyle(STYLE_TEXT_FONT, 30); Title->SetStyle(STYLE_LINE_HEIGHT, 35); - Title->SetText("秒表"); - Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + Title->SetTextId(STR_STOPWATCH); // 秒表 + Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - Title->SetRollSpeed(40); + Title->SetRollSpeed(70); Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ if (AttentionImage == nullptr) { AttentionImage = new UIImageView(); + if (AttentionImage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AttentionImage new fail"); + return nullptr; + } } AttentionImage->SetPosition(193, 121, 100, 100); AttentionImage->SetStyle(STYLE_BORDER_RADIUS, 100); @@ -58,29 +69,44 @@ namespace OHOS if (AttentionLabel == nullptr) { AttentionLabel = new UILabelExt(); + if (AttentionLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AttentionLabel new fail"); + return nullptr; + } } - AttentionLabel->SetPosition(83, 253, 300, 40); + AttentionLabel->SetPosition(83, 253, 300, 35); AttentionLabel->SetStyle(STYLE_TEXT_FONT, 30); AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - AttentionLabel->SetText("当前已达到了最高圈数"); - AttentionLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + AttentionLabel->SetTextId(STR_TMCHBR); // 当前已达到了最高计数 + AttentionLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff)); - AttentionLabel->SetRollSpeed(40); + AttentionLabel->SetRollSpeed(70); AttentionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ if (button == nullptr) { button = new UILabelButtonExt(); + if (button == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "button new fail"); + return nullptr; + } } button->SetPosition(0, 366, 466, 100); button->SetViewId(CycleToLimitReturnButton_VIEWID); button->SetImageSrc(PNG_466x100BUTTON_IMAGE, PNG_466x100BUTTON_IMAGE); - button->SetText("知道了"); + button->SetTextId(STR_KONW); button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); button->SetStyle(STYLE_LINE_HEIGHT, 35); button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED); UIView::OnClickListener *buttonClick = static_cast(MainStopWatchPresenter::GetInstance()); + if (buttonClick == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "buttonClick new fail"); + return nullptr; + } button->SetOnClickListener(buttonClick); /* ----------------------------------- Add ---------------------------------- */ scrollView->Add(Title); @@ -93,30 +119,29 @@ namespace OHOS void StopWatchRecordCycleToLimitView::ClearAll() { - scrollView->RemoveAll(); - - if (Title != nullptr) - { - delete Title; - Title = nullptr; - } - if (AttentionImage != nullptr) - { - delete AttentionImage; - AttentionImage = nullptr; - } - if (AttentionLabel != nullptr) - { - delete AttentionLabel; - AttentionLabel = nullptr; - } - if (button != nullptr) - { - delete button; - button = nullptr; - } if (scrollView != nullptr) { + scrollView->RemoveAll(); + if (Title != nullptr) + { + delete Title; + Title = nullptr; + } + if (AttentionImage != nullptr) + { + delete AttentionImage; + AttentionImage = nullptr; + } + if (AttentionLabel != nullptr) + { + delete AttentionLabel; + AttentionLabel = nullptr; + } + if (button != nullptr) + { + delete button; + button = nullptr; + } delete scrollView; scrollView = nullptr; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchRecordTimeToLimitView.cpp b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchRecordTimeToLimitView.cpp index 241bd2cbb..8df7a038a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchRecordTimeToLimitView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/stopwatch/src/StopWatchRecordTimeToLimitView.cpp @@ -1,7 +1,7 @@ #include "stopwatch/include/StopWatchRecordTimeToLimitView.h" #include "stopwatch/include/MainStopWatchPresenter.h" #include "UiConfig.h" - +#include "wearable_log.h" /*弹窗视图:到达最高时间99:59.99时弹出*/ namespace OHOS { @@ -10,11 +10,13 @@ namespace OHOS StopWatchRecordTimeToLimitView::StopWatchRecordTimeToLimitView() { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StopWatchRecordTimeToLimitView::StopWatchRecordTimeToLimitView"); g_pStopWatchRecordTimeToLimitView = this; } StopWatchRecordTimeToLimitView::~StopWatchRecordTimeToLimitView() { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StopWatchRecordTimeToLimitView::~StopWatchRecordTimeToLimitView"); ClearAll(); g_pStopWatchRecordTimeToLimitView = nullptr; } @@ -36,19 +38,29 @@ namespace OHOS if (Title == nullptr) { Title = new UILabelExt(); + if (Title == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Title new fail"); + return nullptr; + } } - Title->SetPosition(83, 52, 300, 40); + Title->SetPosition(83, 50, 300, 35); Title->SetStyle(STYLE_TEXT_FONT, 30); Title->SetStyle(STYLE_LINE_HEIGHT, 35); - Title->SetText("秒表"); - Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + Title->SetTextId(STR_STOPWATCH); // 秒表 + Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - Title->SetRollSpeed(40); + Title->SetRollSpeed(70); Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ if (AttentionImage == nullptr) { AttentionImage = new UIImageView(); + if (AttentionImage == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AttentionImage new fail"); + return nullptr; + } } AttentionImage->SetPosition(193, 121, 100, 100); AttentionImage->SetStyle(STYLE_BORDER_RADIUS, 100); @@ -57,43 +69,63 @@ namespace OHOS if (AttentionLabel_1 == nullptr) { AttentionLabel_1 = new UILabelExt(); + if (AttentionLabel_1 == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AttentionLabel_1 new fail"); + return nullptr; + } } - AttentionLabel_1->SetPosition(83, 235, 300, 40); + AttentionLabel_1->SetPosition(83, 235, 300, 35); AttentionLabel_1->SetStyle(STYLE_TEXT_FONT, 30); AttentionLabel_1->SetStyle(STYLE_LINE_HEIGHT, 35); - AttentionLabel_1->SetText("当前已达到了最长时间"); - AttentionLabel_1->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + AttentionLabel_1->SetTextId(STR_MAXIMUM_TIME_REACH_NOTE); // 当前已达到了最长时间 + AttentionLabel_1->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); AttentionLabel_1->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); AttentionLabel_1->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff)); - AttentionLabel_1->SetRollSpeed(40); + AttentionLabel_1->SetRollSpeed(70); AttentionLabel_1->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* ---------------------------- AttentionLabel_2 ---------------------------- */ if (AttentionLabel_2 == nullptr) { AttentionLabel_2 = new UILabelExt(); + if (AttentionLabel_2 == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AttentionLabel_2 new fail"); + return nullptr; + } } - AttentionLabel_2->SetPosition(33, 279, 400, 40); + AttentionLabel_2->SetPosition(53, 279, 360, 35); AttentionLabel_2->SetStyle(STYLE_TEXT_FONT, 30); AttentionLabel_2->SetStyle(STYLE_LINE_HEIGHT, 35); - AttentionLabel_2->SetText("表秒自动暂停,请重新开始"); - AttentionLabel_2->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + AttentionLabel_2->SetTextId(STR_STOPWATCH_STOP_NOTE); // 秒表自动暂停,请重新开始 + AttentionLabel_2->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); AttentionLabel_2->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); AttentionLabel_2->SetTextColor(Color::GetColorFromRGBA(0xaa, 0xaa, 0xaa, 0xff)); - AttentionLabel_2->SetRollSpeed(40); + AttentionLabel_2->SetRollSpeed(70); AttentionLabel_2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ if (button == nullptr) { button = new UILabelButtonExt(); + if (button == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "button new fail"); + return nullptr; + } } button->SetPosition(0, 366, 466, 100); button->SetViewId(TimeToLimitReturnButton_VIEWID); button->SetImageSrc(PNG_466x100BUTTON_IMAGE, PNG_466x100BUTTON_IMAGE); - button->SetText("知道了"); + button->SetTextId(STR_KONW); button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); button->SetStyle(STYLE_LINE_HEIGHT, 35); button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED); UIView::OnClickListener *buttonClick = static_cast(MainStopWatchPresenter::GetInstance()); + if (buttonClick == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "buttonClick new fail"); + return nullptr; + } button->SetOnClickListener(buttonClick); /* ----------------------------------- Add ---------------------------------- */ scrollView->Add(Title); @@ -107,29 +139,30 @@ namespace OHOS void StopWatchRecordTimeToLimitView::ClearAll() { - scrollView->RemoveAll(); - if (Title != nullptr) - { - delete Title; - Title = nullptr; - } - if (AttentionImage != nullptr) - { - delete AttentionImage; - AttentionImage = nullptr; - } - if (AttentionLabel_1 != nullptr) - { - delete AttentionLabel_1; - AttentionLabel_1 = nullptr; - } - if (button != nullptr) - { - delete button; - button = nullptr; - } if (scrollView != nullptr) { + scrollView->RemoveAll(); + if (Title != nullptr) + { + delete Title; + Title = nullptr; + } + if (AttentionImage != nullptr) + { + delete AttentionImage; + AttentionImage = nullptr; + } + if (AttentionLabel_1 != nullptr) + { + delete AttentionLabel_1; + AttentionLabel_1 = nullptr; + } + if (button != nullptr) + { + delete button; + button = nullptr; + } + delete scrollView; scrollView = nullptr; } 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 ff5de3a97..fc65cf674 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 @@ -1139,11 +1139,6 @@ void MsgCenterNotifyArAlertProc(const Topic topic, Request* req) { return; } - const power_display_svr_api_t *display_api = power_display_svr_get_api(); - if (display_api->get_screen_state() != SCREEN_ON) - { - display_api->turn_on_screen(); - } MotionRecognitionViewEventListener::GetInstance().SetMotionTypeId(*motionType); NotificationManager::GetInstance()->ShowNotify(showMotionRecognitionNotify, (uint16_t)topic, true); } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp index 2dbd7a4fd..c4c9770a0 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-17 16:44:20 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-19 11:25:09 + * @LastEditTime: 2024-08-20 11:01:16 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp */ #include "notification_manager.h" @@ -19,7 +19,8 @@ #include #include "ConfigModel.h" #include "traing/include/TraingModel.h" - +#include "ui_service.h" +#include "vibrator_service.h" namespace OHOS { @@ -292,7 +293,7 @@ namespace OHOS MotionRecognitionStartButton = new UIButton(); } MotionRecognitionStartButton->SetPosition(238, MotionRecognitionNoteLabel->GetY() + MotionRecognitionNoteLabel->GetHeight() + 40, 170, 90); - MotionRecognitionStartButton->SetViewId(MOTION_RECOGNITION_IGNORE_BUTTONVIEWID); + MotionRecognitionStartButton->SetViewId(MOTION_RECOGNITION_START_BUTTONVIEWID); MotionRecognitionStartButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c); MotionRecognitionStartButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED); MotionRecognitionStartButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); @@ -330,6 +331,10 @@ namespace OHOS MotionRecognitionScrollView->Add(MotionRecognitionIgnoreLabel); MotionRecognitionGroupView->Add(MotionRecognitionScrollView); } + /* -------------------------------------------------------------------------- */ + ScreenTurnOn(10*1000);//显示时长10s + ui_api_vibrate_once_func(); + /* -------------------------------------------------------------------------- */ NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeMotionRecognitionView); return MotionRecognitionGroupView; } diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang index 0f091fb31..a7601977f 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h index fc0599e31..974f2c6e6 100644 --- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h @@ -531,7 +531,20 @@ enum UIResourceTextId : uint16_t { STR_IGNORE = 518, STR_START = 519, STR_ARC_SCALE_LIST_DISPLAY = 520, - STR_MAX_ID = 521, + STR_COUNT_DOWN = 521, + STR_CUSTOM_TIME = 522, + STR_QUICK_START = 523, + STR_1_MIN = 524, + STR_5_MIN = 525, + STR_10_MIN = 526, + STR_30_MIN = 527, + STR_SET_COUNT_DOWN_NOTE = 528, + STR_COUNTDOWN_ENDS = 529, + STR_MAXIMUM_TIME_REACH = 530, + STR_STOPWATCH_STOP_NOTE = 531, + STR_TMCHBR = 532, + STR_MAXIMUM_TIME_REACH_NOTE = 533, + STR_MAX_ID = 534, }; // UIResourceTextId enum FontLanguageId : uint8_t { diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang index f82b5f251..9e4029325 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang differ diff --git a/tools/language_tool/Language_xml/input_list_en.txt b/tools/language_tool/Language_xml/input_list_en.txt index 86267f05c..677da9ead 100644 --- a/tools/language_tool/Language_xml/input_list_en.txt +++ b/tools/language_tool/Language_xml/input_list_en.txt @@ -510,7 +510,7 @@ STR_4G_NOTE$Note: After opening, the power consumption of the watch will be incr STR_MUSIC_PLAYER_SOURCE_NOTE$Please enter Music - Music Source from the watch app interface, set it to Mobile Mode and try again STR_MUSIC_LIST_IS_EMPTY$The current music list is empty, please download and add via APP STR_BT_HEADSET_RESCAN$Rescan -STR_BT_HEADSET_NOFOND$No headset Bluetooth device can be found +STR_BT_HEADSET_NOFOND$No Bluetooth headset device can be found STR_SCHEDULE$Schedule STR_SCHEDULE_TITLE$Schedule management STR_SCHEDULE_NO_DATA$No schedules @@ -518,4 +518,16 @@ STR_SCHEDULE_NO_DATA_PROMPT$Please sync with the APP STR_NO_PAIRED_DEV$No paired devices are available STR_IGNORE$Ignore STR_START$Start -STR_ARC_SCALE_LIST_DISPLAY$Arc list display \ No newline at end of file +STR_ARC_SCALE_LIST_DISPLAY$Arc list display +STR_COUNT_DOWN$Count Down +STR_CUSTOM_TIME$Custom time +STR_QUICK_START$Quick start +STR_1_MIN$1min +STR_5_MIN$5min +STR_10_MIN$10min +STR_30_MIN$30min +STR_SET_COUNT_DOWN_NOTE$Please set up the countdown room first +STR_COUNTDOWN_ENDS$Countdown ends +STR_MAXIMUM_TIME_REACH$The maximum time has been reached +STR_STOPWATCH_STOP_NOTE$Stopwatch stops automatically, please restart +STR_TMCHBR$The maximum count has been reached \ No newline at end of file diff --git a/tools/language_tool/Language_xml/input_list_zh.txt b/tools/language_tool/Language_xml/input_list_zh.txt index 8b688eb3a..6900f9dbd 100644 --- a/tools/language_tool/Language_xml/input_list_zh.txt +++ b/tools/language_tool/Language_xml/input_list_zh.txt @@ -510,7 +510,7 @@ STR_4G_NOTE$注:开启后,手表功耗会提高,待机时间会缩短 STR_MUSIC_PLAYER_SOURCE_NOTE$请从手表端应用界面进入“音乐”-“音乐来源”,设置为“手机模式”后重试 STR_MUSIC_LIST_IS_EMPTY$当前音乐列表为空请通过APP下载添加 STR_BT_HEADSET_RESCAN$重新搜索 -STR_BT_HEADSET_NOFOND$当前搜索不到耳机蓝牙设备 +STR_BT_HEADSET_NOFOND$当前搜索不到蓝牙耳机设备 STR_SCHEDULE$日程 STR_SCHEDULE_TITLE$日程管理 STR_SCHEDULE_NO_DATA$当前无日程 @@ -518,4 +518,16 @@ STR_SCHEDULE_NO_DATA_PROMPT$请先通过APP同步 STR_NO_PAIRED_DEV$暂无已配对设备 STR_IGNORE$忽略 STR_START$开始 -STR_ARC_SCALE_LIST_DISPLAY$弧形列表显示 \ No newline at end of file +STR_ARC_SCALE_LIST_DISPLAY$弧形列表显示 +STR_COUNT_DOWN$倒计时 +STR_CUSTOM_TIME$自定义时间 +STR_QUICK_START$快速开始 +STR_1_MIN$1分钟 +STR_5_MIN$5分钟 +STR_10_MIN$10分钟 +STR_30_MIN$30分钟 +STR_SET_COUNT_DOWN_NOTE$请先设置好倒计时间 +STR_COUNTDOWN_ENDS$倒计时结束 +STR_MAXIMUM_TIME_REACH_NOTE$当前已达到了最长时间 +STR_STOPWATCH_STOP_NOTE$秒表自动暂停,请重新开始 +STR_TMCHBR$当前已达到了最高计数 \ No newline at end of file diff --git a/tools/language_tool/Language_xml/language.xlsx b/tools/language_tool/Language_xml/language.xlsx index 9dab50fa2..924ee89cd 100644 Binary files a/tools/language_tool/Language_xml/language.xlsx and b/tools/language_tool/Language_xml/language.xlsx differ diff --git a/tools/language_tool/Language_xml/language_en.xml b/tools/language_tool/Language_xml/language_en.xml index 306a5e106..7d04ae171 100644 --- a/tools/language_tool/Language_xml/language_en.xml +++ b/tools/language_tool/Language_xml/language_en.xml @@ -511,7 +511,7 @@ - + @@ -520,4 +520,16 @@ + + + + + + + + + + + + diff --git a/tools/language_tool/Language_xml/language_zh.xml b/tools/language_tool/Language_xml/language_zh.xml index 8470de53d..5533e5cdc 100644 --- a/tools/language_tool/Language_xml/language_zh.xml +++ b/tools/language_tool/Language_xml/language_zh.xml @@ -511,7 +511,7 @@ - + @@ -520,4 +520,16 @@ + + + + + + + + + + + + diff --git a/tools/language_tool/font/en.lang b/tools/language_tool/font/en.lang index 0f091fb31..a7601977f 100644 Binary files a/tools/language_tool/font/en.lang and b/tools/language_tool/font/en.lang differ diff --git a/tools/language_tool/font/ui_resource_string.h b/tools/language_tool/font/ui_resource_string.h index fc0599e31..974f2c6e6 100644 --- a/tools/language_tool/font/ui_resource_string.h +++ b/tools/language_tool/font/ui_resource_string.h @@ -531,7 +531,20 @@ enum UIResourceTextId : uint16_t { STR_IGNORE = 518, STR_START = 519, STR_ARC_SCALE_LIST_DISPLAY = 520, - STR_MAX_ID = 521, + STR_COUNT_DOWN = 521, + STR_CUSTOM_TIME = 522, + STR_QUICK_START = 523, + STR_1_MIN = 524, + STR_5_MIN = 525, + STR_10_MIN = 526, + STR_30_MIN = 527, + STR_SET_COUNT_DOWN_NOTE = 528, + STR_COUNTDOWN_ENDS = 529, + STR_MAXIMUM_TIME_REACH = 530, + STR_STOPWATCH_STOP_NOTE = 531, + STR_TMCHBR = 532, + STR_MAXIMUM_TIME_REACH_NOTE = 533, + STR_MAX_ID = 534, }; // UIResourceTextId enum FontLanguageId : uint8_t { diff --git a/tools/language_tool/font/zh.lang b/tools/language_tool/font/zh.lang index f82b5f251..9e4029325 100644 Binary files a/tools/language_tool/font/zh.lang and b/tools/language_tool/font/zh.lang differ