显示样式添加瀑布流
authorluozheng <1732036298@qq.com>
Tue, 20 May 2025 07:37:09 +0000 (15:37 +0800)
committerluozheng <1732036298@qq.com>
Tue, 20 May 2025 07:37:09 +0000 (15:37 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistView.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/include/SettingPresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingPresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/include/ThemeStyleModel.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/include/ThemeStylePresenter.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/include/ThemeStyleView.h
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStyleModel.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStylePresenter.cpp
code/sdk/application/wearable/fd230/nativeapp/nativeui/themestyle/src/ThemeStyleView.cpp

index 453781e..1e2e9ae 100644 (file)
@@ -129,9 +129,10 @@ REGIST_SLICE(VIEW_APPLIST, ApplistView, ApplistPresenter);
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d", viewId);
         if (viewId < VIEW_MAX_INTER_APP) {
             if (viewId == VIEW_SETTING && style == AppListStyle::APPLIST_STYLE) {
-                NativeAbility::GetInstance().EnterSlice(viewId, type, gSliceDefaultPriority, true); 
+                // NativeAbility::GetInstance().EnterSlice(viewId, type, gSliceDefaultPriority, true);
+                NativeAbility::GetInstance().EnterSlice(viewId, type); 
             } else {
-                NativeAbility::GetInstance().EnterSlice(viewId, type, gSliceDefaultPriority, true);
+                NativeAbility::GetInstance().EnterSlice(viewId, type);
             }
             return true;
         } else if (viewId == VIEW_EXTERN_APP) {
index 86d94b7..fe03ab5 100644 (file)
@@ -85,10 +85,13 @@ void ApplistView::OnStart()
         FootballStyleOnStart();
     } else if (style == AppListStyle::HEXAGONS_STYLE) {
         HexagonsStyleOnStart();
+    } else if (style == AppListStyle::WATERFALL_STYLE) {
+        WaterfallStyleOnStart();
     } else if(style == AppListStyle::ARC_SCALE_LIST_STYLE) {
         ArcScaleListStyleOnStart();
     } else if(style == AppListStyle::CIRCLE_LIST_STYLE) {
         // CircleListStyleOnStart();
+        ListStyleOnStart();// 暂时未合并拨号盘样式,使用列表样式代替
     } else {
         ListStyleOnStart();
     }
@@ -497,7 +500,7 @@ void ApplistView::ClearAppItemToList()
         HexagonsStyleOnStop();
     } else if (style == AppListStyle::WATERFALL_STYLE) {
         WaterfallStyleOnStop();
-    } else if(AppListStyle::ARC_SCALE_LIST_STYLE == style) {
+    } else if(style == AppListStyle::ARC_SCALE_LIST_STYLE) {
         ArcScaleListStyleOnStop();
     } else {
         listAdapter_->ClearItem();
index c29e368..5f0ba23 100644 (file)
@@ -31,9 +31,6 @@ namespace OHOS
         int GetListItemNum();
 
         void OnStart() override;
-        void OnResume() override;
-        void OnPause() override;
-        void OnStop() override;
 
         bool OnClick(UIView &view, const ClickEvent &event) override;
         bool OnDrag(UIView &view, const DragEvent &event) override;
index 2b41e69..5fc810c 100644 (file)
@@ -77,7 +77,6 @@ namespace OHOS
     void SettingPresenter::OnStart()
     {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnStart");
-        Presenter<SettingView>::OnStart();
         settingModel->InitSettingItem();
 
         if (view_ == nullptr)
@@ -89,24 +88,6 @@ namespace OHOS
         view_->RefreshSettingList(itemInfo);
     }
 
-    void SettingPresenter::OnResume(void)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnResume");
-    }
-
-    // 页面准备切换到后台前执行的逻辑
-    void SettingPresenter::OnPause(void)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnPause");
-        Presenter<SettingView>::OnPause();
-    }
-
-    void SettingPresenter::OnStop(void)
-    {
-        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnStop");
-        return;
-    }
-
     bool SettingPresenter::OnDrag(UIView &view, const DragEvent &event)
     {
         UNUSED(view);
index f194cec..9620dac 100644 (file)
@@ -22,6 +22,7 @@ namespace OHOS
     static constexpr const char *THEMESTYLE_VALUE_LIST = "list";
     static constexpr const char *THEMESTYLE_VALUE_HEXAGONS = "hexagons";
     static constexpr const char *THEMESTYLE_VALUE_FOOTBALL = "football";
+    static constexpr const char *THEMESTYLE_VALUE_WATERFALL = "waterfall";
     static constexpr const char *THEMESTYLE_VALUE_ARC_SCALE_LIST = "arc_scale_list";
     static constexpr const char *THEMESTYLE_VALUE_CIRCLE_LIST = "circle_list";
 
@@ -30,9 +31,9 @@ namespace OHOS
         ARC_SCALE_LIST_STYLE,//弧形列表
         HEXAGONS_STYLE, // 蜂窝显示
         CIRCLE_LIST_STYLE,//拨号盘
+        WATERFALL_STYLE, // 瀑布流显示
         APPLIST_STYLE,  // 列表显示
         FOOTBALL_STYLE, //足球
-        WATERFALL_STYLE,
         MAX_THEME_STYLE,
     } ThemeStyle;
 
@@ -41,6 +42,7 @@ namespace OHOS
         {ThemeStyle::APPLIST_STYLE, THEMESTYLE_VALUE_LIST},
         {ThemeStyle::HEXAGONS_STYLE, THEMESTYLE_VALUE_HEXAGONS},
         {ThemeStyle::FOOTBALL_STYLE, THEMESTYLE_VALUE_FOOTBALL},
+        {ThemeStyle::WATERFALL_STYLE, THEMESTYLE_VALUE_WATERFALL},
         {ThemeStyle::ARC_SCALE_LIST_STYLE, THEMESTYLE_VALUE_ARC_SCALE_LIST},
         {ThemeStyle::CIRCLE_LIST_STYLE, THEMESTYLE_VALUE_CIRCLE_LIST},
         // 在此处添加更多的映射关系
@@ -51,6 +53,7 @@ namespace OHOS
         {THEMESTYLE_VALUE_LIST, ThemeStyle::APPLIST_STYLE},
         {THEMESTYLE_VALUE_HEXAGONS, ThemeStyle::HEXAGONS_STYLE},
         {THEMESTYLE_VALUE_FOOTBALL, ThemeStyle::FOOTBALL_STYLE},
+        {THEMESTYLE_VALUE_WATERFALL, ThemeStyle::WATERFALL_STYLE},
         {THEMESTYLE_VALUE_ARC_SCALE_LIST, ThemeStyle::ARC_SCALE_LIST_STYLE},
         {THEMESTYLE_VALUE_CIRCLE_LIST, ThemeStyle::CIRCLE_LIST_STYLE},
         // 在此处添加更多的映射关系
index 61a16e9..eb2c7e5 100644 (file)
@@ -28,9 +28,6 @@ namespace OHOS
         ThemeStyle GetSelectThemeStyleId(void);
 
         void OnStart() override;
-        void OnPause() override;
-        void OnResume() override;
-        void OnStop() override;
 
     private:
         bool OnClick(UIView &view, const ClickEvent &event) override;
index 4cdde81..a400b03 100644 (file)
 
 namespace OHOS
 {
-    static constexpr const uint16_t MAX_STYLE = MAX_THEME_STYLE - 3; //直线列表和足球不显示所以删除了两个
+    static constexpr const uint16_t MAX_STYLE = MAX_THEME_STYLE - 2; //直线列表和足球不显示所以删除了两个
     static constexpr char *THEME_STYLE_LIST     = "themestyleList";       // 列表
     static constexpr char *THEME_STYLE_HEXAGONS = "themestyleHexagons";   // 蜂窝
     static constexpr char *THEME_STYLE_FOOTBALL = "themestyleFootball";   // 足球
+    static constexpr char *THEME_STYLE_WATERFALL = "themestyleWaterFall"; // 瀑布流
     static constexpr char *THEME_STYLE_ARC_LIST = "themestyleArcList";    // 弧形列表
     static constexpr char *THEME_STYLE_CIRCLE_LIST = "themestyleCircleList"; // 拨号盘
     static constexpr char *THEMESTYLEVIEWEXIT   = "ThemeStyleViewExit";   // exit
@@ -35,6 +36,7 @@ namespace OHOS
     static constexpr char *THEMESTYLE_LIST_IMAGEPATH = "/user/res/themestyle/list.bin";
     static constexpr char *THEMESTYLE_HEXAGONS_IMAGEPATH = "/user/res/themestyle/hexagons.bin";
     static constexpr char *THEMESTYLE_FOOTBALL_IMAGEPATH = "/user/res/themestyle/grid.bin";
+    static constexpr char *THEMESTYLE_WATERFALL_IMAGEPATH = "/user/res/themestyle/grid.bin";
     static constexpr char *THEMESTYLE_ARCLIST_IMAGEPATH = "/user/res/themestyle/arclist.bin";
     static constexpr char *THEMESTYLE_CIRCLELIST_IMAGEPATH = "/user/res/themestyle/dialplate.bin";
 
index 2443b75..4498c85 100644 (file)
@@ -73,6 +73,8 @@ namespace OHOS
     /*通过power建切换applist的样式*/
     void ThemeStyleModel::SwitchApplistStyleOnPowerClick(void)
     {
+        //按键切换样式
+        #if 0
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStyleModel::SwitchApplistStyleOnPowerClick");
         uint16_t style = GetAppListDisplayStyle();
         style += 1;
@@ -86,6 +88,7 @@ namespace OHOS
         }
         SetAppListDisplayStyle(static_cast<ThemeStyle>(style));
         return;
+        #endif
     }
 
     /*设置上一个applist的显示样式*/
index 8817b37..51e30f2 100644 (file)
@@ -38,25 +38,7 @@ namespace OHOS
         return g_pThemeStylePresenter;
     }
 
-    void ThemeStylePresenter::OnStart()
-    {
-        Presenter<ThemeStyleView>::OnStart();
-    }
-
-    void ThemeStylePresenter::OnPause()
-    {
-        Presenter<ThemeStyleView>::OnPause();
-    }
-
-    void ThemeStylePresenter::OnResume(void)
-    {
-        Presenter<ThemeStyleView>::OnResume();
-    }
-
-    void ThemeStylePresenter::OnStop(void)
-    {
-        Presenter<ThemeStyleView>::OnStop();
-    }
+    void ThemeStylePresenter::OnStart(){}
 
     bool ThemeStylePresenter::OnClick(UIView &view, const ClickEvent &event)
     {
@@ -89,6 +71,10 @@ namespace OHOS
         {
             ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::FOOTBALL_STYLE);
         }
+        else if (viewId == THEME_STYLE_WATERFALL)
+        {
+            ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::WATERFALL_STYLE);
+        }
         else if (viewId == THEME_STYLE_ARC_LIST)
         {
             ThemeStyleModel::GetInstance().SetAppListDisplayStyle(ThemeStyle::ARC_SCALE_LIST_STYLE);
index f38d8df..ab18c6f 100644 (file)
@@ -181,7 +181,7 @@ namespace OHOS
         scrollView->Add(titleText);
         /* -------------------------------------------------------------------------- */
         // int16_t textId[] = {STR_LIST_DISPLAY, STR_CELLULAR_DISPLAY, STR_ARC_SCALE_LIST_DISPLAY,STR_DIAL_PLATE};
-        int16_t textId[] = {STR_ARC_SCALE_LIST_DISPLAY, STR_CELLULAR_DISPLAY,STR_DIAL_PLATE};
+        int16_t textId[] = {STR_ARC_SCALE_LIST_DISPLAY, STR_CELLULAR_DISPLAY,STR_DIAL_PLATE,STR_DIAL_PLATE};
         LabelConfig labelConfig = {
             .left = 143,
             .top = 153,
@@ -234,7 +234,7 @@ namespace OHOS
         };
 
         // const char *viewId[] = {THEME_STYLE_LIST, THEME_STYLE_HEXAGONS, THEME_STYLE_ARC_LIST,THEME_STYLE_CIRCLE_LIST};
-        const char *viewId[] = {THEME_STYLE_ARC_LIST, THEME_STYLE_HEXAGONS,THEME_STYLE_CIRCLE_LIST};
+        const char *viewId[] = {THEME_STYLE_ARC_LIST, THEME_STYLE_HEXAGONS,THEME_STYLE_CIRCLE_LIST,THEME_STYLE_WATERFALL};
         for (int i = 0; i < sizeof(viewId) / sizeof(viewId[0]); i++)
         {
             labelbuttonconfig.top = 120 + 120 * i;
@@ -276,7 +276,7 @@ namespace OHOS
         };
         int y = 150;
         // const char *src[MAX_STYLE] = {THEMESTYLE_LIST_IMAGEPATH, THEMESTYLE_HEXAGONS_IMAGEPATH, THEMESTYLE_ARCLIST_IMAGEPATH,THEMESTYLE_CIRCLELIST_IMAGEPATH};
-        const char *src[] = {THEMESTYLE_ARCLIST_IMAGEPATH, THEMESTYLE_HEXAGONS_IMAGEPATH,THEMESTYLE_CIRCLELIST_IMAGEPATH};
+        const char *src[] = {THEMESTYLE_ARCLIST_IMAGEPATH, THEMESTYLE_HEXAGONS_IMAGEPATH,THEMESTYLE_CIRCLELIST_IMAGEPATH,THEMESTYLE_WATERFALL_IMAGEPATH};
         for (int i = 0; i < sizeof(src) / sizeof(src[0]); i++)
         {
             imageconfig.y = y + 120 * i;
@@ -326,8 +326,6 @@ namespace OHOS
     void ThemeStyleView::OnStart()
     {
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThemeStyleView::OnStart");
-        View<ThemeStylePresenter>::OnStart();
-
         if (!initViewStatus)
         {
             ThemeStyleViewInit();