+/***
+ * @Date: 2024-07-05 11:09:20
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-09-04 15:06:30
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStyleView.h
+ */
/*
* Copyright (c) CompanyNameMagicTag 2024. All rights reserved.
* Description: SetDialStyleView.h
#include "components/ui_label.h"
#include "components/ui_view_group.h"
#include "components/ui_toggle_button.h"
+#include "components/ui_button.h"
#include "SetDialView.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
#include "View.h"
-namespace OHOS {
-class SetDialStylePresenter;
-class SetDialStyleView : public View<SetDialStylePresenter> {
-public:
- SetDialStyleView();
- ~SetDialStyleView() override;
- SetDialStyleView(const SetDialStyleView &) = delete;
- SetDialStyleView& operator=(const SetDialStyleView &) = delete;
+namespace OHOS
+{
+ class SetDialStylePresenter;
+ class SetDialStyleView : public View<SetDialStylePresenter>
+ {
+ public:
+ SetDialStyleView();
+ ~SetDialStyleView() override;
+ SetDialStyleView(const SetDialStyleView &) = delete;
+ SetDialStyleView &operator=(const SetDialStyleView &) = delete;
+
+ void OnStart() override;
+ void OnSetUpView() override;
+ void OnStop() override;
+ void OnClick(UIView &view);
+
+ private:
+ UILabel labelTitle_;
+
+ UILabel labelCover_;
+ UILabel labelRoller_;
- void OnStart() override;
- void OnSetUpView() override;
- void OnStop() override;
- void OnClick(UIView &view);
+ UIToggleButton btnCover_;
+ UIToggleButton btnRoller_;
-private:
- UILabel labelTitle_;
- UILabel labelCover_;
- UILabel labelRoller_;
- UIToggleButton btnCover_;
- UIToggleButton btnRoller_;
- struct {
- UIToggleButton *btn;
- DialStyle style;
- } styleTable_[static_cast<int>(DialStyle::STYLE_NUM)] = {
- {&btnCover_, DialStyle::COVERFLOW},
- {&btnRoller_, DialStyle::ROLLER},
+ UIImageView Cover_Image_;
+ UIImageView Roller_Image_;
+ struct
+ {
+ UIToggleButton *btn;
+ DialStyle style;
+ } styleTable_[static_cast<int>(DialStyle::STYLE_NUM)] = {
+ {&btnCover_, DialStyle::COVERFLOW},
+ {&btnRoller_, DialStyle::ROLLER},
+ };
};
-};
} // OHOS
#endif
\ No newline at end of file
-/***
- * @Date: 2024-07-05 11:09:20
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-07-05 17:57:12
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStyleView.cpp
- */
-/***
- * @Date: 2024-07-05 11:09:20
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-07-05 17:47:15
- * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStyleView.cpp
- */
-/*
- * Copyright (c) CompanyNameMagicTag 2024. All rights reserved.
- * Description: SetDialStyleView.cpp
- * Author:
- * Create: 2024-06-06
- */
+
#include "SetDialStyleView.h"
#include "SetDialStyleModel.h"
#include "SetDialStylePresenter.h"
-
+#include "UiConfig.h"
namespace OHOS
{
SetDialStyleView::SetDialStyleView()
return;
}
View<SetDialStylePresenter>::OnSetUpView();
- labelTitle_.SetPosition(178, 38, 200, 60);
+
+ Cover_Image_.SetPosition(43, 120, 380, 100);
+ Cover_Image_.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ Cover_Image_.SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ Cover_Image_.SetStyle(STYLE_BORDER_RADIUS, 100);
+ container_->Add(&Cover_Image_);
+
+ Roller_Image_.SetPosition(43, 240, 380, 100);
+ Roller_Image_.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ Roller_Image_.SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ Roller_Image_.SetStyle(STYLE_BORDER_RADIUS, 100);
+ container_->Add(&Roller_Image_);
+
+ labelTitle_.SetPosition(83, 50, 300, 60);
labelTitle_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
labelTitle_.SetText("表盘样式");
+ labelTitle_.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); // 居中
+ labelTitle_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
container_->Add(&labelTitle_);
- labelCover_.SetPosition(83, 135, 200, 60);
+ labelCover_.SetPosition(90, 153, 200, 60);
labelCover_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
labelCover_.SetText("覆盖流样式");
container_->Add(&labelCover_);
- labelRoller_.SetPosition(83, 285, 200, 60);
+ labelRoller_.SetPosition(90, 273, 200, 60);
labelRoller_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
labelRoller_.SetText("滚筒样式");
container_->Add(&labelRoller_);
- btnCover_.SetPosition(240, 75, 148, 148);
+ btnCover_.SetPosition(298, 145, 100, 50);
+ btnCover_.SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
container_->Add(&btnCover_);
- btnRoller_.SetPosition(240, 225, 148, 148);
+ btnRoller_.SetPosition(298, 265, 100, 50);
+ btnRoller_.SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
container_->Add(&btnRoller_);
const DialStyle style = SetDialStyleModel::GetInstance().GetStyle();
apptitle->SetTextColor(Color::Gray());
/* ------------------------------- 数据label初始化 ------------------------------- */
restStr = "--";
- InitLabelAdapt(goal, 117, 95, 300, 50, "restlabel", restStr.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 40);
+ InitLabel(goal, 83, 90, 300, 50, "restlabel", restStr.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 40);
// goal->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
goal->SetTextColor(Color::Gray());
sleepStr = "--";
- InitLabelAdapt(sleep, 79, 238, 230, 47, "sleeplabel", sleepStr.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 40);
- sleep->SetTextColor(Color::Purple());
+ InitLabel(sleep, 10, 238, 230, 47, "sleeplabel", sleepStr.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 40);
+ sleep->SetTextColor(Color::GetColorFromRGBA(0x53, 0x20, 0xE2, 0xff));
wakeStr = "--";
- InitLabelAdapt(wake, 319, 238, 230, 47, "wakelabel", wakeStr.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 40);
- wake->SetTextColor(Color::Purple());
+ InitLabel(wake, 245, 238, 230, 47, "wakelabel", wakeStr.c_str(), DEFAULT_VECTOR_FONT_FILENAME, 40);
+ wake->SetTextColor(Color::GetColorFromRGBA(0x53, 0x20, 0xE2, 0xff));
/* -------------------------------- 将组件添加到根视图 ------------------------------- */
Add(resttitle);
Add(sleeptitle);
UIResourceTextId sport_id = TraingModel::GetInstance()->GetSportEvent();
// 初始化Lable
- InitLabelExt(sporttitle_, 137, 52, 200, 80, "label1", sport_id, DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabelExt(sporttitle_, 83, 50, 300, 35, "label1", sport_id, DEFAULT_VECTOR_FONT_FILENAME, 30);
container_->Add(sporttitle_);
+
// 初始化Button
InitButton(buttonGo_, 133, 133, 200, 200, BUTTONGO);
- // Set additional property
buttonGo_->SetImageSrc(GO_1_IMAGE, GO_1_IMAGE);
// 显示设置目标
- InitButtonExt(buttonSet_, 160, 370, 150, 50, BUTTONSET, STR_SET_GOALS, 30);
+ InitButtonExt(buttonSet_, 68, 370, 330, 35, BUTTONSET, STR_SET_GOALS, 30);
if (TraingModel::GetInstance()->GetTagStr() != "")
{
buttonSet_->SetText((TraingModel::GetInstance()->GetTagStr()).c_str());