* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-10 11:58:21
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 18:51:22
+ * @LastEditTime: 2024-06-29 16:30:35
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp
*/
#include "dnotdisturb/include/DnotDisturbView.h"
namespace OHOS
{
+ static constexpr const char *DROPDOWN_DNOTDISTURB_IMAGE = "/user/res/dropdown/DROPDOWN_DNOTDISTURB.bin";
static DnotDisturbView *g_pDnotDisturbView{nullptr};
DnotDisturbView::DnotDisturbView()
DnotDisturbView::~DnotDisturbView()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::~DnotDisturbView");
- ClearAll();
g_pDnotDisturbView = nullptr;
}
showTitleLabel = nullptr;
}
- if (background != nullptr)
- {
- delete background;
- background = nullptr;
- }
-
if (DnotDisturbImage != nullptr)
{
delete DnotDisturbImage;
void DnotDisturbView::DnotDisturbViewInit(void)
{
-
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::DnotDisturbViewInit");
if (scrollView == nullptr)
{
scrollView = new UIScrollView();
showTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
showTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
/* -------------------------------------------------------------------------- */
- background = new UIImageView();
- if (background == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::background new fail!!");
- return;
- }
- background->SetPosition(186, 116);
- ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, background, DROPDOWN_ICONELLIPSEPURPLE);
- /* -------------------------------------------------------------------------- */
DnotDisturbImage = new UIImageView();
if (DnotDisturbImage == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::DnotDisturbImage new fail!!");
return;
}
- DnotDisturbImage->SetPosition(186, 116, 94, 94);
+ DnotDisturbImage->SetPosition(186, 110);
+ DnotDisturbImage->Resize(94, 94);
+ DnotDisturbImage->SetStyle(STYLE_BACKGROUND_COLOR, 0xff8120e2);
+ DnotDisturbImage->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ DnotDisturbImage->SetStyle(STYLE_BORDER_RADIUS, 100);
DnotDisturbImage->SetAutoEnable(false);
DnotDisturbImage->SetResizeMode(UIImageView::CENTER);
- ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, DnotDisturbImage, DROPDOWN_DNOTDISTURB);
+ DnotDisturbImage->SetSrc(DROPDOWN_DNOTDISTURB_IMAGE);
/* -------------------------------------------------------------------------- */
- AttentionLabel = new UILabel();
+ AttentionLabel = new UILabelExt();
if (AttentionLabel == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::AttentionLabel new fail!!");
AttentionLabel->SetPosition(33, 228, 400, 70);
AttentionLabel->SetStyle(STYLE_TEXT_FONT, 30);
AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
- // AttentionLabel->SetText("开启勿扰模式,手表将不会发出震动与铃声,是否开启");
- SetLabelId(AttentionLabel, STR_DO_NOT_DISTURB_MODE);
+ AttentionLabel->SetTextId(STR_DO_NOT_DISTURB_MODE); // 开启勿扰模式,手表将不会发出震动与铃声,是否开启
AttentionLabel->SetLineBreakMode(UILabelExt::LINE_BREAK_WRAP);
AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
{
View<DnotDisturbPresenter>::OnSetUpView();
scrollView->Add(showTitleLabel);
- scrollView->Add(background);
scrollView->Add(DnotDisturbImage);
scrollView->Add(AttentionLabel);
scrollView->Add(ButtonOn);
View<DnotDisturbPresenter>::OnStop();
RootView::GetInstance()->RemoveAll();
RootView::GetInstance()->ClearOnKeyActListener();
+ ClearAll();
return;
}
}
\ No newline at end of file