From: Caisking <3449750381@qq.com> Date: Thu, 29 Feb 2024 12:13:11 +0000 (+0800) Subject: 1.采用长按方式,而非点击就进入。 X-Git-Tag: release_V1.2.70_20241020_135402~1274^2~47 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=769692f6687d704c405ee6b898e7b0e7dfa78eb6;p=mirrors%2FFD230.git 1.采用长按方式,而非点击就进入。 2.applist里也加入这个slice,长按切换可以延后完成 3.滑动切换缩约图去掉模拟表冠 @袁清梦 --- diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 034dabb39..8cb7a33d1 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -226,8 +226,6 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLangues"); } #endif - /* -------------------------------------------------------------------------- */ - /* ------------------------------- ConfigModel ------------------------------ */ ConfigModel::GetInstance()->LoadJsonData(); /* -------------------------------------------------------------------------- */ 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 457a9e1dd..62e2ecf1d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp @@ -27,7 +27,7 @@ namespace OHOS {VIEW_WEATHER, PNG_APPLIST_WEATHER_IMAGE, PNG_APPLIST_WEATHER_IMAGE, "天气", nullptr}, {VIEW_RECORD, PNG_APPLIST_RECORD_IMAGE, PNG_APPLIST_RECORD_IMAGE, "录音", nullptr}, {VIEW_SETTING, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, "设置", nullptr}, - {VIEW_ROTATE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_UI_SAMPLE_IMAGE, "模拟表冠", nullptr}, + {VIEW_DIALUPDATE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_UI_SAMPLE_IMAGE, "表盘切换", nullptr}, #ifdef SUPPORT_ALIPAY_SEC {VIEW_MAIN_ALIPAY, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_ALIPAY_IMAGE, "支付宝", nullptr}, #endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateModel.h b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateModel.h index 85879b0ab..56f090736 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateModel.h @@ -3,6 +3,23 @@ #include +#define MAX_DIALNUM 4 +typedef struct +{ + const char *title; + const char *thumbnailPath; + const char *dialPath; +} DialInfo; +enum class DialPathType +{ + DIAL_KUMI = 0, + DIAL_GALAXY, + DIAL_DOG, + DIAL_MAOMAO, + DIAL_DEFAULT +}; +extern DialInfo dialInfo[MAX_DIALNUM]; + namespace OHOS { class DialUpdateModel @@ -10,16 +27,16 @@ namespace OHOS public: static DialUpdateModel *GetInstance(); - std::string GetDialConfigPath(); - void UpdateDialConfigPath(const std::string &newPath); - + uint8_t GetDialConfigPath(); // 获取当前表盘信息,方便切换表盘 + bool LoadDialConfigFromJson(); // 加载json + void UpdateDialConfigPath(uint8_t dialpathid); // 切换表盘接口 private: DialUpdateModel(); DialUpdateModel(const DialUpdateModel &); DialUpdateModel &operator=(const DialUpdateModel &); virtual ~DialUpdateModel(); - - std::string dialConfigPath = "user/res/dials/galaxy.bin";; // Member variable to store the dial configuration path + std::string dialConfigPath = "user/res/dialupdate/dial_config.json"; // JSON文件路径 + uint8_t Current_dial = 0; // 目前表盘 }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdatePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdatePresenter.h index c4c0454f6..1c316685b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdatePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdatePresenter.h @@ -33,12 +33,15 @@ namespace OHOS void OnStop() override; DialViewGroup *dialGroup_ = nullptr; static DialUpdatePresenter *GetInstance(); + uint8_t GetShowId(); private: bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; + bool OnDragEnd(UIView &view, const DragEvent &event) override; DialUpdateModel *g_pdialupdatemodel; + uint8_t showid = 0; // 表盘展示Id,默认从第一个开始 }; } // namespace OHOS -#endif // SLEEPDETAIL_PRESENTER_H \ No newline at end of file +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateView.h b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateView.h index 79722dfa4..f572a1341 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/include/DialUpdateView.h @@ -48,15 +48,19 @@ namespace OHOS void TestPicker(); void GetTestView(); + void SetView(); private: - UIViewGroup *container_ = nullptr; UILabel *label1_ = nullptr; UIImageView *image1_ = nullptr; UIButton *button3_ = nullptr; UIButton *button1_ = nullptr; UIButton *button2_ = nullptr; + + std::string labelStr; // 表盘名称 + std::string dialpath; // 展示表盘 + uint8_t dialId; // 表盘Id }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateModel.cpp index 23fab3ac5..377a5adcf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateModel.cpp @@ -6,7 +6,19 @@ */ #include "dialupdate/include/DialUpdateModel.h" +#include +#include +#include "cJSON.h" +#include "wearable_log.h" +// 表盘名称||表盘缩约图||表盘路径 +DialInfo dialInfo[MAX_DIALNUM] = { + {"KUMI表盘", "user/res/dialupdate/KUMI.bin", "user/res/dials/KUMI.bin"}, + {"星空表盘", "user/res/dialupdate/galaxy.bin", "user/res/dials/galaxy.bin"}, + {"小狗表盘", "user/res/dialupdate/dog.bin", "user/res/dials/dog.bin"}, + {"招财猫", "user/res/dialupdate/maomao.bin", "user/res/dials/maomao.bin"}}; + + //{"默认表盘", "user/res/dialupdate/defult_dial.bin", "user/res/dials/defult_dial.bin"} namespace OHOS { DialUpdateModel::DialUpdateModel() {} @@ -18,12 +30,68 @@ namespace OHOS static DialUpdateModel instance; return &instance; } - std::string DialUpdateModel::GetDialConfigPath() + + /** + * @brief 获取当前表盘配置Id + * @return 当前表盘配置Id + */ + uint8_t DialUpdateModel::GetDialConfigPath() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetDialConfigPath:%d", Current_dial); + return Current_dial; + } + + /** + * @brief 更新表盘配置Id + * @param dialpathid 新的表盘Id + */ + void DialUpdateModel::UpdateDialConfigPath(uint8_t dialpathid) { - return dialConfigPath; + Current_dial = dialpathid; // 更新表盘Id + + cJSON *root = cJSON_CreateObject(); + cJSON_AddNumberToObject(root, "Current_dial", Current_dial); + FILE *file = fopen(dialConfigPath.c_str(), "w"); + if (!file) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to UpdateDial JSON file for writing"); + cJSON_Delete(root); + return; + } + char *jsonString = cJSON_Print(root); + fputs(jsonString, file); + fclose(file); + cJSON_Delete(root); + free(jsonString); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdateDialConfigPath:%d", Current_dial); } - void DialUpdateModel::UpdateDialConfigPath(const std::string &newPath) + + /** + * @brief 从JSON文件中加载表盘配置 + * @return 加载是否成功 + */ + bool DialUpdateModel::LoadDialConfigFromJson() { - dialConfigPath = newPath; + cJSON *cjson_json = NULL; + std::ifstream file(dialConfigPath); + if (file.is_open()) + { + std::string json_string((std::istreambuf_iterator(file)), std::istreambuf_iterator()); + file.close(); + // 解析JSON数据 + cjson_json = cJSON_Parse(json_string.c_str()); + if (!cjson_json) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Failed to parse JSON file"); + return false; + } + // 从cJSON对象中提取所需的值 + Current_dial = cJSON_GetObjectItem(cjson_json, "Current_dial")->valueint; + // 删除cJSON对象 + cJSON_Delete(cjson_json); + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LoadDialConfigFromJson:%d", Current_dial); + return true; } + } diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdatePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdatePresenter.cpp index 92f60ca28..b677e0e8d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdatePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdatePresenter.cpp @@ -17,86 +17,131 @@ namespace OHOS DialUpdatePresenter::~DialUpdatePresenter() { - g_pDialUpdatePresenter = nullptr; } DialUpdatePresenter *DialUpdatePresenter::GetInstance() { - - return g_pDialUpdatePresenter; - } - - void DialUpdatePresenter::OnStart() - { - - Presenter::OnStart(); - } - - void DialUpdatePresenter::OnPause(void) - { - - Presenter::OnPause(); + static DialUpdatePresenter instance; + return &instance; } - void DialUpdatePresenter::OnResume(void) + uint8_t DialUpdatePresenter::GetShowId() { - - Presenter::OnResume(); + return showid; } - void DialUpdatePresenter::OnStop(void) + // 退出切换表盘界面 + bool DialUpdatePresenter::OnDrag(UIView &view, const DragEvent &event) { - - Presenter::OnStop(); + return true; } - bool DialUpdatePresenter::OnDrag(UIView &view, const DragEvent &event) + bool DialUpdatePresenter::OnDragEnd(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP) { NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); } + // 右滑 + if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) + { + if (showid == MAX_DIALNUM - 1) + { + showid = 0; + } + else + { + showid++; + } + DialUpdateView::GetInstance()->SetView(); + RootView::GetInstance()->Invalidate(); // 刷新界面 + } + // 左滑 + if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT) + { + if (showid == 0) + { + showid = MAX_DIALNUM - 1; + } + else + { + showid--; + } + DialUpdateView::GetInstance()->SetView(); + RootView::GetInstance()->Invalidate(); // 刷新界面 + } UNUSED(view); return true; } bool DialUpdatePresenter::OnClick(UIView &view, const ClickEvent &event) { - std::string filepath; + // 切换表盘按键 if (strcmp(view.GetViewId(), "button_choose") == 0) { - filepath = "user/res/dials/KUMI.bin"; // 检查是否需要更新表盘路径 - std::string currentPath = g_pdialupdatemodel->GetDialConfigPath(); - if (currentPath != filepath) + uint8_t currentid = g_pdialupdatemodel->GetDialConfigPath(); + if (showid != currentid) { - g_pdialupdatemodel->UpdateDialConfigPath(filepath); + g_pdialupdatemodel->UpdateDialConfigPath(showid); } - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "filepath:%s || currentPath:%s ", filepath.c_str(), currentPath.c_str()); - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "filepath:%d || currentPath:%d ", showid, currentid); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN, TRANSITION_ZOOM); } - if (strcmp(view.GetViewId(), "flowerbudbutton") == 0) + // 检查点击的按钮并展示相应的表盘 + else if (strcmp(view.GetViewId(), "button_right") == 0) { - - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + if (showid == MAX_DIALNUM - 1) + { + showid = 0; + } + else + { + showid++; + } + DialUpdateView::GetInstance()->SetView(); + RootView::GetInstance()->Invalidate(); // 刷新界面 } - if (strcmp(view.GetViewId(), "maomaobutton") == 0) + else if (strcmp(view.GetViewId(), "button_left") == 0) { - - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + if (showid == 0) + { + showid = MAX_DIALNUM - 1; + } + else + { + showid--; + } + DialUpdateView::GetInstance()->SetView(); + RootView::GetInstance()->Invalidate(); // 刷新界面 } - if (strcmp(view.GetViewId(), "momobutton") == 0) - { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showid:%d ", showid, showid); + return true; + } - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); - } - if (strcmp(view.GetViewId(), "maliaobutton") == 0) - { + void DialUpdatePresenter::OnStart() + { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); - } - return true; + Presenter::OnStart(); + } + + void DialUpdatePresenter::OnPause(void) + { + + Presenter::OnPause(); + } + + void DialUpdatePresenter::OnResume(void) + { + + Presenter::OnResume(); + } + + void DialUpdatePresenter::OnStop(void) + { + + Presenter::OnStop(); } -} \ No newline at end of file +} diff --git a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateView.cpp b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateView.cpp index 6fbb7fcb0..f7616068c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/dialupdate/src/DialUpdateView.cpp @@ -14,7 +14,11 @@ */ #include "dialupdate/include/DialUpdateView.h" +#include "dialupdate/include/DialUpdateModel.h" #include "wearable_log.h" +#include + +extern DialInfo dialInfo[MAX_DIALNUM]; namespace OHOS { @@ -70,9 +74,25 @@ namespace OHOS { TestPicker(); } + void DialUpdateView::SetView() + { + dialId = DialUpdatePresenter::GetInstance()->GetShowId(); + labelStr = dialInfo[dialId].title; + dialpath = dialInfo[dialId].thumbnailPath; + label1_->SetText(labelStr.c_str()); + image1_->SetSrc(dialpath.c_str()); + } void DialUpdateView::TestPicker() { + /* -------------------------------- 加载展示表盘信息 -------------------------------- */ + labelStr = dialInfo[dialId].title; + dialpath = dialInfo[dialId].thumbnailPath; + if (labelStr.empty() || dialpath.empty()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialInfo is error!"); + return; + } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TestPicker"); if (container_ == nullptr) { @@ -80,7 +100,7 @@ namespace OHOS container_->SetPosition(0, 0, 466, 466); container_->SetStyle(STYLE_BACKGROUND_OPA, 0); } - + /* -------------------------------------------------------------------------- */ // Add Label to App if (label1_ == nullptr) { @@ -90,9 +110,8 @@ namespace OHOS label1_->Resize(200, 60); // widget's width and height label1_->SetViewId("label_title"); // Set style label1_->SetStyle(STYLE_TEXT_FONT, 26); - // Set additional property - label1_->SetText("经典表盘"); + label1_->SetText(labelStr.c_str()); label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label1_->SetRollSpeed(0); @@ -101,7 +120,6 @@ namespace OHOS // Add to rootView container_->Add(label1_); label1_->SetVisible(true); - // Add ImageView to App if (image1_ == nullptr) { @@ -110,12 +128,8 @@ namespace OHOS image1_->SetPosition(103, 103); // widget's left position and top position image1_->Resize(100, 100); // widget's width and height image1_->SetViewId("image1"); // Set style - // Set additional property - char *image1imagesPath = "/user/res/dialupdate/KUMI.bin"; - - image1_->SetSrc(image1imagesPath); - + image1_->SetSrc(dialpath.c_str()); // Add to rootView container_->Add(image1_); image1_->SetVisible(true); @@ -194,7 +208,6 @@ namespace OHOS container_->Add(button2_); button2_->SetVisible(true); } - void DialUpdateView::OnStart() { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialUpdateView"); @@ -215,6 +228,8 @@ namespace OHOS container_->SetOnDragListener(draglistener); container_->SetTouchable(true); container_->SetDraggable(true); + // 取到展示表盘id + dialId = DialUpdatePresenter::GetInstance()->GetShowId(); GetTestView(); RootView::GetInstance()->Add(container_); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h index 8f52af927..6207979d0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h @@ -52,6 +52,7 @@ namespace OHOS void OnStop() override; virtual void Notify() override; bool OnClick(UIView &view, const ClickEvent &event) override; + bool OnLongPress(UIView &view, const LongPressEvent &event) override; virtual void OnSwipe(UISwipeView &view) override; void SetPage(int8_t id); void SetTaskPeroid(int page); diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h index be960f8be..2e9173a7a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/MainViewSample.h @@ -113,6 +113,7 @@ namespace OHOS WeatherControlView *weatherControlView{nullptr}; TraingView *traingView{nullptr}; ApplistCardView *applistCardView{nullptr}; + UIButton*changebut{nullptr}; /* -------------------------------------------------------------------------- */ UICardPage *recordCard[MAX_CARD]{nullptr}; bool pageStatus[MAX_CARD]{false}; 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 5bf4bea2d..e051d55f0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp @@ -97,7 +97,14 @@ namespace OHOS keyActListener_ = nullptr; } } - + //长按进入切换表盘页面 + bool MainPresenterSample::OnLongPress(UIView &view, const LongPressEvent &event) + { + UNUSED(event); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnLongPress OnLongPress"); + NativeAbility::GetInstance().ChangeSlice(VIEW_DIALUPDATE, TRANSITION_ZOOM); + return true; + } bool MainPresenterSample::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); @@ -291,7 +298,7 @@ namespace OHOS { #if USE_OFFLINE_DIAL DialModelTime::GetInstance()->UpdateTime(); - //DialModelPower::GetInstance()->UpdatePower(); + // DialModelPower::GetInstance()->UpdatePower(); dynamic_cast(view_->GetViewById(WATCH_FACE))->UpdateViewsByPeriodicUpdateData(); #else dynamic_cast(view_->GetViewById(WATCH_FACE))->UpdateTime(); 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 0cc1c0846..89e59bb85 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp @@ -8,7 +8,7 @@ #include "MainViewSample.h" #include "graphic_service.h" #include "dialupdate/include/DialUpdateModel.h" - +extern DialInfo dialInfo[MAX_DIALNUM]; namespace OHOS { @@ -332,19 +332,18 @@ namespace OHOS { #if USE_OFFLINE_DIAL mainClockView = new DialViewGroup(); - #if 0 +#if 0 std::string filePath = dynamic_cast(presenter_)->GetDialPath(); if (filePath.size() == 0) { filePath = RES_PATH "/dials/dog.bin"; } - #endif - std::string filePath = DialUpdateModel::GetInstance()->GetDialConfigPath(); - if (filePath.size() == 0) - { - filePath = RES_PATH "/dials/KUMI.bin"; - } +#endif + // DialUpdateModel::GetInstance()->LoadDialConfigFromJson(); + uint8_t fileid = DialUpdateModel::GetInstance()->GetDialConfigPath(); + std::string filePath = dialInfo[fileid].dialPath; mainClockView->SetDial(filePath); + #else mainClockView = new MainClockView(); #endif @@ -354,6 +353,29 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView new fail"); return nullptr; } + +#if 1 + if (changebut == nullptr) + { + changebut = new UIButton(); + } + changebut->SetPosition(0, 0); // widget's left position and top position + changebut->Resize(466, 466); // widget's width and height + changebut->SetViewId("button1"); // Set style + changebut->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); + changebut->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + // Set additional property + changebut->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfff6eeee, UIButton::PRESSED); + changebut->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + changebut->SetStyleForState(STYLE_BORDER_COLOR, 0xfff3e8e8, UIButton::PRESSED); + changebut->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED); + // Add the CallBack about events + UIView::OnLongPressListener *button1LongPress = static_cast(MainPresenterSample::GetInstance()); + changebut->SetOnLongPressListener(button1LongPress); + // Add to rootView + mainClockView->Add(changebut); + changebut->SetVisible(true); +#endif return mainClockView; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp index 96a14cb43..00a01731a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemPresenter.cpp @@ -94,11 +94,13 @@ namespace OHOS SystemView::GetInstance()->ChangeView(SYSTEMVIEW, SUPERVISEVIEW); return true; } +#if 0 else if (strcmp(view.GetViewId(), SYSTEM_LANGUAGE) == 0) { SystemView::GetInstance()->ChangeView(SYSTEMVIEW, SYSTEMLANGUAGEVIEW); return true; } +#endif else if (strcmp(view.GetViewId(), FACTORY_RESET) == 0) { SystemView::GetInstance()->ChangeView(SYSTEMVIEW, FACTORYRESETVIEW); @@ -163,7 +165,7 @@ namespace OHOS // 用来监听语言切换 bool RadiobuttonOnChangeListener::OnChange(UICheckBox::UICheckBoxState state) { - +#if 0 // 获取字体单例 UIFont *uiFont = UIFont::GetInstance(); if (uiFont == nullptr) @@ -196,6 +198,7 @@ namespace OHOS default: break; } +#endif return true; } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp index 85dc04cba..57ed3a5ae 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp @@ -240,6 +240,7 @@ namespace OHOS // 3.跳转到系统语言界面 bool SystemView::ChangeSystemLanguageView(int16_t thisView) { +#if 1 if (SystemScrollView[thisView] == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemView::ChangeSystemLanguageView"); @@ -252,6 +253,7 @@ namespace OHOS SystemScrollView[thisView] = p_SystemLanguageView->SystemLanguageViewInit(); RootView::GetInstance()->Add(SystemScrollView[thisView]); } +#endif return true; } diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/KUMI.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/KUMI.bin index 05fdb0b19..e9d202a48 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/KUMI.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/KUMI.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dial_defult.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dial_defult.bin deleted file mode 100644 index caf628c1c..000000000 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dial_defult.bin and /dev/null differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dog.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dog.bin index 70ec05041..e74814cc8 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dog.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/dog.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/galaxy.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/galaxy.bin index 48af26f24..3a6a4f688 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/galaxy.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dials/galaxy.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/defult_dial.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/defult_dial.bin new file mode 100644 index 000000000..63c3b8162 Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/defult_dial.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/dial_config.json b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/dial_config.json new file mode 100644 index 000000000..ceca22553 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/dial_config.json @@ -0,0 +1,3 @@ +{ + "Current_dial": 0 +} \ No newline at end of file diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/dog.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/dog.bin new file mode 100644 index 000000000..bd7c69f99 Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/dog.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/flowerbud.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/flowerbud.bin deleted file mode 100644 index 463c237de..000000000 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/flowerbud.bin and /dev/null differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/galaxy.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/galaxy.bin new file mode 100644 index 000000000..7a0469867 Binary files /dev/null and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/galaxy.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maliao.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maliao.bin deleted file mode 100644 index 3c2ba112f..000000000 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maliao.bin and /dev/null differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maomao.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maomao.bin index 170542ce1..f84214ceb 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maomao.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/maomao.bin differ diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/momo.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/momo.bin deleted file mode 100644 index f84214ceb..000000000 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/dialupdate/momo.bin and /dev/null differ