From: Caisking <3449750381@qq.com> Date: Mon, 18 Dec 2023 11:47:24 +0000 (+0800) Subject: 更换表盘背景 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=f1243620704554f2929f67752f0982a25817bd5c;p=mirrors%2FFD230.git 更换表盘背景 --- diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/ui_resource_image.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/ui_resource_image.h index b8c573a9b..3ce0c1bbb 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/ui_resource_image.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/ui_resource_image.h @@ -22,25 +22,29 @@ namespace OHOS { static const int PLAYER_PLAYERSMODEL_REPEATS = 0x20000c; static const int PLAYER_PLAYERHIGHLIGHT = 0x20000d; static const int PLAYER_PRE_BUTTOW = 0x20000e; - static const int CLOCK_HAND24HOUR_IMAGE_PATH = 0x300001; - static const int CLOCK_BIGCIRCLE_IMAGE_PATH = 0x300002; - static const int CLOCK_PROGRESS_IMAGE_PATH = 0x300003; - static const int CLOCK_HOURHAND = 0x300004; - static const int CLOCK_MONDAY_IMAGE_PATH = 0x300005; - static const int CLOCK_CIRCLE_IMAGE_PATH = 0x300006; - static const int CLOCK_SHOE_IMAGE = 0x300007; - static const int CLOCK_FIRDAY_IMAGE_PATH = 0x300008; - static const int CLOCK_WEDNESDAY_IMAGE_PATH = 0x300009; - static const int CLOCK_SUNDAY_IMAGE_PATH = 0x30000a; - static const int CLOCK_SATURDAY_IMAGE_PATH = 0x30000b; - static const int CLOCK_MINUTEHAND = 0x30000c; - static const int CLOCK_MEDCIRCLE_IMAGE_PATH = 0x30000d; - static const int CLOCK_HEARTRATE_IMAGE_PATH = 0x30000e; - static const int CLOCK_MAIN_FACE_IMAGE = 0x30000f; - static const int CLOCK_SMALLCIRCLE_IMAGE_PATH = 0x300010; - static const int CLOCK_THURSDAY_IMAGE_PATH = 0x300011; - static const int CLOCK_SECONDHAND = 0x300012; - static const int CLOCK_TUESDAY_IMAGE_PATH = 0x300013; + static const int CLOCK_CLOCK0 = 0x300001; + static const int CLOCK_CLOCK1 = 0x300002; + static const int CLOCK_CLOCK10 = 0x300003; + static const int CLOCK_CLOCK12 = 0x300004; + static const int CLOCK_CLOCK13 = 0x300005; + static const int CLOCK_CLOCK14 = 0x300006; + static const int CLOCK_CLOCK15 = 0x300007; + static const int CLOCK_CLOCK16 = 0x300008; + static const int CLOCK_CLOCK18 = 0x300009; + static const int CLOCK_CLOCK2 = 0x30000a; + static const int CLOCK_CLOCK4 = 0x30000b; + static const int CLOCK_CLOCK5 = 0x30000c; + static const int CLOCK_CLOCK6 = 0x30000d; + static const int CLOCK_CLOCK7 = 0x30000e; + static const int CLOCK_CLOCK8 = 0x30000f; + static const int CLOCK_CLOCK9 = 0x300010; + static const int CLOCK_CLASSIC_GEOMETRY = 0x300011; + static const int CLOCK_CLOCK_HOUR = 0x300012; + static const int CLOCK_CLOCK_MINUTE = 0x300013; + static const int CLOCK_CLOCK_SECOND = 0x300014; + static const int CLOCK_HOUR = 0x300015; + static const int CLOCK_MINUTE = 0x300016; + static const int CLOCK_SECOND = 0x300017; static const int DROPDOWN_DROPDOWN_BLUETOOTH = 0x400001; static const int DROPDOWN_DROPDOWN_DN_DISTURB = 0x400002; static const int DROPDOWN_DROPDOWN_BLUETOOTH_B = 0x400003; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h b/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h index 1cdd6ab94..b98ed65cf 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h @@ -92,6 +92,7 @@ private: UISweepClock *mainSweepClock{nullptr}; Image *secondHand{nullptr}; Image *minuteHand{nullptr}; + UILabel *dataLabel{nullptr}; Image *hourHand{nullptr}; UIImageView *heartRate{nullptr}; Image *hand24Hour{nullptr}; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp index bd6a8b504..f4114b045 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp @@ -16,6 +16,8 @@ namespace OHOS { static MainClockView *g_pMainClockView = nullptr; + +#if 0 static constexpr uint16_t FONT_DEFAULT_SIZE = 25; static constexpr uint16_t FONT_TEXT_SIZE = 24; static constexpr uint16_t STEP_LABEL_X = 100; @@ -48,6 +50,27 @@ static constexpr uint16_t SMALLCIRCLE_POSITION_X = 202; static constexpr uint16_t SMALLCIRCLE_POSITION_Y = 202; static constexpr uint16_t WEEKDAY_POSITION_X = 193; static constexpr uint16_t WEEKDAY_POSITION_Y = 127; +#endif + +static constexpr uint16_t SECOND_POINT_POSITION_X = 221; +static constexpr uint16_t SECOND_POINT_POSITION_Y = 28; +static constexpr uint16_t MINUTE_POINT_POSITION_X = 221; +static constexpr uint16_t MINUTE_POINT_POSITION_Y = 33; +static constexpr uint16_t HOUR_POINT_POSITION_X = 221; +static constexpr uint16_t HOUR_POINT_POSITION_Y = 87; + +static constexpr uint16_t SECOND_POINT_CENTER_X = 12; +static constexpr uint16_t SECOND_POINT_CENTER_Y = 205; +static constexpr uint16_t MINUTE_POINT_CENTER_X = 12; +static constexpr uint16_t MINUTE_POINT_CENTER_Y = 200; +static constexpr uint16_t HOUR_POINT_CENTER_X = 12; +static constexpr uint16_t HOUR_POINT_CENTER_Y = 146; + + + + + + MainClockView::MainClockView() { @@ -65,6 +88,7 @@ MainClockView::~MainClockView() clockAnimator = nullptr; } mainSweepClock->RemoveAll(); + #if 0 delete curFace; curFace = nullptr; delete stepLabel; @@ -100,6 +124,7 @@ MainClockView::~MainClockView() Remove(mainSweepClock); delete mainSweepClock; mainSweepClock = nullptr; +#endif g_pMainClockView = nullptr; } @@ -110,6 +135,7 @@ MainClockView *MainClockView::GetInstance(void) void MainClockView::InitStepValue() { +#if 0 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainClockView::InitStepValue"); uint32_t stepValue; int weekToday = ActivityModel::GetInstance()->GetWeekToday(); @@ -127,10 +153,12 @@ void MainClockView::InitStepValue() stepLabel->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); stepLabel->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); stepLabel->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); +#endif } bool MainClockView::InitLabelView(void) { +#if 0 UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::MainPresenterSample::GetInstance(); stepLabel = new UILabelButton(); if (stepLabel == nullptr) { @@ -177,11 +205,62 @@ bool MainClockView::InitLabelView(void) weekLabel->SetText("2"); weekLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_TEXT_SIZE); weekLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); +#endif +#if 1 + printf("lable init\n"); + batteryLabel = new UILabel(); + if (batteryLabel == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryLabel new fail"); + return false; + } + batteryLabel->SetPosition(228, 52); // widget's left position and top position + batteryLabel->Resize(66, 33); + batteryLabel->SetText("2%"); + batteryLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + batteryLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28); + batteryLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + mainSweepClock->Add(batteryLabel); + batteryLabel->SetVisible(true); + + if (dataLabel == nullptr) { + dataLabel = new UILabel(); + } + dataLabel->SetPosition(177, 358); // widget's left position and top position + dataLabel->Resize(200, 60); // widget's width and height + dataLabel->SetViewId("data");// Set style + dataLabel->SetStyle(STYLE_TEXT_FONT, 30); + dataLabel->SetStyle(STYLE_LINE_HEIGHT, 30); + dataLabel->SetText("12月22号"); + dataLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + dataLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + dataLabel->SetRollSpeed(0); + dataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + mainSweepClock->Add(dataLabel); + dataLabel->SetVisible(true); + + if (weekLabel == nullptr) { + weekLabel = new UILabel(); + } + weekLabel->SetPosition(194, 395); // widget's left position and top position + weekLabel->Resize(200, 60); // widget's width and height + weekLabel->SetViewId("weekday");// Set style + weekLabel->SetStyle(STYLE_TEXT_FONT, 26); + weekLabel->SetStyle(STYLE_LINE_HEIGHT, 30); + weekLabel->SetText("星期五"); + weekLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + weekLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + weekLabel->SetRollSpeed(0); + weekLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); + + mainSweepClock->Add(weekLabel); + weekLabel->SetVisible(true); +#endif return true; } bool MainClockView::InitCenterCircleView(void) { +#if 0 bigCircle = new Image(); if (bigCircle == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bigCircle new fail"); @@ -208,6 +287,7 @@ bool MainClockView::InitCenterCircleView(void) if (LoadClockImage(smallCircle, CLOCK_CIRCLE_IMAGE_PATH) == false) { return false; } +#endif return true; } @@ -218,7 +298,7 @@ bool MainClockView::InitHandView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "secondHand new fail"); return false; } - if (LoadClockImage(secondHand, CLOCK_SECONDHAND) == false) { + if (LoadClockImage(secondHand, CLOCK_SECOND) == false) { return false; } @@ -227,7 +307,7 @@ bool MainClockView::InitHandView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "minuteHand new fail"); return false; } - if (LoadClockImage(minuteHand, CLOCK_MINUTEHAND) == false) { + if (LoadClockImage(minuteHand, CLOCK_MINUTE) == false) { return false; } hourHand = new Image(); @@ -235,10 +315,10 @@ bool MainClockView::InitHandView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hourHand new fail"); return false; } - if (LoadClockImage(hourHand, CLOCK_HOURHAND) == false) { + if (LoadClockImage(hourHand, CLOCK_HOUR) == false) { return false; } - +#if 0 hand24Hour = new Image(); if (hand24Hour == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hand24Hour new fail"); @@ -247,6 +327,7 @@ bool MainClockView::InitHandView(void) if (LoadClockImage(hand24Hour, CLOCK_HAND24HOUR_IMAGE_PATH) == false) { return false; } +#endif return true; } @@ -283,11 +364,12 @@ bool MainClockView::InitSweepClock(void) } curFace->SetPosition(0, 0); - if (LoadClockImage(curFace, CLOCK_MAIN_FACE_IMAGE) == false) { + if (LoadClockImage(curFace, CLOCK_CLASSIC_GEOMETRY) == false) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "curFace LoadClockImage CLOCK_MAIN_FACE_IMAGE fail"); return false; } - + InitLabelView(); +#if 0 if (InitLabelView() == false) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabelView() fail"); return false; @@ -317,8 +399,9 @@ bool MainClockView::InitSweepClock(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "progress LoadClockImage CLOCK_PROGRESS_IMAGE_PATH fail"); return false; } - +#endif InitHandView(); +#if 0 weekDay = new UIImageView(); if (weekDay == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weekDay new fail"); @@ -329,6 +412,7 @@ bool MainClockView::InitSweepClock(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weekDay LoadClockImage CLOCK_THURSDAY_IMAGE_PATH fail"); return false; } +#endif return true; } @@ -359,6 +443,10 @@ bool MainClockView::InitView(void) } mainSweepClock->Add(curFace); + mainSweepClock->Add(weekLabel); + mainSweepClock->Add(dataLabel); + mainSweepClock->Add(batteryLabel); +#if 0 mainSweepClock->Add(stepLabel); mainSweepClock->Add(heartRate); mainSweepClock->Add(weekLabel); @@ -366,6 +454,8 @@ bool MainClockView::InitView(void) mainSweepClock->Add(weekDay); mainSweepClock->Add(progress); mainSweepClock->Add(batteryLabel); +#endif + Add(mainSweepClock); mainSweepClock->SetDragParentInstead(true); @@ -373,18 +463,19 @@ bool MainClockView::InitView(void) // {214, 3}: position x, y {14, 223}: center x, y mainSweepClock->SetHandImage(UISweepClock::HandType::SECOND_HAND, *secondHand, - { POINT_POSITION_X, SECOND_POINT_POSITION_Y }, { POINT_CENTER_X, POINT_CENTER_Y }); + { SECOND_POINT_POSITION_X, SECOND_POINT_POSITION_Y }, { SECOND_POINT_CENTER_X, SECOND_POINT_CENTER_Y }); mainSweepClock->SetHandImage(UISweepClock::HandType::MINUTE_HAND, *minuteHand, - { POINT_POSITION_X, POINT_POSITION_Y }, { POINT_CENTER_X, POINT_CENTER_Y }); - mainSweepClock->SetHandImage(UISweepClock::HandType::HOUR_HAND, *hourHand, { POINT_POSITION_X, POINT_POSITION_Y }, - { POINT_CENTER_X, POINT_CENTER_Y }); + { MINUTE_POINT_POSITION_X, MINUTE_POINT_POSITION_Y }, { MINUTE_POINT_CENTER_X, MINUTE_POINT_CENTER_Y }); + mainSweepClock->SetHandImage(UISweepClock::HandType::HOUR_HAND, *hourHand, { HOUR_POINT_POSITION_X, HOUR_POINT_POSITION_Y }, + { HOUR_POINT_CENTER_X, HOUR_POINT_CENTER_Y }); +#if 0 mainSweepClock->SetHandCircleImage(UISweepClock::HandType::SECOND_HAND, *smallCircle, { SMALLCIRCLE_POSITION_X, SMALLCIRCLE_POSITION_Y }); mainSweepClock->SetHandCircleImage(UISweepClock::HandType::MINUTE_HAND, *medCircle, { MEDCIRCLE_POSITION_X, MEDCIRCLE_POSITION_Y }); mainSweepClock->SetHandCircleImage(UISweepClock::HandType::HOUR_HAND, *bigCircle, { BIGCIRCLE_POSITION_X, BIGCIRCLE_POSITION_Y }); - +#endif mainSweepClock->SetInitTime24Hour(0, 0, 0); mainSweepClock->SetWorkMode(UISweepClock::WorkMode::NORMAL); InitDateTime(); @@ -406,14 +497,17 @@ bool MainClockView::InitView(void) void MainClockView::RefreshStep(int step) { +#if 0 char stepChar[STEP_CHAR_NUM] = {0}; (void)sprintf_s(stepChar, STEP_CHAR_NUM, "%d", step); stepLabel->SetText(stepChar); +#endif } void MainClockView::RefreshHeartRate(int value) { +#if 0 if (value == 0) { heartRateLabel->SetText("--"); return; @@ -422,6 +516,7 @@ void MainClockView::RefreshHeartRate(int value) (void)sprintf_s(heartRateChar, STEP_CHAR_NUM, "%d", value); heartRateLabel->SetText(heartRateChar); +#endif } void MainClockView::InitDateTime(void) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp index 6e02bea2c..d9e9f9f87 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp @@ -28,7 +28,7 @@ map g_jumpView = { { MAIN_CLICK_WEATHER, VIEW_MAIN_SAMPLE }, { MAIN_CLICK_MESSAGE, VIEW_MAIN_SAMPLE }, // 消息app { MAIN_CLICK_HEARTRATE, VIEW_MAIN_SAMPLE }, // 心率界面 { DROPDOWN_CLICK_ALARM, VIEW_MAIN_ALARM }, // 闹钟app - { DROPDOWN_CLICK_APPLIST,VIEW_APPLIST }, //应用列表 + { DROPDOWN_CLICK_APPLIST,VIEW_APPLIST }, //应用列表 { DROPDOWN_CLICK_SETTING, VIEW_SETTING } }; // 设置界面 map g_chanColor = { { DROPDOWN_CLICK_FINDMYPHONE, DROPDOWN_DROPDOWN_FIND_PHONE_B }, diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp index 4c03c18b0..1b81d2ea5 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp @@ -132,6 +132,7 @@ void MainViewSample::OnStart() mainSwipeGroup->SetLoopState(true); mainSwipeGroup->EnableScreenCap(true); mainSwipeGroup->RegisterSwipeCallback(callback); + //卡片切换 mainSwipeGroup->SetHorCurrentPage(mainClockView->GetViewIndex()); SetContainerView(mainSwipeGroup); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp index 082bfc43d..1c7d0a349 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp @@ -169,7 +169,7 @@ bool ScreenModels::LoadAppImages(std::string file, UIImageView *view, uint32_t r void ScreenModels::PreLoadAppimages(void) { LoadAppMultiImages(PLAYER_IAMGES, PLAYER_PLAYERSMODEL_RANDOM, PLAYER_PLAYERHIGHLIGHT); - LoadAppMultiImages(CLOCK_IAMGES, CLOCK_HAND24HOUR_IMAGE_PATH, CLOCK_TUESDAY_IMAGE_PATH); + LoadAppMultiImages(CLOCK_IAMGES, CLOCK_CLASSIC_GEOMETRY, CLOCK_SECOND); LoadAppMultiImages(COMPASS_IAMGES, COMPASS_ROTATE_CENTER_IMAGE, COMPASS_COMPASS); LoadAppMultiImages(DROPDOWN_IAMGES, DROPDOWN_DROPDOWN_BLUETOOTH, DROPDOWN_DROPDOWN_BRI_SCREEN_B); LoadAppMultiImages(HEART_IAMGES, HEART_HEARTRATECOOR, HEART_HEARTRATE_TOP); diff --git a/code/sdk/application/wearable/ohos_deps/wearable_log.h b/code/sdk/application/wearable/ohos_deps/wearable_log.h index 47b6fd080..c15540acb 100755 --- a/code/sdk/application/wearable/ohos_deps/wearable_log.h +++ b/code/sdk/application/wearable/ohos_deps/wearable_log.h @@ -12,7 +12,7 @@ extern "C" { #endif #endif -// #define WEARABLE_LOG_DEBUG +#define WEARABLE_LOG_DEBUG #ifdef USE_DIAG_LOG #include "soc_diag_util.h" #include "log_oam_logger.h" diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clock/clock.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clock/clock.bin index b450b8529..ffdcc3dc8 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clock/clock.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/clock/clock.bin differ diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/MainClockView.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/MainClockView.h index 627ef3483..27979d039 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/MainClockView.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/MainClockView.h @@ -86,8 +86,9 @@ private: bool LoadClockImage(UIImageView *view, uint32_t resId); UIImageView *curFace{nullptr}; UILabelButton *stepLabel{nullptr}; - UILabel *batteryLabel{nullptr}; - UILabel *weekLabel{nullptr}; + UILabel *batteryLabel = nullptr; + UILabel *weekLabel= nullptr; + UILabel *dataLabel= nullptr; UILabel *heartRateLabel{nullptr}; ClockDialAnimatorCallback *callBack{nullptr}; Animator *clockAnimator{nullptr};