修改下拉视图
authorluozheng <1732036298@qq.com>
Wed, 27 Mar 2024 02:42:59 +0000 (10:42 +0800)
committerluozheng <1732036298@qq.com>
Wed, 27 Mar 2024 02:42:59 +0000 (10:42 +0800)
code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_image.h
code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h
code/sdk/application/wearable/fd230app/nativeui/main/include/PullUpDownView.h
code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp

index 85e8200..ab08e2c 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-16 14:43:44
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-03-27 10:02:08
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_image.h
+ */
 #ifndef UI_RESOURCE_IMAGE_H
 #define UI_RESOURCE_IMAGE_H
 #include <cstdint>
@@ -61,16 +68,18 @@ namespace OHOS
     /* -------------------------------------------------------------------------- */
     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 DROPDOWN_DNOTDISTURB = 0x400003;           // 勿扰模式
+    static const int DROPDOWN_EARPHONESCONNECTED = 0x400004;    // 耳机连接中
+    static const int DROPDOWN_EARPHONESDISCONNECTED = 0x400005; // 耳机未连接
+    static const int DROPDOWN_FINDPHONE = 0x400006;             // 找手机
+    static const int DROPDOWN_ICONELLIPSEBLACK = 0x400007;      // 图标椭圆黑色
+    static const int DROPDOWN_ICONELLIPSEPURPLE = 0x400008;     // 图标椭圆紫色
+    static const int DROPDOWN_LIGHTING = 0x400009;              // 亮屏
+    static const int DROPDOWN_LINE = 0x40000a;                  // 线
+    static const int DROPDOWN_PHONECONNECTED = 0x40000b;        // 手机连接中
+    static const int DROPDOWN_PHONEDISCONNECTED = 0x40000c;     // 手机未连接
+    static const int DROPDOWN_SAVEPOWER = 0x40000d;             // 省电模式
+    static const int DROPDOWN_SETTING = 0x40000e;               // 设置
     /* -------------------------------------------------------------------------- */
     static const int COMPASS_COMPASS0 = 0x500001; // 背景
     static const int COMPASS_COMPASS1 = 0x500002; // 标记点图片
@@ -88,6 +97,6 @@ namespace OHOS
     static const int TRAINING_RUNNING_BIG = 0x800005;
     static const int TRAINING_WALKING_BIG = 0x800006;
     /* -------------------------------------------------------------------------- */
-    
+
 }
 #endif
index 6207979..6d2dc90 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-03-01 15:10:34
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-03-27 10:40:38
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/MainPresenterSample.h
+ */
 
 #ifndef MAIN_PRESENTER_SAMPLE_H
 #define MAIN_PRESENTER_SAMPLE_H
@@ -28,10 +35,9 @@ namespace OHOS
     static constexpr const char *DROPDOWN_CLICK_DONOTDISTURB = "dropdownclickdonotdisturb";
     static constexpr const char *DROPDOWN_CLICK_BRIGHTENSCREEN = "dropdownclickbrightscreen";
 
-    static constexpr const char *DROPDOWN_CLICK_ALARM = "dropdownclickalarm";
     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_DNOTDISTURB = "dropdownclickdnotdisturb"; // 勿扰
     static constexpr const char *DROPDOWN_CLICK_SAVEELE = "dropdownclicksaveele";         // 省电
     static constexpr const char *DROPDOWN_CLICK_FINDMYPHONE = "dropdownclickfindmyphone"; // 找手机
 
index 72edf78..e37b001 100644 (file)
@@ -73,13 +73,14 @@ namespace OHOS
     private:
         UIImageView *dropSetting{nullptr};                  // 设置
         UIImageView *dropLighting{nullptr};                 // 亮屏
-        UIImageView *dropBluetooth{nullptr};                // 蓝牙
+        UIImageView *dropDnotDisturb{nullptr};              // 勿扰模式
         UIImageView *dropSavePower{nullptr};                // 省电
         UIImageView *drofindPhone{nullptr};                 // 找手机
         UIImageView *dropIconBackground[5]{nullptr};        // 放置各个icon的背景
         UIImageView *showPhoneConnectedStatus{nullptr};     // 显示手机连接状态
         UIImageView *showEarPhoneConnectedStatus{nullptr};  // 显示耳机连接状态
         UIImageView *showBluetoothConnectedStatus{nullptr}; // 显示蓝牙连接状态
+        UIImageView *dropLine{nullptr};                     // 线
         UILabel *showTimeLabel{nullptr};                    // 显示时间
         UILabel *showDateLabel{nullptr};                    // 显示日期
         UILabel *showWeekLabel{nullptr};                    // 显示星期
@@ -94,7 +95,6 @@ namespace OHOS
         void InitTimeDateWeekLabelAndConnectedStatusImage(void);
         bool viewiInitStatus{false};
 
-        UIView::OnClickListener *clickListener{nullptr};
     };
 }
 #endif
index e5962e5..9aae7b6 100644 (file)
@@ -35,16 +35,11 @@ namespace OHOS
 {
 
     map<string, AppViewId> g_jumpView = {
-        {DROPDOWN_CLICK_SETTING, VIEW_SETTING},             // 设置
-        {DROPDOWN_CLICK_BLUETOOTH, VIEW_CLASSIC_BLUETOOTH}, // 蓝牙
-        {DROPDOWN_CLICK_SAVEELE, VIEW_SAVEELE},             // 省电模式
+        {DROPDOWN_CLICK_SETTING, VIEW_SETTING}, // 设置
+        //{DROPDOWN_CLICK_DNOTDISTURB, VIEW_CLASSIC_BLUETOOTH}, // 勿扰
+        {DROPDOWN_CLICK_SAVEELE, VIEW_SAVEELE}, // 省电模式
     };
 
-    // map<string, int> g_chanColor = {         { DROPDOWN_CLICK_FINDMYPHONE, DROPDOWN_DROPDOWN_FIND_PHONE_B },
-    //                                          { DROPDOWN_CLICK_APPLIST, DROPDOWN_DROPDOWN_FIND_PHONE_B},
-    //                                          { DROPDOWN_CLICK_ALARM, DROPDOWN_DROPDOWN_ALARM_B },
-    //                                          { DROPDOWN_CLICK_SETTING, DROPDOWN_DROPDOWN_SETTING_B } };
-
     static MainPresenterSample *g_pMainPresenterSample = nullptr;
 
     static constexpr uint16_t DROP_X_MAX = 360;
index 8d07cb7..8422b32 100644 (file)
@@ -37,6 +37,10 @@ namespace OHOS
     constexpr int16_t FINDPHONE_IMG_X = 342;
     constexpr int16_t FINDPHONE_IMG_Y = 186;
 
+    // line
+    constexpr int16_t LINE_IMG_X = 193;
+    constexpr int16_t LINE_IMG_Y = 430;
+
     // icon图片大小
     constexpr int16_t ICON_IMG_SIZE_W = 94;
     constexpr int16_t ICON_IMG_SIZE_H = 94;
@@ -95,8 +99,10 @@ namespace OHOS
         dropSetting = nullptr;
         delete dropLighting;
         dropLighting = nullptr;
-        delete dropBluetooth;
-        dropBluetooth = nullptr;
+        delete dropDnotDisturb;
+        dropDnotDisturb = nullptr;
+        delete dropLine;
+        dropLine = nullptr;
         delete dropSavePower;
         dropSavePower = nullptr;
         delete drofindPhone;
@@ -156,7 +162,7 @@ namespace OHOS
         dropIconBackground[4]->SetPosition(FINDPHONE_IMG_X, FINDPHONE_IMG_Y);
         for (int i = 0; i < 5; i++)
         {
-            ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropIconBackground[i], DROPDOWN_ICONELLIPSE);
+            ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropIconBackground[i], DROPDOWN_ICONELLIPSEBLACK);
             Add(dropIconBackground[i]);
         }
     }
@@ -165,6 +171,7 @@ namespace OHOS
     /// @param  void
     void PullUpDownView::InitViewImg(void)
     {
+        UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::MainPresenterSample::GetInstance();
         InitViewImgBackGround();
         /* ---------------------------------- 下拉设置图片 ---------------------------------- */
         dropSetting = new UIImageView();
@@ -194,20 +201,20 @@ namespace OHOS
         dropLighting->SetViewId(DROPDOWN_CLICK_LIGHTING); // 进入亮屏界面
         dropLighting->SetTouchable(true);
         dropLighting->SetOnClickListener(clickListener);
-        /* ----------------------------------- 蓝牙 ----------------------------------- */
-        dropBluetooth = new UIImageView();
-        if (dropBluetooth == nullptr)
+        /* ----------------------------------- 勿扰模式 ----------------------------------- */
+        dropDnotDisturb = new UIImageView();
+        if (dropDnotDisturb == nullptr)
         {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropBluetooth new fail");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropDnotDisturb new fail");
             return;
         }
-        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);
+        dropDnotDisturb->SetPosition(BLUETOOTH_IMG_X, BLUETOOTH_IMG_Y, ICON_IMG_SIZE_W, ICON_IMG_SIZE_H);
+        dropDnotDisturb->SetAutoEnable(false);
+        dropDnotDisturb->SetResizeMode(UIImageView::CENTER);
+        ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropDnotDisturb, DROPDOWN_DNOTDISTURB);
+        dropDnotDisturb->SetViewId(DROPDOWN_CLICK_DNOTDISTURB); // 进入勿扰模式界面
+        dropDnotDisturb->SetTouchable(true);
+        dropDnotDisturb->SetOnClickListener(clickListener);
         /* ----------------------------------- 省电 ----------------------------------- */
         dropSavePower = new UIImageView();
         if (dropSavePower == nullptr)
@@ -237,12 +244,22 @@ namespace OHOS
         drofindPhone->SetViewId(DROPDOWN_CLICK_FINDMYPHONE); // 找手机界面
         drofindPhone->SetTouchable(true);
         drofindPhone->SetOnClickListener(clickListener);
+        /* -------------------------------- dropLine -------------------------------- */
+        dropLine = new UIImageView();
+        if (dropLine == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropLine new fail");
+            return;
+        }
+        dropLine->SetPosition(LINE_IMG_X, LINE_IMG_Y, ICON_IMG_SIZE_W, ICON_IMG_SIZE_H);
+        ScreenModels::GetInstance()->LoadAppImages(DROPDOWN_IAMGES, dropLine, DROPDOWN_LINE);
         /* -------------------------------- 添加组件到视图上 -------------------------------- */
         Add(dropSetting);
         Add(dropLighting);
-        Add(dropBluetooth);
+        Add(dropDnotDisturb);
         Add(dropSavePower);
         Add(drofindPhone);
+        Add(dropLine);
     }
 
     /// @brief 初始化时间,日期,星期标签和连接状态
@@ -420,7 +437,6 @@ namespace OHOS
     bool PullUpDownView::InitView()
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PullUpDownView::InitDropDownView caller:");
-        clickListener = (UIView::OnClickListener *)OHOS::MainPresenterSample::GetInstance();
         InitViewImg();
         InitTimeDateWeekLabelAndConnectedStatusImage();