From: 罗正yun <1732036298@qq.com> Date: Wed, 17 Jan 2024 08:13:36 +0000 (+0800) Subject: 修改下拉视图: X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=af34177726d53e345bdb8c8719c1ca63d0a5130e;p=mirrors%2FFD230.git 修改下拉视图: 1.点击找手机会快速重启(做测试用的) 2.其他点击暂时关闭点击跳转到其他视图功能 修改天气视图 更新下拉视图图片:dropdown.bin --- 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 20e72a401..62a48f1b1 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 @@ -55,19 +55,18 @@ namespace OHOS static const int CLOCK_SECONDHAND = 0x300012; static const int CLOCK_TUESDAY_IMAGE_PATH = 0x300013; /* -------------------------------------------------------------------------- */ - static const int DROPDOWN_DROPDOWN_BLUETOOTH = 0x400001; - static const int DROPDOWN_DROPDOWN_DN_DISTURB = 0x400002; - static const int DROPDOWN_DROPDOWN_BLUETOOTH_B = 0x400003; - static const int DROPDOWN_DROPDOWN_ALARM = 0x400004; - static const int DROPDOWN_DROPDOWN_BRI_SCREEN = 0x400005; - static const int DROPDOWN_DROPDOWN_FIND_PHONE_B = 0x400006; - static const int DROPDOWN_DROPDOWN_ALARM_B = 0x400007; - static const int DROPDOWN_DROPDOWN_SETTING = 0x400008; - static const int DROPDOWN_DROPDOWN_DN_DISTURB_B = 0x400009; - static const int DROPDOWN_DROPDOWN_FIND_PHONE = 0x40000a; - static const int DROPDOWN_DROPDOWN_SETTING_B = 0x40000b; - static const int DROPDOWN_DROPDOWN_BATTERY = 0x40000c; - static const int DROPDOWN_DROPDOWN_BRI_SCREEN_B = 0x40000d; + static const int DROPDOWN_BLUETOOTHCONNECTED = 0x400001; // 蓝牙连接中 + static const int DROPDOWN_BLUETOOTHDISCONNECTED = 0x400002; // 蓝牙未连接 + static const int DROPDOWN_EARPHONESCONNECTED = 0x400003; // 耳机连接中 + static const int DROPDOWN_EARPHONESDISCONNECTED = 0x400004; // 耳机未连接 + static const int DROPDOWN_FINDPHONE = 0x400005; // 找手机 + static const int DROPDOWN_ICONELLIPSE = 0x400006; // 图标椭圆 + static const int DROPDOWN_LIGHTING = 0x400007; // 亮屏 + static const int DROPDOWN_LINE = 0x400008; // 线 + static const int DROPDOWN_PHONECONNECTED = 0x400009; // 手机连接中 + static const int DROPDOWN_PHONEDISCONNECTED = 0x40000a; // 手机未连接 + static const int DROPDOWN_SAVEPOWER = 0x40000b; // 省电模式 + static const int DROPDOWN_SETTING = 0x40000c; // 设置 /* -------------------------------------------------------------------------- */ static const int COMPASS_COMPASS0 = 0x500001; // 指南针的背景图片 static const int COMPASS_COMPASS1 = 0x500002; // 指南针放置标记点按钮图片 diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp index c0d8cf3a7..9eb916fe1 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp @@ -129,25 +129,25 @@ IndoorWalkPreparedView *IndoorWalkPreparedView::GetInstance() bool IndoorWalkPreparedView::InitBatteryView() // 加载电量 { - battery = new UIImageView(); // 电量状态显示 - if (battery == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "battery new fail"); - return false; - } - battery->SetPosition(BATTERY_X, BATTERY_Y); - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, battery, DROPDOWN_DROPDOWN_BATTERY); - group->Add(battery); + // battery = new UIImageView(); // 电量状态显示 + // if (battery == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "battery new fail"); + // return false; + // } + // battery->SetPosition(BATTERY_X, BATTERY_Y); + // ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, battery, DROPDOWN_DROPDOWN_BATTERY); + // group->Add(battery); - batteryLable = new UILabel(); - if (batteryLable == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryLable new fail"); - return false; - } - batteryLable->SetPosition(BATTERY_LABEL_X, BATTERY_LABEL_Y, BATTERY_LABEL_W, BATTERY_LABEL_H); - batteryLable->SetText("--%"); - batteryLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); // 30 : font data - batteryLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - group->Add(batteryLable); + // batteryLable = new UILabel(); + // if (batteryLable == nullptr) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryLable new fail"); + // return false; + // } + // batteryLable->SetPosition(BATTERY_LABEL_X, BATTERY_LABEL_Y, BATTERY_LABEL_W, BATTERY_LABEL_H); + // batteryLable->SetText("--%"); + // batteryLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); // 30 : font data + // batteryLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + // group->Add(batteryLable); return true; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h index 97bd78109..ff47ab652 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h @@ -32,10 +32,14 @@ static constexpr const char *MAIN_CLICK_HEARTRATE = "mainclickheartrate"; static constexpr const char *DROPDOWN_CLICK_DONOTDISTURB = "dropdownclickdonotdisturb"; static constexpr const char *DROPDOWN_CLICK_BRIGHTENSCREEN = "dropdownclickbrightscreen"; -static constexpr const char *DROPDOWN_CLICK_FINDMYPHONE = "dropdownclickfindmyphone"; + static constexpr const char *DROPDOWN_CLICK_ALARM = "dropdownclickalarm"; -static constexpr const char *DROPDOWN_CLICK_SETTING = "dropdownclicksetting"; -static constexpr const char *DROPDOWN_CLICK_SAVEELE = "dropdownclicksaveele"; +static constexpr const char *DROPDOWN_CLICK_SETTING = "dropdownclicksetting"; //设置 +static constexpr const char *DROPDOWN_CLICK_LIGHTING = "dropdownclicklighting"; //亮屏 +static constexpr const char *DROPDOWN_CLICK_BLUETOOTH = "dropdownclickbluetooth"; //蓝牙 +static constexpr const char *DROPDOWN_CLICK_SAVEELE = "dropdownclicksaveele"; //省电 +static constexpr const char *DROPDOWN_CLICK_FINDMYPHONE = "dropdownclickfindmyphone"; //找手机 + constexpr uint16_t VERTICAL_STATUS = 1; constexpr uint16_t HORIZONTAL_STATUS = 0; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/PullUpDownView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/PullUpDownView.h index c601cec86..c63342270 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/PullUpDownView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/PullUpDownView.h @@ -26,26 +26,22 @@ public: void PreLoad(void) override; void UpdateBlueToothStatus(int status); private: - UIImageView *dnotDisturb{nullptr}; - UIImageView *briScreen{nullptr}; - UIImageView *finPhone{nullptr}; - UIImageView *droAlarm{nullptr}; - UIImageView *droSetting{nullptr}; - UILabel *dnotDisturbLable{nullptr}; - UILabel *briScreenLable{nullptr}; - UILabel *finPhoneLable{nullptr}; - UILabel *droAlarmLable{nullptr}; - UILabel *droSettingLable{nullptr}; - UIImageView *bluetooth{nullptr}; - UIImageView *battery{nullptr}; - UILabel *batteryLable{nullptr}; - UILabel *dateLable{nullptr}; - bool viewiInitStatus{false}; - UILabel *timeLable{nullptr}; - void InitSubViewImg(void); + UIImageView *dropSetting{nullptr}; //设置 + UIImageView *dropLighting{nullptr}; //亮屏 + UIImageView *dropBluetooth{nullptr}; //蓝牙 + UIImageView *dropSavePower{nullptr}; //省电 + UIImageView *drofindPhone{nullptr}; //找手机 + UIImageView *dropIconBackground[5]{nullptr}; //放置各个icon的背景 + UIImageView *showPhoneConnectedStatus{nullptr}; //显示手机连接状态 + UIImageView *showEarPhoneConnectedStatus{nullptr}; //显示耳机连接状态 + UIImageView *showBluetoothConnectedStatus{nullptr}; //显示蓝牙连接状态 + UILabel * showTimeLabel{nullptr}; //显示时间 + UILabel * showDateLabel{nullptr}; //显示日期 + UILabel * showWeekLabel{nullptr}; //显示星期 + void InitViewImgBackGround(void); void InitViewImg(void); - void InitViewLable(void); - void InitViewInfo(void); + void InitTimeDateWeekLabelAndConnectedStatusImage(void); + bool viewiInitStatus{false}; UIView::OnClickListener *clickListener{nullptr}; }; 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 c393ecb36..c1d4ff165 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp @@ -20,6 +20,7 @@ #include "ui_resource_image.h" #include #include +#include "AppViewIDs.h" namespace OHOS { @@ -32,9 +33,6 @@ namespace OHOS {DROPDOWN_CLICK_SAVEELE, VIEW_SAVEELE}, // 省电模式 {DROPDOWN_CLICK_SETTING, VIEW_SETTING}}; // 设置界面 - map g_chanColor = {{DROPDOWN_CLICK_FINDMYPHONE, DROPDOWN_DROPDOWN_FIND_PHONE_B}, - {DROPDOWN_CLICK_ALARM, DROPDOWN_DROPDOWN_ALARM_B}, - {DROPDOWN_CLICK_SETTING, DROPDOWN_DROPDOWN_SETTING_B}}; static MainPresenterSample *g_pMainPresenterSample = nullptr; @@ -90,7 +88,11 @@ namespace OHOS keyActListenr = nullptr; } } - + extern "C" + { + //重启 + uint32_t mcu_os_sys_reset(uint8_t *para, uint32_t para_len); + } bool MainPresenterSample::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); @@ -103,37 +105,19 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "health model nullptr"); return false; } - if (curViewId == DROPDOWN_CLICK_DONOTDISTURB) - { - if (HealthModel::GetInstance()->GetDntDistStatus() == 0) - { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, imgView, DROPDOWN_DROPDOWN_DN_DISTURB_B); - HealthModel::GetInstance()->UpdateDntDistStatus(1); - } - else - { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, imgView, DROPDOWN_DROPDOWN_DN_DISTURB); - HealthModel::GetInstance()->UpdateDntDistStatus(0); - } - } - if (curViewId == DROPDOWN_CLICK_BRIGHTENSCREEN) - { - if (HealthModel::GetInstance()->GetBriScrStatus() == 0) + /* ----------------------------- 一下代码是用来将手表快速重启 ----------------------------- */ + #if 1 + if(strcmp(view.GetViewId(),DROPDOWN_CLICK_FINDMYPHONE) == 0) { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, imgView, DROPDOWN_DROPDOWN_BRI_SCREEN_B); - HealthModel::GetInstance()->UpdateBriScrStatus(1); + mcu_os_sys_reset(NULL,NULL); } - else - { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, imgView, DROPDOWN_DROPDOWN_BRI_SCREEN); - HealthModel::GetInstance()->UpdateBriScrStatus(0); - } - } - + #endif + #if 0 if (g_jumpView.count(curViewId) != 0) { NativeAbility::GetInstance().ChangeSlice(g_jumpView[curViewId]); } + #endif return true; } bool MainPresenterSample::OnLongPress(UIView& view, const LongPressEvent& event) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp index 315e6cb9e..810d47329 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/PullUpDownView.cpp @@ -16,355 +16,365 @@ namespace OHOS { - - static PullUpDownView *g_pPullUpDownView = nullptr; - - // 勿扰 - constexpr int16_t DISTURB_IMG_X = 186; - constexpr int16_t DISTURB_IMG_Y = 30; + /* ---------------------------------- 坐标位置 ---------------------------------- */ + // 设置 + constexpr int16_t SETTING_IMG_X = 30; + constexpr int16_t SETTING_IMG_Y = 186; // 亮屏 - constexpr int16_t SCREEN_IMG_X = 76; - constexpr int16_t SCREEN_IMG_Y = 76; + constexpr int16_t LIGHTING_IMG_X = 76; + constexpr int16_t LIGHTING_IMG_Y = 76; - // 找手机 - constexpr int16_t PHONE_IMG_X = 342; - constexpr int16_t PHONE_IMG_Y = 186; + // 蓝牙 + constexpr int16_t BLUETOOTH_IMG_X = 186; + constexpr int16_t BLUETOOTH_IMG_Y = 30; - // 闹钟 - constexpr int16_t ALARM_IMG_X = 296; - constexpr int16_t ALARM_IMG_Y = 76; + // 省电 + constexpr int16_t SAVEPOWER_IMG_X = 296; + constexpr int16_t SAVEPOWER_IMG_Y = 76; - // 设置 - constexpr int16_t SETTING_IMG_X = 30; - constexpr int16_t SETTING_IMG_Y = 186; + // 找手机 + constexpr int16_t FINDPHONE_IMG_X = 342; + constexpr int16_t FINDPHONE_IMG_Y = 186; - constexpr int16_t BLUETOOTH_IMG_X = 145; - constexpr int16_t BLUETOOTH_IMG_Y = 335; - constexpr int16_t BATTERY_IMG_X = 195; - constexpr int16_t BATTERY_IMG_Y = 340; + // icon图片大小 + constexpr int16_t ICON_IMG_SIZE_W = 94; + constexpr int16_t ICON_IMG_SIZE_H = 94; - constexpr int16_t DISTURB_LABEL_X = 136; - constexpr int16_t DISTURB_LABEL_Y = 145; - constexpr int16_t SCREEN_LABEL_X = 270; - constexpr int16_t SCREEN_LABEL_Y = 145; - constexpr int16_t PHONE_LABEL_X = 68; - constexpr int16_t PHONE_LABEL_Y = 279; - constexpr int16_t ALARM_LABEL_X = 203; - constexpr int16_t ALARM_LABEL_Y = 279; - constexpr int16_t SETTING_LABEL_X = 338; - constexpr int16_t SETTING_LABEL_Y = 279; + // 电池 + constexpr int16_t BATTERY_X = 209; + constexpr int16_t BATTERY_Y = 180; - constexpr int16_t BATTERY_LABEL_X = 247; - constexpr int16_t BATTERY_LABEL_Y = 335; + // 时间 + constexpr int16_t TIME_LABEL_X = 172; + constexpr int16_t TIME_LABEL_Y = 230; // 日期 - constexpr int16_t DATE_LABEL_X = 128; - constexpr int16_t DATE_LABEL_Y = 299; + constexpr int16_t DATE_LABEL_X = 130; + constexpr int16_t DATE_LABEL_Y = 300; - constexpr int16_t FONT_DEFAULT_SIZE = 30; - constexpr int16_t TEXT_WIDTH = 400; - constexpr int16_t TEXT_HEIGHT = 35; + // 星期 + constexpr int16_t WEEK_LABEL_X = 265; + constexpr int16_t WEEK_LABEL_Y = 300; -constexpr int16_t NONOTICE_LABLE_X = 141; -constexpr int16_t NONOTICE_LABLE_Y = 212; + // 手机连接状态 + constexpr int16_t PHONECONNECTSTATUS_BUTTON_X = 155; + constexpr int16_t PHONECONNECTSTATUS_BUTTON_Y = 369; -PullUpDownView::PullUpDownView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::PullUpDownView"); - g_pPullUpDownView = this; -} + // 耳机连接状态 + constexpr int16_t EARPHONESCONNECTSTATUS_BUTTON_X = 217; + constexpr int16_t EARPHONESCONNECTSTATUS_BUTTON_Y = 369; + + // 蓝牙连接状态 + constexpr int16_t BLUETOOTHCONNECTSTATUS_BUTTON_X = 279; + constexpr int16_t BLUETOOTHCONNECTSTATUS_BUTTON_Y = 369; + /* -------------------------------------------------------------------------- */ + static PullUpDownView *g_pPullUpDownView = nullptr; + PullUpDownView::PullUpDownView() + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::PullUpDownView"); + g_pPullUpDownView = this; + } PullUpDownView::~PullUpDownView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::~PullUpDownView"); RemoveAll(); - delete dnotDisturb; - dnotDisturb = nullptr; - delete briScreen; - briScreen = nullptr; - delete finPhone; - finPhone = nullptr; - delete droAlarm; - droAlarm = nullptr; - delete droSetting; - droSetting = nullptr; - delete dnotDisturbLable; - dnotDisturbLable = nullptr; - delete briScreenLable; - briScreenLable = nullptr; - delete finPhoneLable; - finPhoneLable = nullptr; - delete droAlarmLable; - droAlarmLable = nullptr; - delete droSettingLable; - droSettingLable = nullptr; - delete bluetooth; - bluetooth = nullptr; - delete battery; - battery = nullptr; - delete batteryLable; - batteryLable = nullptr; - delete dateLable; - dateLable = nullptr; - delete timeLable; - timeLable = nullptr; + for (int i = 0; i < 5; i++) + { + delete dropIconBackground[i]; + dropIconBackground[i] = nullptr; + } + delete dropSetting; + dropSetting = nullptr; + delete dropLighting; + dropLighting = nullptr; + delete dropBluetooth; + dropBluetooth = nullptr; + delete dropSavePower; + dropSavePower = nullptr; + delete drofindPhone; + drofindPhone = nullptr; + delete showTimeLabel; + showTimeLabel = nullptr; + delete showDateLabel; + showDateLabel = nullptr; + delete showWeekLabel; + showWeekLabel = nullptr; + delete showPhoneConnectedStatus; + showPhoneConnectedStatus = nullptr; + delete showEarPhoneConnectedStatus; + showEarPhoneConnectedStatus = nullptr; + delete showBluetoothConnectedStatus; + showBluetoothConnectedStatus = nullptr; g_pPullUpDownView = nullptr; } -PullUpDownView *PullUpDownView::GetInstance(void) -{ - return g_pPullUpDownView; -} - -void PullUpDownView::InitSubViewImg(void) -{ - if (HealthModel::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "health model nullptr"); - return; + PullUpDownView *PullUpDownView::GetInstance(void) + { + return g_pPullUpDownView; } - dnotDisturb = new UIImageView(); - if (dnotDisturb == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dnotDisturb new fail"); - return; - } - dnotDisturb->SetPosition(DISTURB_IMG_X, DISTURB_IMG_Y); - if (HealthModel::GetInstance()->GetDntDistStatus() == 0) + /// @brief 初始化icon图标背景 + /// @param void + void PullUpDownView::InitViewImgBackGround(void) + { + for (int i = 0; i < 5; i++) { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dnotDisturb, DROPDOWN_DROPDOWN_DN_DISTURB); + dropIconBackground[i] = new UIImageView(); + if (dropIconBackground[i] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropIconBackground[%d] new fail", i); + return; + } } - else + dropIconBackground[0]->SetPosition(SETTING_IMG_X, SETTING_IMG_Y); + dropIconBackground[1]->SetPosition(LIGHTING_IMG_X, LIGHTING_IMG_Y); + dropIconBackground[2]->SetPosition(BLUETOOTH_IMG_X, BLUETOOTH_IMG_Y); + dropIconBackground[3]->SetPosition(SAVEPOWER_IMG_X, SAVEPOWER_IMG_Y); + dropIconBackground[4]->SetPosition(FINDPHONE_IMG_X, FINDPHONE_IMG_Y); + for (int i = 0; i < 5; i++) { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dnotDisturb, DROPDOWN_DROPDOWN_DN_DISTURB_B); + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropIconBackground[i], DROPDOWN_ICONELLIPSE); + Add(dropIconBackground[i]); } - dnotDisturb->SetViewId(DROPDOWN_CLICK_SAVEELE); - dnotDisturb->SetTouchable(true); - dnotDisturb->SetOnClickListener(clickListener); // 进入勿扰模式 - - briScreen = new UIImageView(); - if (briScreen == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "briScreen new fail"); - return; - } - briScreen->SetPosition(SCREEN_IMG_X, SCREEN_IMG_Y); - if (HealthModel::GetInstance()->GetBriScrStatus() == 0) { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, briScreen, DROPDOWN_DROPDOWN_BRI_SCREEN); - } else { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, briScreen, DROPDOWN_DROPDOWN_BRI_SCREEN_B); - } - briScreen->SetViewId(DROPDOWN_CLICK_BRIGHTENSCREEN); - briScreen->SetTouchable(true); - briScreen->SetOnClickListener(clickListener); // 进入亮屏模式 -} - -void PullUpDownView::InitViewImg(void) -{ - InitSubViewImg(); - - finPhone = new UIImageView(); - if (finPhone == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "finPhone new fail"); - return; } - finPhone->SetPosition(PHONE_IMG_X, PHONE_IMG_Y); - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, finPhone, DROPDOWN_DROPDOWN_FIND_PHONE); - finPhone->SetViewId(DROPDOWN_CLICK_FINDMYPHONE); // 找手机界面 DROP_DOWN_FIND_PHONE - finPhone->SetTouchable(true); - finPhone->SetOnClickListener(clickListener); - droAlarm = new UIImageView(); - if (droAlarm == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "droAlarm new fail"); - return; - } - droAlarm->SetPosition(ALARM_IMG_X, ALARM_IMG_Y); - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, droAlarm, DROPDOWN_DROPDOWN_ALARM); - droAlarm->SetViewId(DROPDOWN_CLICK_ALARM); // 进入闹钟App DROP_DOWN_ALARM - droAlarm->SetTouchable(true); - droAlarm->SetOnClickListener(clickListener); - - droSetting = new UIImageView(); - if (droSetting == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "droSetting new fail"); - return; - } - droSetting->SetPosition(SETTING_IMG_X, SETTING_IMG_Y); - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, droSetting, DROPDOWN_DROPDOWN_SETTING); - droSetting->SetViewId(DROPDOWN_CLICK_SETTING); // 进入设置界面 DROP_DOWN_SETTING - droSetting->SetTouchable(true); - droSetting->SetOnClickListener(clickListener); -} - - void PullUpDownView::InitViewLable(void) + /// @brief 初始化icon图标 + /// @param void + void PullUpDownView::InitViewImg(void) { - dnotDisturbLable = new UILabel(); - if (dnotDisturbLable == nullptr) + InitViewImgBackGround(); + /* ---------------------------------- 下拉设置图片 ---------------------------------- */ + dropSetting = new UIImageView(); + if (dropSetting == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dnotDisturbLable new fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropSetting new fail"); return; } - dnotDisturbLable->SetPosition(DISTURB_LABEL_X, DISTURB_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - // dnotDisturbLable->SetText("勿扰"); - dnotDisturbLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); - dnotDisturbLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - - briScreenLable = new UILabel(); - if (briScreenLable == nullptr) + dropSetting->SetPosition(SETTING_IMG_X, SETTING_IMG_Y, ICON_IMG_SIZE_W, ICON_IMG_SIZE_H); + dropSetting->SetAutoEnable(false); + dropSetting->SetResizeMode(UIImageView::CENTER); + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropSetting, DROPDOWN_SETTING); + dropSetting->SetViewId(DROPDOWN_CLICK_SETTING); // 进入设置界面 + dropSetting->SetTouchable(true); + dropSetting->SetOnClickListener(clickListener); + /* ----------------------------------- 亮屏 ----------------------------------- */ + dropLighting = new UIImageView(); + if (dropLighting == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "briScreenLable new fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropLighting new fail"); return; } - briScreenLable->SetPosition(SCREEN_LABEL_X, SCREEN_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - // briScreenLable->SetText("亮屏"); - briScreenLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); - briScreenLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - - finPhoneLable = new UILabel(); - if (finPhoneLable == nullptr) + dropLighting->SetPosition(LIGHTING_IMG_X, LIGHTING_IMG_Y, ICON_IMG_SIZE_W, ICON_IMG_SIZE_H); + dropLighting->SetAutoEnable(false); + dropLighting->SetResizeMode(UIImageView::CENTER); + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropLighting, DROPDOWN_LIGHTING); + dropLighting->SetViewId(DROPDOWN_CLICK_LIGHTING); // 进入亮屏界面 + dropLighting->SetTouchable(true); + dropLighting->SetOnClickListener(clickListener); + /* ----------------------------------- 蓝牙 ----------------------------------- */ + dropBluetooth = new UIImageView(); + if (dropBluetooth == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "finPhoneLable new fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropBluetooth new fail"); return; } - finPhoneLable->SetPosition(PHONE_LABEL_X, PHONE_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - // finPhoneLable->SetText("找手机"); - finPhoneLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); - finPhoneLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - droAlarmLable = new UILabel(); - if (finPhoneLable == nullptr) + dropBluetooth->SetPosition(BLUETOOTH_IMG_X, BLUETOOTH_IMG_Y, ICON_IMG_SIZE_W, ICON_IMG_SIZE_H); + dropBluetooth->SetAutoEnable(false); + dropBluetooth->SetResizeMode(UIImageView::CENTER); + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropBluetooth, DROPDOWN_BLUETOOTHDISCONNECTED); + dropBluetooth->SetViewId(DROPDOWN_CLICK_BLUETOOTH); // 进入蓝牙界面 + dropBluetooth->SetTouchable(true); + dropBluetooth->SetOnClickListener(clickListener); + /* ----------------------------------- 省电 ----------------------------------- */ + dropSavePower = new UIImageView(); + if (dropSavePower == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "finPhoneLable new fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropSavePower new fail"); return; } - droAlarmLable->SetPosition(ALARM_LABEL_X, ALARM_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - // droAlarmLable->SetText("闹钟"); - droAlarmLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); - droAlarmLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - droSettingLable = new UILabel(); - if (droSettingLable == nullptr) + dropSavePower->SetPosition(SAVEPOWER_IMG_X, SAVEPOWER_IMG_Y, ICON_IMG_SIZE_W, ICON_IMG_SIZE_H); + dropSavePower->SetAutoEnable(false); + dropSavePower->SetResizeMode(UIImageView::CENTER); + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropSavePower, DROPDOWN_SAVEPOWER); + dropSavePower->SetViewId(DROPDOWN_CLICK_SAVEELE); // 进入省电界面 + + dropSavePower->SetTouchable(true); + dropSavePower->SetOnClickListener(clickListener); + /* ----------------------------------- 找手机 ---------------------------------- */ + drofindPhone = new UIImageView(); + if (drofindPhone == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "droSettingLable new fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "drofindPhone new fail"); return; } - droSettingLable->SetPosition(SETTING_LABEL_X, SETTING_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - // droSettingLable->SetText("设置"); - droSettingLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); - droSettingLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - } - -void PullUpDownView::InitViewInfo(void) -{ - bluetooth = new UIImageView(); // 蓝牙状态显示 - if (bluetooth == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetooth new fail"); - return; + drofindPhone->SetPosition(FINDPHONE_IMG_X, FINDPHONE_IMG_Y, ICON_IMG_SIZE_W, ICON_IMG_SIZE_H); + drofindPhone->SetAutoEnable(false); + drofindPhone->SetResizeMode(UIImageView::CENTER); + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, drofindPhone, DROPDOWN_FINDPHONE); + drofindPhone->SetViewId(DROPDOWN_CLICK_FINDMYPHONE); // 找手机界面 + drofindPhone->SetTouchable(true); + drofindPhone->SetOnClickListener(clickListener); + /* -------------------------------- 添加组件到视图上 -------------------------------- */ + Add(dropSetting); + Add(dropLighting); + Add(dropBluetooth); + Add(dropSavePower); + Add(drofindPhone); } - bluetooth->SetPosition(BLUETOOTH_IMG_X, BLUETOOTH_IMG_Y); - if (BluetoothModel::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetooth model nullptr"); - return; - } - - if (SettingModel::GetInstance().GetBlueToothConnectStatus()) { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, bluetooth, DROPDOWN_DROPDOWN_BLUETOOTH_B); - } else { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, bluetooth, DROPDOWN_DROPDOWN_BLUETOOTH); - } - - battery = new UIImageView(); // 电量状态显示 - if (battery == nullptr) + + /// @brief 初始化时间,日期,星期标签和连接状态 + /// @param void + void PullUpDownView::InitTimeDateWeekLabelAndConnectedStatusImage(void) + { + bool ConnectedStatus = false; + /* -------------------------------- 显示手机连接状态 -------------------------------- */ + showPhoneConnectedStatus = new UIImageView(); + if (showPhoneConnectedStatus == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "battery new fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showPhoneConnectedStatus new fail"); return; } - battery->SetPosition(BATTERY_IMG_X, BATTERY_IMG_Y); - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, battery, DROPDOWN_DROPDOWN_BATTERY); - batteryLable = new UILabel(); - if (batteryLable == nullptr) + showPhoneConnectedStatus->SetPosition(PHONECONNECTSTATUS_BUTTON_X, PHONECONNECTSTATUS_BUTTON_Y); + if (ConnectedStatus) // 获取手机连接状态 + { + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showPhoneConnectedStatus, DROPDOWN_PHONECONNECTED); + } + else + { + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showPhoneConnectedStatus, DROPDOWN_PHONEDISCONNECTED); + } + /* -------------------------------- 显示耳机连接状态 -------------------------------- */ + showEarPhoneConnectedStatus = new UIImageView(); + if (showEarPhoneConnectedStatus == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryLable new fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showEarPhoneConnectedStatus new fail"); return; } - batteryLable->SetPosition(BATTERY_LABEL_X, BATTERY_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - batteryLable->SetText("90%"); - batteryLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); - batteryLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - dateLable = new UILabel(); - if (dateLable == nullptr) + showEarPhoneConnectedStatus->SetPosition(EARPHONESCONNECTSTATUS_BUTTON_X, EARPHONESCONNECTSTATUS_BUTTON_Y); + if (ConnectedStatus) // 获取耳机连接状态 { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dateLable new fail"); + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showEarPhoneConnectedStatus, DROPDOWN_EARPHONESCONNECTED); + } + else + { + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showEarPhoneConnectedStatus, DROPDOWN_EARPHONESDISCONNECTED); + } + /* -------------------------------- 显示蓝牙连接状态 -------------------------------- */ + showBluetoothConnectedStatus = new UIImageView(); + if (showBluetoothConnectedStatus == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showBluetoothConnectedStatus new fail"); return; - } - dateLable->SetPosition(DATE_LABEL_X, DATE_LABEL_Y, 210, TEXT_HEIGHT); // TEXT_WIDTH = 192 - dateLable->SetText("11月1号 星期三"); - dateLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); - dateLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - - timeLable = new UILabel(); - if (timeLable == nullptr) + } + showBluetoothConnectedStatus->SetPosition(BLUETOOTHCONNECTSTATUS_BUTTON_X, BLUETOOTHCONNECTSTATUS_BUTTON_Y); + if (BluetoothModel::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLable new fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showBluetoothConnectedStatus model nullptr"); return; } - timeLable->SetPosition(172,230,500,59); - timeLable->SetText("23:54"); - timeLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME,50); - timeLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + if (SettingModel::GetInstance().GetBlueToothConnectStatus()) // 获取蓝牙连接状态 + { + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showBluetoothConnectedStatus, DROPDOWN_BLUETOOTHCONNECTED); + } + else + { + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showBluetoothConnectedStatus, DROPDOWN_BLUETOOTHDISCONNECTED); + } + /* --------------------------------- 电量状态显示 --------------------------------- */ + + /* ---------------------------------- 时间显示 ---------------------------------- */ + showTimeLabel = new UILabel(); + if (showTimeLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showTimeLabel new fail"); + return; + } + showTimeLabel->SetPosition(TIME_LABEL_X, TIME_LABEL_Y); + showTimeLabel->SetStyle(STYLE_TEXT_FONT, 50); + showTimeLabel->SetStyle(STYLE_LINE_HEIGHT, 59); + showTimeLabel->SetText("23:54"); + showTimeLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + showTimeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + showTimeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 50); + /* ---------------------------------- 日期显示 ---------------------------------- */ + showDateLabel = new UILabel(); + if (showDateLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showDateLabel new fail"); + return; + } + showDateLabel->SetPosition(DATE_LABEL_X, DATE_LABEL_Y); + showDateLabel->SetStyle(STYLE_TEXT_FONT, 30); + showDateLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + showDateLabel->SetText("5月16号"); + showDateLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + showDateLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + showDateLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* ---------------------------------- 星期显示 ---------------------------------- */ + showWeekLabel = new UILabel(); + if (showWeekLabel == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showWeekLabel new fail"); + return; + } + showWeekLabel->SetPosition(WEEK_LABEL_X, WEEK_LABEL_Y); + showWeekLabel->SetStyle(STYLE_TEXT_FONT, 30); + showWeekLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + showWeekLabel->SetText("星期一"); + showWeekLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + showWeekLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + showWeekLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + /* -------------------------------- 将组件添加到视图 -------------------------------- */ + //Add(Battery);//电池的 + Add(showTimeLabel); + Add(showDateLabel); + Add(showWeekLabel); + Add(showPhoneConnectedStatus); + Add(showEarPhoneConnectedStatus); + Add(showBluetoothConnectedStatus); } - bool PullUpDownView::InitView( ) + bool PullUpDownView::InitView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::InitDropDownView caller:"); clickListener = (UIView::OnClickListener *)OHOS::MainPresenterSample::GetInstance(); - InitViewImg(); - InitViewLable(); - InitViewInfo(); - - Add(dnotDisturb); - Add(dnotDisturbLable); - Add(briScreen); - Add(briScreenLable); - Add(finPhone); - Add(finPhoneLable); - Add(droAlarm); - Add(droAlarmLable); - Add(droSetting); - Add(droSettingLable); - Add(bluetooth); - Add(battery); - Add(batteryLable); - Add(dateLable); - Add(timeLable); + InitTimeDateWeekLabelAndConnectedStatusImage(); - SetTouchable(true); - SetIntercept(true); + SetTouchable(true); + SetIntercept(true); - return true; -} + return true; + } -void PullUpDownView::PreLoad(void) -{ - if (!viewiInitStatus) { - InitView(); - viewiInitStatus = true; + void PullUpDownView::PreLoad(void) + { + if (!viewiInitStatus) + { + InitView(); + viewiInitStatus = true; + } } -} -void PullUpDownView::UpdateBlueToothStatus(int status) -{ - if (bluetooth == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetooth nullptr"); + void PullUpDownView::UpdateBlueToothStatus(int status) + { + if (showBluetoothConnectedStatus == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showBluetoothConnectedStatus nullptr"); + return; + } + if (status == 1) + { + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showBluetoothConnectedStatus, DROPDOWN_BLUETOOTHCONNECTED); + } + else + { + ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, showBluetoothConnectedStatus, DROPDOWN_BLUETOOTHDISCONNECTED); + } + showBluetoothConnectedStatus->Invalidate(); return; } - if (status == 1) { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, bluetooth, DROPDOWN_DROPDOWN_BLUETOOTH_B); - } else { - ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, bluetooth, DROPDOWN_DROPDOWN_BLUETOOTH); - } - bluetooth->Invalidate(); - return; -} } 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 cffb6433c..91ca34700 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp @@ -179,7 +179,7 @@ void ScreenModels::PreLoadAppimages(void) //LoadAppMultiImages(DIAL_CLOCK, CLOCK_HAND24HOUR_IMAGE_PATH, CLOCK_TUESDAY_IMAGE_PATH); //LoadAppMultiImages(CLOCK_IAMGES, CLOCK_HAND24HOUR_IMAGE_PATH, CLOCK_TUESDAY_IMAGE_PATH); LoadAppMultiImages(COMPASS_IAMGES, COMPASS_COMPASS0, COMPASS_START_PATH_RECORD); - LoadAppMultiImages(DROPDOWN_IAMGES, DROPDOWN_DROPDOWN_BLUETOOTH, DROPDOWN_DROPDOWN_BRI_SCREEN_B); + LoadAppMultiImages(DROPDOWN_IAMGES, DROPDOWN_BLUETOOTHCONNECTED, DROPDOWN_SETTING); LoadAppMultiImages(HEART_IAMGES, HEART_HEARTRATECOOR, HEART_HEARTRATE_TOP); } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherView.cpp index b281f2863..273ba54de 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherView.cpp @@ -80,14 +80,14 @@ namespace OHOS srand(time(0)); std::string area[] = {"23:54", "12:00", "7:25"}; int num = rand() % (sizeof(area) / sizeof(area[0])); - return area[num]; + return area[1]; } // 获取天气图片 std::string WeatherView::GetWeatherImage() { int size = sizeof(weather130x130) / sizeof(weather130x130[0]); - return weather130x130[rand() % size]; + return weather130x130[8]; } // 获取温度 @@ -96,7 +96,7 @@ namespace OHOS // 使用系统时间作为种子 srand(time(0)); int temperature = rand() % 50; - return std::to_string(temperature) + "°"; + return std::to_string(22) + "°"; } // 获取天气描述 @@ -105,16 +105,16 @@ namespace OHOS srand(time(0)); std::string area[] = {"晴", "雨夹雪", "雷阵雨伴有冰雹"}; int num = rand() % (sizeof(area) / sizeof(area[0])); - return area[num]; + return area[0]; } // 获取天气地区 std::string WeatherView::GetWeatherArea() { srand(time(0)); - std::string area[] = {"北京市东城区", "深圳市福田区"}; + std::string area[] = {"北京市东城区", "深圳市保安区"}; int num = rand() % (sizeof(area) / sizeof(area[0])); - return area[num]; + return area[1]; } // 获取最高气温和最低气温 @@ -125,7 +125,7 @@ namespace OHOS // 生成随机数 int maxtemperature = 20 + rand() % 40; // 最高气温:20°~60° int mintemperature = -5 + rand() % 20; - std::string MaxandMinTemperature = "最高" + std::to_string(maxtemperature) + "°" + " " + "最低" + std::to_string(mintemperature) + "°"; + std::string MaxandMinTemperature = "最高" + std::to_string(22) + "°" + " " + "最低" + std::to_string(18) + "°"; return MaxandMinTemperature; } @@ -179,7 +179,15 @@ namespace OHOS return false; } /* -------------------------------------------------------------------------- */ - showWeatherDescriptionLabel = InitLabel(111, 264, WeatherDescription.c_str(), "showWeatherDescriptionLabel", 35, 41); + UILabel *showWeatherDescriptionLabel = new UILabel(); + showWeatherDescriptionLabel->SetPosition(83, 264,300,40); + showWeatherDescriptionLabel->SetViewId("showWeatherDescriptionLabel"); + showWeatherDescriptionLabel->SetStyle(STYLE_TEXT_FONT, 35); + showWeatherDescriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 41); + showWeatherDescriptionLabel->SetText(WeatherDescription.c_str()); + showWeatherDescriptionLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + showWeatherDescriptionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + showWeatherDescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35); if (showWeatherDescriptionLabel == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherView::new showWeatherDescriptionLabel fail!"); diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/dropdown/dropdown.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/dropdown/dropdown.bin index 8e01f51ba..23826b457 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/dropdown/dropdown.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/dropdown/dropdown.bin differ diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h index b7b88b311..35a31bfe7 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/PullUpDownView.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef PULL_UP_DOWN_VIEW_H -#define PULL_UP_DOWN_VIEW_H +#ifndef PULL_UP_DOWN_VIEW_H_ +#define PULL_UP_DOWN_VIEW_H_ #include "AppGroupView.h" #include "components/ui_view_group.h"