Merge #305 into sdk602patch0521 from refs/changes/305/head 306/target/1
author袁清梦 <3449750381@qq.com>
Mon, 17 Jun 2024 12:26:39 +0000 (12:26 +0000)
committersnickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Mon, 17 Jun 2024 12:26:39 +0000 (12:26 +0000)
增加消息详细界面Slice

* refs/changes/305/head: (1 commits squashed)

  - 增加消息详细界面Slice

Signed-off-by: Caisking <3449750381@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/305
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h
code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageItemView.cpp
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowView.cpp [new file with mode: 0644]

index 89b3f49..3ad24a0 100644 (file)
@@ -501,6 +501,8 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/message/src/MessageModel.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/message/src/MessagePresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/message/src/MessageView.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/message/src/MessageShowPresenter.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/message/src/MessageShowView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/message/src/MessageCardView.cpp
 
     #遥控拍照
index af166a7..502cb95 100644 (file)
@@ -70,15 +70,16 @@ typedef enum : uint16_t
     /* ----------------------------------- 录音 ----------------------------------- */
     VIEW_RECORD,
     /* ---------------------------------- 界面 ---------------------------------- */
-    VIEW_DIAL,       // 切换表盘
-    VIEW_MESSAGE,    // 信息通知
-    VIEW_BLOOD,      // 血氧监测
-    VIEW_ROTATE,     // 模拟表冠
-    VIEW_BLOODOXY,   // 血氧饱和度界面
-    VIEW_HEART,      // 心率监测
-    VIEW_SAVEELE,    // 省电模式
-    VIEW_SAVEBAT,    // 省电模式界面
-    VIEW_TAKEPHOTOS, // 拍照界面
+    VIEW_DIAL,         // 切换表盘
+    VIEW_MESSAGE,      // 信息通知
+    VIEW_MESSAGE_SHOW, // 信息详细界面
+    VIEW_BLOOD,        // 血氧监测
+    VIEW_ROTATE,       // 模拟表冠
+    VIEW_BLOODOXY,     // 血氧饱和度界面
+    VIEW_HEART,        // 心率监测
+    VIEW_SAVEELE,      // 省电模式
+    VIEW_SAVEBAT,      // 省电模式界面
+    VIEW_TAKEPHOTOS,   // 拍照界面
     /* ----------------------------------- 训练 ----------------------------------- */
     VIEW_TRAINING,        // 训练
     VIEW_TRAININGNOMAL,   // 正常训练开始界面(除骑行,健走,跑步外)
index 41fb8ec..df262f5 100644 (file)
@@ -39,7 +39,7 @@ namespace OHOS
         /* ----------------------------------- 录音 ----------------------------------- */
         void InitRecordingSlice(void);
         /* -------------------------------------------------------------------------- */
-        void InitWeatherSlice(void); 
+        void InitWeatherSlice(void);
         void InitGoalSlice(void);
         void InitSystemSlice(void);
         void InitSoundAndVibrationSlice(void);
@@ -71,6 +71,7 @@ namespace OHOS
         void InitSaveEleSlice(void);
         void InitSaveBatSlice(void);
         void InitMessageSlice(void);
+        void InitMessageShowSlice(void);
         void InitTakePhotosSlice(void);
 
         /* ----------------------------------- 训练 ----------------------------------- */
index f8f18f9..0af4c2d 100644 (file)
 
 #include "displaybrightness/include/DisplayBrightnessPresenter.h"
 #include "displaybrightness/include/DisplayBrightnessView.h"
-
-#include "message/include/MessageModel.h"
+/*消息通知*/
+#include "message/include/MessageView.h"
 #include "message/include/MessagePresenter.h"
-
+#include "message/include/MessageShowView.h"
+#include "message/include/MessageShowPresenter.h"
 /*遥控拍照*/
 #include "takephotos/include/TakephotosView.h"
 #include "takephotos/include/TakephotosPresenter.h"
@@ -268,9 +269,8 @@ namespace OHOS
         {VIEW_CONNECT_PHONE, &NativeLauncher::InitConnectPhoneSlice},
         {VIEW_INDOORWALK, &NativeLauncher::InitIndoorWalkSlice},
         {VIEW_SHUTDOWN_OR_REBOOT, &NativeLauncher::InitRebootSlice},
-        {VIEW_WEATHER, &NativeLauncher::InitWeatherSlice}, // 天气
-        {VIEW_GOAL, &NativeLauncher::InitGoalSlice},       // 每日目标
-
+        {VIEW_WEATHER, &NativeLauncher::InitWeatherSlice},                                   // 天气
+        {VIEW_GOAL, &NativeLauncher::InitGoalSlice},                                         // 每日目标
         {VIEW_SYSTEM, &NativeLauncher::InitSystemSlice},                                     // 系统实例化地址
         {VIEW_SOUND_VIBRATION, &NativeLauncher::InitSoundAndVibrationSlice},                 // 声音与震动实例化地址
         {VIEW_SYSTEM_VOLUME, &NativeLauncher::InitSystemVolumeSlice},                        // 系统音量
@@ -298,12 +298,8 @@ namespace OHOS
         {VIEW_FLASHLIGHT, &NativeLauncher::InitFlashlightSlice},
         {VIEW_BRIGHTNESSLEVEL, &NativeLauncher::InitBrightnessLevelSlice},
 
-        {VIEW_MESSAGE, &NativeLauncher::InitMessageSlice},
         {VIEW_ROTATE, &NativeLauncher::InitRotateSlice},
         // {VIEW_DIALUPDATE, &NativeLauncher::InitDialUpdateSlice},
-        {VIEW_BLOODOXY, &NativeLauncher::InitMainBloodOxyView},
-        {VIEW_HEART, &NativeLauncher::InitHeartSlice},
-
         {VIEW_PHONE, &NativeLauncher::InitPhoneSlice}, // 电话
         {VIEW_PHONECALL, &NativeLauncher::InitPhoneCallSlice},
         {VIEW_PHONEDIR, &NativeLauncher::InitPhoneDirSlice},
@@ -312,15 +308,18 @@ namespace OHOS
         {VIEW_PHONERING, &NativeLauncher::InitPhoneRingSlice},
         {VIEW_MAIN_PHONE, &NativeLauncher::InitMainPhoneSlice},
         {VIEW_DIALING_METHOD, &NativeLauncher::InitDialingMethodSlice},
-
         {VIEW_TEST, &NativeLauncher::InittestSlice},
 
+        /* -------------------------------------------------------------------------- */
+        /*消息通知*/
+        {VIEW_MESSAGE, &NativeLauncher::InitMessageSlice},
+        {VIEW_MESSAGE_SHOW, &NativeLauncher::InitMessageShowSlice},
         /*省电模式*/
         {VIEW_SAVEELE, &NativeLauncher::InitSaveEleSlice},
         {VIEW_SAVEBAT, &NativeLauncher::InitSaveBatSlice},
         /*遥控拍照*/
         {VIEW_TAKEPHOTOS, &NativeLauncher::InitTakePhotosSlice},
-        /*训练*/
+        /* ----------------------------------- 训练 ----------------------------------- */
         {VIEW_TRAINING, &NativeLauncher::InitTraingSlice},               // 训练
         {VIEW_TRAININGNOMAL, &NativeLauncher::InitTraingNomalSlice},     // 正常训练初始界面
         {VIEW_TRAININGSET, &NativeLauncher::InitTraingSetSlice},         // 训练目标设置界面
@@ -336,15 +335,24 @@ namespace OHOS
         {VIEW_TRAININGBALL, &NativeLauncher::InitTraingBallSlice},       // 球类训练
         {VIEW_TRAININGAQUATIC, &NativeLauncher::InitTraingAquaticSlice}, // 水上训练
         {VIEW_TRAININGOTHER, &NativeLauncher::InitTraingOtherSlice},     // 水上训练
+        /* -------------------------------------------------------------------------- */
+        /*血氧检测*/
+        {VIEW_BLOODOXY, &NativeLauncher::InitMainBloodOxyView},
+        /*心率检测*/
+        {VIEW_HEART, &NativeLauncher::InitHeartSlice},
+        /*设置主题样式*/
+        {VIEW_SET_DESKTOP, &NativeLauncher::InitSetDesktopSlice},
+        /*设置卡片*/
+        {VIEW_SET_CARD, &NativeLauncher::InitSetCardSlice},
+        /*添加卡片*/
+        {VIEW_ADD_CARD, &NativeLauncher::InitAddCardSlice},
+        /*设置表盘*/
+        {VIEW_SET_DIAL, &NativeLauncher::InitSetDialSlice},
     /* -------------------------------------------------------------------------- */
 
 #ifdef SUPPORT_ALIPAY_SEC
         {VIEW_MAIN_ALIPAY, &NativeLauncher::InitMainAlipaySlice},
 #endif
-        {VIEW_SET_DESKTOP, &NativeLauncher::InitSetDesktopSlice},
-        {VIEW_SET_CARD, &NativeLauncher::InitSetCardSlice},
-        {VIEW_ADD_CARD, &NativeLauncher::InitAddCardSlice},
-        {VIEW_SET_DIAL, &NativeLauncher::InitSetDialSlice},
         {VIEW_MAIN_TEMP, &NativeLauncher::InitMainTempSlice},
 #if 0
         {VIEW_MAIN_ACTIVITY, &NativeLauncher::InitActivitySlice},
@@ -707,7 +715,16 @@ namespace OHOS
         }
         NativeAbility::GetInstance().AddSliceProxy(VIEW_MESSAGE, messageview);
     }
-
+    void NativeLauncher::InitMessageShowSlice(void) // 消息中心
+    {
+        SliceProxy *messageshowview = new AbilitySliceProxy<MessageShowView, MessageShowPresenter>;
+        if (messageshowview == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MessageView is nullptr");
+            return;
+        }
+        NativeAbility::GetInstance().AddSliceProxy(VIEW_MESSAGE_SHOW, messageshowview);
+    }
     void NativeLauncher::InitSoundAndVibrationSlice(void) // 声音与震动
     {
         SliceProxy *SoundAndVibration = new AbilitySliceProxy<SoundAndVibrationView, SoundAndVibrationPresenter>;
diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowPresenter.h
new file mode 100644 (file)
index 0000000..424e630
--- /dev/null
@@ -0,0 +1,44 @@
+/*** 
+ * @Date: 2024-06-17 19:39:27
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-06-17 20:04:15
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowPresenter.h
+ */
+
+
+#ifndef MessageShow_PRESENTER_H
+#define MessageShow_PRESENTER_H
+
+#include "Presenter.h"
+#include "MessageShowView.h"
+#include "message/include/MessageModel.h"
+#include "components/ui_list.h"
+namespace OHOS
+{
+    class MessageShowView;
+    class MessageShowModel;
+    class MessageShowPresenter : public Presenter<MessageShowView>,
+                                 public UIView::OnClickListener,
+                                 public UIView::OnDragListener,
+                                 public UIList
+    {
+    public:
+        MessageShowPresenter();
+        virtual ~MessageShowPresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+
+        static MessageShowPresenter *GetInstance();
+
+    private:
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+        MessageShowModel *p_MessageShowModel{nullptr};
+    };
+} // namespace OHOS
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowView.h b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowView.h
new file mode 100644 (file)
index 0000000..908a2e6
--- /dev/null
@@ -0,0 +1,69 @@
+/***
+ * @Date: 2024-06-17 19:38:57
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-06-17 19:42:38
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowView.h
+ */
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-06-15 15:47:19
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowView.h
+ */
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-04-23 15:32:55
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageShowView.h
+ */
+
+#ifndef MessageShow_VIEW_H
+#define MessageShow_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include "components/ui_view_group.h"
+#include "components/ui_scroll_view.h"
+#include "components/ui_list.h"
+#include "message/include/MessageModel.h"
+#include "message/include/MessageShowPresenter.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_label_button_ext.h"
+
+namespace OHOS
+{
+    class MessageModel;
+    class MessageShowPresenter;
+    class MessageShowView : public View<MessageShowPresenter>
+    {
+
+    public:
+        MessageShowView();
+        virtual ~MessageShowView();
+        static MessageShowView *GetInstance(void);
+
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+
+        void UpdateMessage(MessageData *data);
+        void InitView();
+        void DeInitView(void);
+        void PreLoad(void);
+
+    private:
+        UIScrollView *container_ = nullptr;
+
+        UILabelExt *title{nullptr};
+        UILabelExt *time{nullptr};
+
+        UILabelButtonExt *messageButton; // 消息
+        UILabelButtonExt *deleteButton;  // 清除按键
+
+        bool viewInitStatus{false};
+    };
+} // namespace OHOS
+#endif
\ No newline at end of file
index dda7628..974b77e 100644 (file)
@@ -1,19 +1,34 @@
-/***
- * @Date: 2024-04-15 10:55:58
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-06-14 11:18:42
- * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageItemView.cpp
- */
-
 #include "message/include/MessageItemView.h"
-
+#include "message/include/MessageModel.h"
 namespace OHOS
 {
     static constexpr const char *ICON_IMAGE = "user/res/message/Icon.bin";
+
+#define RECTANGLE_WIDTH 380
+
+// 定义不同大小矩形的长度常量
+#define SMALL_RECTANGLE_LENGTH 180
+#define MEDIUM_RECTANGLE_LENGTH 210
+#define BIG_RECTANGLE_LENGTH 240
+
+// 定义不同大小标签的长度常量
+#define SMALL_LABEL_LENGTH 30
+#define MEDIUM_LABEL_LENGTH 70
+#define BIG_LABEL_LENGTH 105
+
+// 时间的top
+#define SMALL_TIMELABEL_LENGTH 108
+#define MEDIUM_TIMELABEL_LENGTH 139
+#define BIG_LABELTIME_LENGTH 171
+
+    // 定义全局变量
+    static int item_length = BIG_RECTANGLE_LENGTH;
+    static int label_length = BIG_LABEL_LENGTH;
+    static int time_top = BIG_LABELTIME_LENGTH;
+
     MessageItemView::MessageItemView()
     {
-        SetPosition(0, 0, 380, 240); // 每一itemview宽高要配置好,因为每一首加到list歌曲都是以这个视图为基准
-        // SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+        SetPosition(0, 0, RECTANGLE_WIDTH, item_length);
         SetStyle(STYLE_BACKGROUND_OPA, 255);
         SetStyle(STYLE_BORDER_RADIUS, 20);
         SetTouchable(true);
@@ -35,26 +50,43 @@ namespace OHOS
         Remove(&sLabelButton);
     }
 
-    /// @brief 设置item的信息
-    /// @param itemInfo
     void MessageItemView::SetItemInfo(const MessageListItem itemInfo)
     {
         sItemInfo = itemInfo;
+#if 0
+        // 根据 labeldetails 的大小设置矩形和标签的长度
+        if (itemInfo.labeldetails.size() <= 10)
+        {
+            label_length = SMALL_LABEL_LENGTH;
+            item_length = SMALL_RECTANGLE_LENGTH;
+            time_top = SMALL_TIMELABEL_LENGTH;
+        }
+        else if (itemInfo.labeldetails.size() > 10 && itemInfo.labeldetails.size() <= 20)
+        {
+            label_length = MEDIUM_LABEL_LENGTH;
+            item_length = MEDIUM_RECTANGLE_LENGTH;
+            time_top = MEDIUM_TIMELABEL_LENGTH;
+        }
+        else
+        {
+            label_length = BIG_LABEL_LENGTH;
+            item_length = BIG_RECTANGLE_LENGTH;
+            time_top = BIG_LABELTIME_LENGTH;
+        }
+
+        SetPosition(0, 0, RECTANGLE_WIDTH, item_length);
+#endif
         if (!itemInfo.read)
         {
             sIcon.SetSrc(ICON_IMAGE);
         }
-        stitle.SetText((itemInfo.labeltitle).c_str());
-        smessgae.SetText((itemInfo.labeldetails).c_str());
-        stime.SetText((itemInfo.labeltime).c_str());
-
-        // printf("itemInfo:%s %s %s\r\n", (itemInfo.labeltitle).c_str(), (itemInfo.labeldetails).c_str(), (itemInfo.labeltime).c_str());
+        stitle.SetText(itemInfo.labeltitle.c_str());
+        smessgae.SetText(itemInfo.labeldetails.c_str());
+        stime.SetText(itemInfo.labeltime.c_str());
     }
 
-    /// @brief 设置每一个itemview上的组件
     void MessageItemView::SetUpChild()
     {
-
         sIcon.SetPosition(40, 43);
         sIcon.SetStyle(STYLE_IMAGE_OPA, OPA_OPAQUE);
 
@@ -62,25 +94,25 @@ namespace OHOS
         stitle.SetStyle(STYLE_TEXT_FONT, 30);
         stitle.SetStyle(STYLE_LINE_HEIGHT, 36);
         stitle.SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
-        stitle.SetRollSpeed(30); // 设置文本滚动速度
+        stitle.SetRollSpeed(30);
         stitle.SetTextColor(Color::White());
         stitle.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
 
-        smessgae.SetPosition(40, 69, 300, 105);
+        smessgae.SetPosition(40, 69, 300, label_length);
         smessgae.SetStyle(STYLE_TEXT_FONT, 30);
         smessgae.SetStyle(STYLE_LINE_HEIGHT, 36);
         smessgae.SetLineBreakMode(UILabel::LINE_BREAK_CLIP);
         smessgae.SetTextColor(Color::Gray());
         smessgae.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
 
-        stime.SetPosition(40, 178, 300, 33);
+        stime.SetPosition(40, time_top, 300, 33);
         stime.SetStyle(STYLE_TEXT_FONT, 30);
         stime.SetStyle(STYLE_LINE_HEIGHT, 36);
         stime.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);
         stime.SetTextColor(Color::Gray());
         stime.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);
 
-        sLabelButton.SetPosition(0, 0, 380, 220);
+        sLabelButton.SetPosition(0, 0, 380, item_length - 20);
         sLabelButton.SetStyle(STYLE_BACKGROUND_COLOR, 0xff303030);
         sLabelButton.SetStyle(STYLE_BORDER_RADIUS, 20);
         sLabelButton.SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
@@ -88,11 +120,8 @@ namespace OHOS
         sLabelButton.SetTouchable(true);
     }
 
-    /// @brief 获取list歌单的中每首歌的在list的下标
-    /// @return 返回歌曲下标
     int MessageItemView::GetMessageListIndex()
     {
         return sItemInfo.index;
     }
-
 }
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowPresenter.cpp
new file mode 100644 (file)
index 0000000..0c61bc2
--- /dev/null
@@ -0,0 +1,85 @@
+/***
+ * @Date: 2024-06-17 19:39:36
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-06-17 20:05:13
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowPresenter.cpp
+ */
+
+#include "AppViewIDs.h"
+#include "components/ui_label_ext.h"
+#include "language/font/ui_resource_string.h"
+#include "NativeAbility.h"
+#include "message/include/MessageShowPresenter.h"
+#include "components/ui_abstract_scroll_bar.h"
+#include "gfx_utils/graphic_log.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static MessageShowPresenter *g_pMessageShowPresenter = nullptr;
+
+    MessageShowPresenter::MessageShowPresenter()
+    {
+        g_pMessageShowPresenter = this;
+    }
+
+    MessageShowPresenter::~MessageShowPresenter()
+    {
+        g_pMessageShowPresenter = nullptr;
+    }
+
+    MessageShowPresenter *MessageShowPresenter::GetInstance()
+    {
+        return g_pMessageShowPresenter;
+    }
+
+    void MessageShowPresenter::OnStart()
+    {
+        Presenter<MessageShowView>::OnStart();
+    }
+
+    void MessageShowPresenter::OnPause(void)
+    {
+        Presenter<MessageShowView>::OnPause();
+    }
+
+    void MessageShowPresenter::OnResume(void)
+    {
+        Presenter<MessageShowView>::OnResume();
+    }
+
+    void MessageShowPresenter::OnStop(void)
+    {
+        Presenter<MessageShowView>::OnStop();
+    }
+
+    bool MessageShowPresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
+        {
+            NativeAbility::GetInstance().Back();
+        }
+        return true;
+    }
+
+    bool MessageShowPresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        UNUSED(event);
+#if 0
+        MessageShowItemView *messageItemView = static_cast<MessageShowItemView *>(&view);
+        int index = messageItemView->GetMessageShowListIndex();
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "index:%d", index);
+        if (index >= p_MessageShowModel->GetMessageShowListNum())
+        {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnClick is no index");
+            return false;
+        }
+#endif
+        return true;
+    }
+
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowView.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowView.cpp
new file mode 100644 (file)
index 0000000..f7a3e92
--- /dev/null
@@ -0,0 +1,108 @@
+/***
+ * @Date: 2024-06-17 19:40:11
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-06-17 20:20:46
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageShowView.cpp
+ */
+
+#include "message/include/MessageShowView.h"
+#include "message/include/MessageShowPresenter.h"
+#include "message/include/MessageModel.h"
+
+#include "UiConfig.h"
+#include "wearable_log.h"
+#include "uicomponents/UIComponents.h"
+namespace OHOS
+{
+
+    static MessageShowView *g_pMessageShowView{nullptr};
+    MessageShowView::MessageShowView()
+    {
+        g_pMessageShowView = this;
+    }
+
+    MessageShowView::~MessageShowView()
+    {
+        if (viewInitStatus == true)
+        {
+            DeInitView();
+        }
+        g_pMessageShowView = nullptr;
+    }
+
+    MessageShowView *MessageShowView::GetInstance()
+    {
+        return g_pMessageShowView;
+    }
+    void MessageShowView::DeInitView()
+    {
+        container_->RemoveAll();
+        if (container_ != nullptr)
+        {
+            container_->RemoveAll();
+            delete container_;
+            container_ = nullptr;
+        }
+        // delete draglistener;
+        // draglistener = nullptr;
+    }
+    void MessageShowView::InitView() {}
+
+    void MessageShowView::UpdateMessage(MessageData *data) {}
+
+    void MessageShowView::PreLoad(void)
+    {
+        if (!viewInitStatus)
+        {
+            InitView();
+            viewInitStatus = true;
+        }
+    }
+
+    /// @brief 页面启动时需要执行的代码逻辑
+    void MessageShowView::OnStart()
+    {
+        container_ = new UIScrollView();
+        if (container_ == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "container_ new fail");
+            return;
+        }
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        // 创建 draglistener 实例并设置为拖动监听器
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(MessageShowPresenter::GetInstance());
+        if (draglistener == nullptr)
+        {
+            return;
+        }
+        container_->SetOnDragListener(draglistener);
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+        // container_->SetStyle(STYLE_BACKGROUND_COLOR, BACK_GROUND_COLOR);
+        container_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+
+        PreLoad();
+        RootView::GetInstance()->Add(container_);
+    }
+    /// @brief 创建页面的视图
+    void MessageShowView::OnSetUpView()
+    {
+        View<MessageShowPresenter>::OnSetUpView();
+        Draw();
+    }
+
+    /// @brief 销毁页面的视图
+    void MessageShowView::OnTearDownView()
+    {
+        View<MessageShowPresenter>::OnTearDownView();
+        return;
+    }
+
+    /// @brief 页面结束时需要执行的销毁逻辑。
+    void MessageShowView::OnStop()
+    {
+        View<MessageShowPresenter>::OnStop();
+        RootView::GetInstance()->RemoveAll();
+        return;
+    }
+}
\ No newline at end of file