From: Caisking <3449750381@qq.com> Date: Mon, 8 Apr 2024 08:42:02 +0000 (+0800) Subject: 修复表盘问题 X-Git-Tag: release_V1.2.70_20241020_135402~1200^2~24 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=6456b985fa3ae1b7de60c5c4c875bb48e3c17410;p=mirrors%2FFD230.git 修复表盘问题 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index d2d88872a..bd5bc82dd 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -62,6 +62,7 @@ namespace OHOS #define APP_DIAL_PATH "/user/dial" /* ---------------------------------- 卡片管理 --------------------------------- */ static constexpr const char *CARD_CONFIG_PATH = "/user/cardconfig.bin"; + static constexpr const char *DEFAULT_DIAL_PATH = APP_RES_PATH "KUMI.bin"; static constexpr const char *PNG_SET_CARD_ADD = APP_RES_PATH "/MainCard/CARD_ADD.bin"; static constexpr const char *PNG_SET_CARD_DEL = APP_RES_PATH "/MainCard/CARD_DEL.bin"; static constexpr const char *PNG_SET_CARD_HEART = APP_RES_PATH "/MainCard/HeartCrad.bin"; @@ -348,7 +349,7 @@ namespace OHOS static constexpr const char *PNG_SET_DESKTOP_HEXAGONS_IMAGE = APP_RES_PATH "/SET_DESKTOP_HEXAGONS.bin"; static constexpr const char *PNG_SET_DESKTOP_BG_IMAGE = APP_RES_PATH "/SET_DESKTOP_BG.bin"; - static constexpr const char *PNG_SET_DIAL_CLOCK = APP_RES_PATH "/KUMI.bin"; + static constexpr const char *PNG_SET_DIAL_CLOCK = APP_RES_PATH "/KUMIVIEW.bin"; } 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 6b8205bd9..7298f26df 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp @@ -26,7 +26,6 @@ namespace OHOS const AppItem g_nativeAppList[] = { {VIEW_MAIN_ALARM, PNG_APPLIST_ALARM_IMAGE, PNG_APPLIST_ALARM_IMAGE, "闹钟", nullptr}, {VIEW_SETTING, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, "设置", nullptr}, - // {VIEW_DIALUPDATE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_UI_SAMPLE_IMAGE, "表盘切换", nullptr}, {VIEW_COMPASS, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_COMPASS_IMAGE, "指南针", nullptr}, {VIEW_BLOODOXY, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, "血氧饱和度", nullptr}, {VIEW_HEART, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_HEART_IMAGE, "心率检测", nullptr}, diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp index c0731e932..4fb797e58 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp @@ -134,6 +134,7 @@ namespace OHOS } #endif } + if (g_jumpView.count(curViewId) != 0) { NativeAbility::GetInstance().ChangeSlice(g_jumpView[curViewId]); @@ -286,23 +287,31 @@ namespace OHOS } } -void MainPresenterSample::Notify(void) -{ - CardId cardId = view_->GetHorCurrentCard(); - if (cardId == COMPASS) { - SetCompassRotate(); - } else if (cardId == MUSIC_PLAYER) { - SetCircleProgress(); - } else if (cardId == WATCH_FACE) { - DialSetting &setting = GetDialSetting(); - if (setting.dialFlag) { - DialModelTime::GetInstance()->UpdateTime(); - dynamic_cast(view_->GetViewById(WATCH_FACE))->UpdateViewsByPeriodicUpdateData(); - } else { - dynamic_cast(view_->GetViewById(WATCH_FACE))->UpdateTime(); + void MainPresenterSample::Notify(void) + { + CardId cardId = view_->GetHorCurrentCard(); + if (cardId == COMPASS) + { + SetCompassRotate(); + } + else if (cardId == MUSIC_PLAYER) + { + SetCircleProgress(); + } + else if (cardId == WATCH_FACE) + { + DialSetting &setting = GetDialSetting(); + if (setting.dialFlag) + { + DialModelTime::GetInstance()->UpdateTime(); + dynamic_cast(view_->GetViewById(WATCH_FACE))->UpdateViewsByPeriodicUpdateData(); + } + else + { + dynamic_cast(view_->GetViewById(WATCH_FACE))->UpdateTime(); + } } } -} void MainPresenterSample::InitCardSettings(void) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp index a031c0ac5..aa8af4cc2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp @@ -326,7 +326,12 @@ namespace OHOS switch (setting.dialId) { case DIAL_CLOCK: - return new MainClockView(); + { + DialViewGroup *dial = new DialViewGroup(); + dial->SetDial(DEFAULT_DIAL_PATH); + return dial; + } + break; // 添加 break 语句 default: return nullptr; } @@ -406,7 +411,7 @@ namespace OHOS } return weatherControlView; } - + // 主界面心率卡片 UICardPage *MainViewSample::InitHeartRatePage(void) { heartRateView = new HeartRateView(); @@ -428,7 +433,7 @@ namespace OHOS } return activityWeekView; } - + void MainViewSample::SetPage(int16_t page) { if (mainSwipeGroup != nullptr) 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 2fbaa9943..a29bf9c43 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 @@ -9,7 +9,8 @@ #include "SetDialModel.h" #include "SetDialPresenter.h" -namespace OHOS { +namespace OHOS +{ SetDialPresenter::SetDialPresenter() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialPresenter::SetDialPresenter"); @@ -19,7 +20,8 @@ namespace OHOS { SetDialPresenter::~SetDialPresenter() { - if (keyActListenr != nullptr) { + if (keyActListenr != nullptr) + { delete keyActListenr; keyActListenr = nullptr; } @@ -28,11 +30,15 @@ namespace OHOS { void SetDialPresenter::OnStart() { Presenter::OnStart(); - if (keyActListenr == nullptr) { + if (keyActListenr == nullptr) + { keyActListenr = new KeyInputListener(); - if (keyActListenr != nullptr) { + if (keyActListenr != nullptr) + { RootView::GetInstance()->SetOnKeyActListener(keyActListenr); - } else { + } + else + { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnStart: new KeyInputListener fail"); } } @@ -50,10 +56,18 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialPresenter::OnClick"); uint8_t pageIndex = view_->GetCoverflowPage(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialPresenter select pageIndex = %u", pageIndex); - model->SaveDialSetting(pageIndex); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetDialPresenter select pageIndex = %u", pageIndex); + // 目前暂时这样处理 + if (pageIndex == 0) + { + model->SaveDialSetting(1); + } + else + { + model->SaveDialSetting(pageIndex); + } NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); - return true; + return true; } bool SetDialPresenter::OnScroll() @@ -67,7 +81,7 @@ namespace OHOS { return model->GetDialCount(); } - std::vector& SetDialPresenter::GetDialInfo(void) + std::vector &SetDialPresenter::GetDialInfo(void) { return model->GetDialInfo(); } diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/KUMI.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/KUMI.bin index 5532379ee..982845bf5 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/KUMI.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/KUMI.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/KUMIVIEW.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/KUMIVIEW.bin new file mode 100644 index 000000000..5532379ee Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/KUMIVIEW.bin differ