指南针:compass
authorCaisking <3449750381@qq.com>
Fri, 24 Nov 2023 01:55:38 +0000 (09:55 +0800)
committerCaisking <3449750381@qq.com>
Fri, 24 Nov 2023 01:55:38 +0000 (09:55 +0800)
13 files changed:
code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h
code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h
code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassCalibrationView.h
code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassControlView.h
code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassView.h
code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassView.h
code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassCalibrationView.cpp
code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassControlView.cpp
code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassModel.cpp
code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassView.cpp
code/sdk/application/wearable/nativeapp/nativeui/compass/src/MainCompassPresenter.cpp
code/sdk/application/wearable/nativeapp/nativeui/compass/src/MainCompassView.cpp

index cab6cc1..1d1e00d 100644 (file)
@@ -22,7 +22,8 @@
  * 基础应用的view id,与MVP的V一一对应
  * 枚举命名要求:参考View名字,名字尽量简短
  */
-typedef enum : uint16_t {
+typedef enum : uint16_t
+{
     VIEW_INVALID = 0,
     VIEW_MAIN = 1,
     VIEW_SETTING = 2,
@@ -43,16 +44,17 @@ typedef enum : uint16_t {
     VIEW_MAIN_TEMP,
     VIEW_INDOORWALK,
     VIEW_REBOOT,
-    VIEW_UISAMPLE,        // 实例
-       VIEW_GETPIC,                          // 手势拍照
+    VIEW_UISAMPLE,                        // 实例
+    VIEW_GETPIC,                          // 手势拍照
     VIEW_TAKEPIC,                         // 拍照
     VIEW_BLOOD,                           // 血氧
     VIEW_BLOODSHOW,                       // 血氧说明
     VIEW_BLOODCHECK,                      // 血氧检查
-       VIEW_DIAL,                            // 表盘
+    VIEW_BLOODERROR,                      // 血氧监测错误
+    VIEW_DIAL,                            // 表盘
     VIEW_DIALSETUP,                       // 表盘安装
     VIEW_DIALSUCCES,                      // 表盘安装成功
-       VIEW_SAVEELE,                         // 省电模式
+    VIEW_SAVEELE,                         // 省电模式
     VIEW_SAVEBAT,                         // 省电模式界面
     VIEW_COMPASS,                         // 指南针
     VIEW_COMPASS_PLACE_MAKER,             // 指南针:放置标记点
@@ -80,7 +82,7 @@ typedef enum : uint16_t {
     VIEW_RECORD_PLAY,
     VIEW_RECORD_DELETE,
     VIEW_RECORD_GOING,
-    //电话
+    // 电话
     VIEW_PHONE,        // 电话
     VIEW_PHONECALL,    // 拨号
     VIEW_PHONERING,    // 拨号界面
@@ -106,15 +108,16 @@ typedef enum : uint16_t {
     VIEW_SYSTEM_FACTORY_RESET,   // 系统:恢复出厂设置
     VIEW_BRIGHTNESS_CONTROL,     // 亮度调节
     VIEW_SCREEN_DURATION,        // 亮屏时长
-    VIEW_MAX_INTER_APP,       // 在此之前添加native应用ID
-    VIEW_EXTERN_APP = 0xFFFE, // 三方应用
+    VIEW_MAX_INTER_APP,          // 在此之前添加native应用ID
+    VIEW_EXTERN_APP = 0xFFFE,    // 三方应用
     VIEW_INVALIDE_APP = 0xFFFF,
 } AppViewId;
 
 /*
  * Slice页面优先级,越小优先级越高
  */
-typedef enum : uint16_t {
+typedef enum : uint16_t
+{
     PRIO_0 = 0,
     PRIO_1,
     PRIO_2,
index 8b76c7a..9872fc3 100644 (file)
@@ -41,7 +41,7 @@ public:
     void InitMainTempSlice(void);
     void InitIndoorWalkSlice(void);
     void InitRebootSlice(void);
-    void InitUISampleSlice(void);                //ʾÀý
+    void InitUISampleSlice(void);                
        void InitSaveEleSlice(void);
        void InitSaveBatSlice(void);
        void InitSleepSlice(void);
@@ -52,6 +52,7 @@ public:
     void InitBloodSlice(void);
     void InitBloodShowSlice(void);
     void InitBloodCheckSlice(void);
+    void InitBloodErrorSlice(void);
        void InitDialSlice(void);
        void InitPhoneSlice(void);
        void InitPhoneCallSlice(void);
@@ -59,35 +60,35 @@ public:
        void InitPhoneCallingSlice(void);
        void InitPhoneCallupSlice(void);
        void InitPhoneRingSlice(void);
-    void InitUIDisplayBrightnessSlice(void);     //ÏÔʾÓëÁÁ¶È
-    void InitBlueToothSettingSlice(void);        //À¶ÑÀÉèÖÃ
-    void InitBrightnessControlSlice(void);       //ÁÁ¶Èµ÷½Ú
-    void InitScreenDurationSlice(void);          //ÁÁÆÁʱ³¤
-    void InitSoundAndVibrationSlice(void);       //ÉùÒôÓëÕð¶¯
-    void InitSystemVolumeSlice(void);            //ϵͳÒôÁ¿
-    void InitQuickAccessSlice(void);             //¿ìËÙ·ÃÎÊ
-    void InitSystemSlice(void);                  //ϵͳ
-    void InitSystemAboutWatchSlice(void);        //ϵͳ£º¹ØÓÚÊÖ±í
-    void InitSystemSuperviseSlice(void);         //ϵͳ£º¼à¹Ü
-    void InitSystemLanguageSlice(void);          //ϵͳ£ºÏµÍ³ÓïÑÔ
-    void InitSystemRebootSlice(void);            //ϵͳ£ºÖØÐÂÆô¶¯
-    void InitSystemShoutDownSlice(void);         //ϵͳ£º¹Ø»ú
-    void InitSystemFactoryResetSlice(void);      //ϵͳ£º»Ö¸´³ö³§ÉèÖÃ
-    void InitRecordingSlice(void);               //¼Òô
-    void InitRecordingListSlice(void);           //¼ÒôÁбí
-    void InitRecordingPlaySlice(void);           //¼Òô²¥·Å
-    void InitRecordingDeleteSlice(void);         //¼Òôɾ³ý
-    void InitRecordingGoingSlice(void);          //ÕýÔÚ¼Òô
-    void InitCompassPlaceMakerSlice(void);       //Ö¸ÄÏÕ룺·ÅÖñê¼Çµã
-    void InitCompassMakerPointSlice(void);       //Ö¸ÄÏÕ룺±ê¼Çµã½éÉÜ
-    void InitCompassStartPathRecordSlice(void);  //Ö¸ÄÏÕ룺¿ªÊ¼Â·¾¶¼Ç¼
-    void InitCompassEndPathRecordSlice(void);    //Ö¸ÄÏÕ룺½áÊøÂ·¾¶¼Ç¼
-    void InitCompassPathBackTrackingSlice(void); //Ö¸ÄÏÕ룺·¾¶»ØËÝ
-    void InitCompassResetPlaceMakerSlice(void);  //Ö¸ÄÏÕë£ºÖØÖñê¼Çµã
-    void InitCompassPathRetracingSlice(void);    //Ö¸ÄÏÕ룺·¾¶»ØËÝÖÐ
-    void InitCompassEndBackTrackingEarlySlice(); //Ö¸ÄÏÕ룺Ìáǰ½áÊøÂ·¾¶»ØËÝ
-    void InitCompassEndBackTrackingSlice(void);  //Ö¸ÄÏÕ룺½áÊøÂ·¾¶»ØËÝ
-    void InitCompassGPSLossSlice(void);          //Ö¸ÄÏÕ룺GPS¶ªÊ§
+    void InitUIDisplayBrightnessSlice(void);     
+    void InitBlueToothSettingSlice(void);        
+    void InitBrightnessControlSlice(void);      
+    void InitScreenDurationSlice(void);          
+    void InitSoundAndVibrationSlice(void);       
+    void InitSystemVolumeSlice(void);           
+    void InitQuickAccessSlice(void);            
+    void InitSystemSlice(void);                  
+    void InitSystemAboutWatchSlice(void);       
+    void InitSystemSuperviseSlice(void);        
+    void InitSystemLanguageSlice(void);         
+    void InitSystemRebootSlice(void);           
+    void InitSystemShoutDownSlice(void);        
+    void InitSystemFactoryResetSlice(void);      
+    void InitRecordingSlice(void);              
+    void InitRecordingListSlice(void);           
+    void InitRecordingPlaySlice(void);          
+    void InitRecordingDeleteSlice(void);        
+    void InitRecordingGoingSlice(void);         
+    void InitCompassPlaceMakerSlice(void);       
+    void InitCompassMakerPointSlice(void);     
+    void InitCompassStartPathRecordSlice(void);  
+    void InitCompassEndPathRecordSlice(void);    
+    void InitCompassPathBackTrackingSlice(void); 
+    void InitCompassResetPlaceMakerSlice(void); 
+    void InitCompassPathRetracingSlice(void);   
+    void InitCompassEndBackTrackingEarlySlice();
+    void InitCompassEndBackTrackingSlice(void);  
+    void InitCompassGPSLossSlice(void);         
 private:
     void InitAllNativeSlices(void);
 
index 1faa323..9af6dd0 100644 (file)
@@ -94,6 +94,8 @@
 #include "blood/include/BloodCheckView.h"
 #include "blood/include/BloodShowPresenter.h"
 #include "blood/include/BloodShowView.h"
+#include "blood/include/BloodErrorView.h"
+#include "blood/include/BloodErrorPresenter.h"
 #include "dial/include/DialPresenter.h"
 #include "dial/include/DialView.h"
 #include "displaybrightness/include/DisplayBrightnessPresenter.h"
@@ -201,6 +203,7 @@ static const AppViewMapper SLICE_MAPPER[] = {
     {VIEW_BLOOD, &NativeLauncher::InitBloodSlice},                              //血氧
     {VIEW_BLOODSHOW, &NativeLauncher::InitBloodShowSlice},
     {VIEW_BLOODCHECK, &NativeLauncher::InitBloodCheckSlice},
+    {VIEW_BLOODERROR, &NativeLauncher::InitBloodErrorSlice},
        {VIEW_DIAL, &NativeLauncher::InitDialSlice},                                //表盘
     {VIEW_DISPLAY_BRIGHTNESS,&NativeLauncher::InitUIDisplayBrightnessSlice},    //显示与亮度的实例化地址
     {VIEW_CONNECT_BLUETOOTH,&NativeLauncher::InitBlueToothSettingSlice},        //蓝牙设置的实例化地址
@@ -699,6 +702,18 @@ void NativeLauncher::InitBloodShowSlice(void)
     NativeAbility::GetInstance().AddSliceProxy(VIEW_BLOODSHOW, bloodshowview);
 }
 
+void NativeLauncher::InitBloodErrorSlice(void) 
+{
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitBloodSlice");
+    // SliceProxy *blooderrorview = new AbilitySliceProxy<BloodErrorView, BloodErrorPresenter>;
+    // if (blooderrorview == nullptr)
+    // {
+    //     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bloodview");
+    //     return;
+    // }
+    // NativeAbility::GetInstance().AddSliceProxy(VIEW_BLOODERROR, blooderrorview);
+}
+
 void NativeLauncher::InitBloodCheckSlice(void)
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitBloodSlice");
index b37a86b..b6469cc 100644 (file)
@@ -27,6 +27,8 @@ private:
     UILabel *labelOne{nullptr};
     UILabel *labelTwo{nullptr};
     UIImageView *imageView{nullptr};
+
+    void ClearAll(void);
 };
 }
 #endif
\ No newline at end of file
index 5b7c6a7..7fa5ee9 100644 (file)
 
 #include "components/root_view.h"
 #include "UiConfig.h"
-#include "AppGroupView.h"
+#include "components/ui_card_page.h"
 #include "CompassCalibrationView.h"
 #include "CompassView.h"
 
 namespace OHOS {
 
-class CompassControlView : public AppGroupView {
+class CompassControlView : public UICardPage {
 public:
     CompassControlView();
     virtual ~CompassControlView();
-    bool InitView(void *caller) override;
+    bool InitView(void);
+    void PreLoad(void) override;
+    void UnLoad(void) override;
 private:
     CompassCalibrationView *compassCalibrationView{nullptr};
     CompassView *compassView{nullptr};
+    bool viewiInitStatus{false};
+
+    void ClearAll(void);
 };
 }
-#endif
\ No newline at end of file
+#endif
index 0703cfb..0896b27 100644 (file)
@@ -36,20 +36,20 @@ public:
     bool InitView(void *caller) override;
     bool GetInitViewState(void);
     bool InitCompassImage(void);
-
     bool ReadFlagToFile();
 private:
     bool LoadCompassImage(UIImageView *view, uint32_t resId);
-    UILabel *directionLabel{nullptr};     //方向标签
-    UILabel *angledLabel{nullptr};        //角度标签
-    UIImageView *backGround{nullptr};     //背景图片
-    //UIImageView *rotateShaft{nullptr};  //旋转轴图片
-    UIButton *PlaceMarkerButton{nullptr}; //放置标记按钮
-    UIButton *PathBackTrackingButton{nullptr};//路径回溯按钮
-    UIView::OnClickListener* PlaceMarkerButtonClick = nullptr;     //放置标记点按钮的点击回调
-    UIView::OnClickListener* PathBackTrackingButtonClick =nullptr; //路径回溯按钮的点击回调
-    UIImageView *triangulation{nullptr};  //三角图片
-    const Vector2<float> VIEW_CENTER = {VIEW_CENTERS, VIEW_CENTERS}; //二维向量
+    void ClearAll(void);
+    UILabel *directionLabel{nullptr};                               //方向标签
+    UILabel *angledLabel{nullptr};                                  //角度标签
+    UIImageView *backGround{nullptr};                               //背景图片
+    //UIImageView *rotateShaft{nullptr};                            //旋转轴图片
+    UIButton *PlaceMarkerButton{nullptr};                           //放置标记按钮
+    UIButton *PathBackTrackingButton{nullptr};                      //路径回溯按钮
+    UIView::OnClickListener* PlaceMarkerButtonClick = nullptr;      //放置标记点按钮的点击回调
+    UIView::OnClickListener* PathBackTrackingButtonClick =nullptr;  //路径回溯按钮的点击回调
+    UIImageView *triangulation{nullptr};                            //三角图片
+    const Vector2<float> VIEW_CENTER = {VIEW_CENTERS, VIEW_CENTERS};//二维向量
 };
 }
 #endif
\ No newline at end of file
index 62c0fc1..cb5a258 100644 (file)
@@ -36,7 +36,7 @@ public:
     void OnStop() override;
 
     static MainCompassView *GetInstance(void);
-    void SetDisplayTrue(void);
+    void SetDisplayTure(void);
     void SetDisplayFalse(void);
 
 private:
index 3a2d482..568a655 100644 (file)
@@ -26,22 +26,34 @@ static CompassCalibrationView *g_pMainView = nullptr;
 CompassCalibrationView::CompassCalibrationView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassCalibrationView::CompassCalibrationView");
+    SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
     g_pMainView = this;
 }
 
 CompassCalibrationView::~CompassCalibrationView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassCalibrationView::~CompassCalibrationView");
-    RemoveAll();
-    delete labelOne;
-    delete imageView;
-    delete labelTwo;
-    labelOne = nullptr;
-    imageView = nullptr;
-    labelTwo = nullptr;
+    ClearAll();
     g_pMainView = nullptr;
 }
 
+void CompassCalibrationView::ClearAll(void)
+{
+    RemoveAll();
+    if (labelOne != nullptr) {
+        delete labelOne;
+        labelOne = nullptr;
+    }
+    if (imageView != nullptr) {
+        delete imageView;
+        imageView = nullptr;
+    }
+    if (labelTwo != nullptr) {
+        delete labelTwo;
+        labelTwo = nullptr;
+    }
+}
+
 CompassCalibrationView *CompassCalibrationView::GetInstance(void)
 {
     return g_pMainView;
@@ -61,6 +73,7 @@ bool CompassCalibrationView::CreateUIViewGroup(void)
     labelOne = new UILabel();
     if (labelOne == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CompassCalibrationView::new labelOne fail");
+        ClearAll();
         return false;
     }
 
@@ -75,6 +88,7 @@ bool CompassCalibrationView::CreateUIViewGroup(void)
     labelTwo = new UILabel();
     if (labelTwo == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CompassCalibrationView::new labelTwo fail");
+        ClearAll();
         return false;
     }
 
index 836fc14..ab61623 100644 (file)
@@ -8,28 +8,34 @@
 #include "CompassModel.h"
 
 namespace OHOS {
-static CompassControlView *g_pCompassControlView = nullptr;
-
 CompassControlView::CompassControlView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassControlView::CompassControlView()");
-    g_pCompassControlView = this;
+    SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
 }
 
 CompassControlView::~CompassControlView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassControlView::~CompassControlView()");
+    ClearAll();
+}
+
+void CompassControlView::ClearAll(void)
+{
     RemoveAll();
-    delete compassCalibrationView;
-    compassCalibrationView = nullptr;
-    delete compassView;
-    compassView = nullptr;
-    g_pCompassControlView = nullptr;
+    if (compassCalibrationView != nullptr) {
+        delete compassCalibrationView;
+        compassCalibrationView = nullptr;
+    }
+    if (compassView != nullptr) {
+        delete compassView;
+        compassView = nullptr;
+    }
 }
 
-bool CompassControlView::InitView(void *caller)
+bool CompassControlView::InitView(void)
 {
-    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassControlView InitView %p", caller);
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassControlView InitView");
     compassCalibrationView = new CompassCalibrationView();
     if (compassCalibrationView == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CompassCalibrationView::new compassCalibrationView fail");
@@ -57,7 +63,19 @@ bool CompassControlView::InitView(void *caller)
         compassView->SetVisible(true);
         compassCalibrationView->SetVisible(false);
     }
-    initViewStatus = true;
     return true;
 }
+
+void CompassControlView::PreLoad(void)
+{
+    if (!viewiInitStatus) {
+        InitView();
+        viewiInitStatus = true;
+    }
+}
+
+void CompassControlView::UnLoad(void)
+{
+    // Compass's usage scenes is complicated, so we do not release it's resources inner slice.
+}
 }
index 55204a6..1675aa8 100644 (file)
@@ -35,7 +35,7 @@ uint8_t CompassModel::GetCalibrationStatus(void)
 {
     return 0;
 }
-//显示的角度范围:0~359
+
 void CompassModel::SetDisplayAngle(uint16_t angle)
 {
     displayAngle += angle;
index 5092654..39bd44e 100644 (file)
@@ -35,10 +35,10 @@ static CompassView *g_pCompassView = nullptr;
 static bool EndPathRecordFlag = false; //一开始路径回溯的按钮不显示,因为没有放置标记点
 CompassView::CompassView()
 {
+    //View::SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
     g_pCompassView = this;
     EndPathRecordFlag = ReadFlagToFile();
 }
-
 //从文件中读取一个字符串:"EndPathRecordFlag"和其标志位:如果字符串对应为1则有放置标记点,否则没有
 bool CompassView::ReadFlagToFile()
 {
@@ -59,39 +59,56 @@ bool CompassView::ReadFlagToFile()
     return false;  
 }
 
-
 CompassView::~CompassView()
 {
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassView::~CompassView()");
-    if (initViewStatus == true) {
-        RemoveAll();
-        delete directionLabel;
-        directionLabel = nullptr;
+    ClearAll();
+    g_pCompassView = nullptr;
+}
 
+void CompassView::ClearAll(void)
+{
+    RemoveAll();
+    if (directionLabel != nullptr) {
+        delete directionLabel;
+        directionLabel= nullptr;
+    }
+    if (angledLabel != nullptr) {
         delete angledLabel;
         angledLabel = nullptr;
-
+    }
+    if (backGround != nullptr) {
         delete backGround;
         backGround = nullptr;
-
-        //delete rotateShaft;
-        //rotateShaft = nullptr;
+    }
+    // if (rotateShaft != nullptr) {
+    //     delete rotateShaft;
+    //     rotateShaft = nullptr;
+    // }
+       if(PlaceMarkerButton != nullptr)
+    {
         delete PlaceMarkerButton;
         PlaceMarkerButton = nullptr;
-
-        if(PathBackTrackingButton != nullptr)
-        {
-            delete PathBackTrackingButton ;
-            PathBackTrackingButton = nullptr;
-        }
-
+    }
+    if(PathBackTrackingButton != nullptr)
+    {
+        delete PathBackTrackingButton;
+        PathBackTrackingButton = nullptr;
+    }
+    if(PlaceMarkerButtonClick != nullptr)
+    {
         delete PlaceMarkerButtonClick;
-        PlaceMarkerButtonClick =nullptr;
-        
+        PlaceMarkerButtonClick = nullptr;
+    }
+    if(PathBackTrackingButtonClick != nullptr)
+    {
+        delete PathBackTrackingButtonClick;
+        PathBackTrackingButtonClick = nullptr;
+    }
+    if (triangulation != nullptr) {
         delete triangulation;
         triangulation = nullptr;
     }
-    g_pCompassView = nullptr;
 }
 //方向和角度设置
 void CompassView::DirectionSetText(const char *text, const char *angle)
@@ -221,12 +238,14 @@ bool CompassView::InitPage(void)
 {
     if (InitCompassImage() == false) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitCompassImage fail");
+        ClearAll();
         return false;
     }
 
     directionLabel = new UILabel();
     if (directionLabel == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "directionLabel new fail");
+        ClearAll();
         return false;
     }
     directionLabel->SetPosition(DIRECTIONLABEL_X, DIRECTIONLABEL_Y);
@@ -244,6 +263,7 @@ bool CompassView::InitPage(void)
     angledLabel = new UILabel();
     if (angledLabel == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "angledLabel new fail");
+        ClearAll();
         return false;
     }
     angledLabel->SetPosition(ANGLEDLABEL_X, ANGLEDLABEL_Y); 
index c9adaaa..49492bc 100644 (file)
@@ -46,21 +46,20 @@ bool MainCompassPresenter::OnDrag(UIView& view, const DragEvent& event)
     }
     return true;
 }
-//放置标记点的点击回调函数,用来跳转视图
+
 bool MainCompassPresenter::OnClick(UIView &view, const ClickEvent &event)
 {
     UNUSED(event);
-    // 根据控件id查找是哪个控件触发了点击回调
     if (strcmp(view.GetViewId(), PLACE_MARKER_BUTTON_VIEWID) == 0)
     {
         printf("PlaceMarkerButton being clicked\n");
-        if(CompassView::GetInstance()->ReadFlagToFile() == true ) //已经有了标记点后再次点击会跳转到是否重置标记点视图
+        if(CompassView::GetInstance()->ReadFlagToFile() == true ) 
         {
             NativeAbility::GetInstance().ChangeSlice(VIEW_COMPASS_RESET_PLACE_MAKER);
         }
         else 
         {
-            NativeAbility::GetInstance().ChangeSlice(VIEW_COMPASS_PLACE_MAKER);
+           NativeAbility::GetInstance().ChangeSlice(VIEW_COMPASS_PLACE_MAKER);
         }
        
         return true;
@@ -83,7 +82,7 @@ void MainCompassPresenter::Notify()
     }
     uint8_t status = CompassModel::GetInstance()->GetCalibrationStatus();
     if (status == 1) {
-        MainCompassView::GetInstance()->SetDisplayTrue();
+        MainCompassView::GetInstance()->SetDisplayTure();
     } else {
         MainCompassView::GetInstance()->SetDisplayFalse();
         DetermineToRotate();
index c55bdeb..9e76280 100644 (file)
@@ -34,7 +34,7 @@ MainCompassView *MainCompassView::GetInstance()
     return g_pMainCompassView;
 }
 
-void MainCompassView::SetDisplayTrue()
+void MainCompassView::SetDisplayTure()
 {
     if (compassView == nullptr || compassCalibrationView == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCompassView::SetDisplayTure null");
@@ -71,13 +71,13 @@ void MainCompassView::OnStart()
         return;
     }
 
-    UIView::OnDragListener *compassCalibrationDragListener = (UIView::OnDragListener *)OHOS::MainCompassPresenter::GetInstance();
+    UIView::OnDragListener *compassCalibrationDragListener = (UIView::OnDragListener *)
+        OHOS::MainCompassPresenter::GetInstance();
     if (compassCalibrationDragListener == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "compassCalibrationDragListener new fail");
         return;
     }
-    compassCalibrationView->SetOnDragListener(compassCalibrationDragListener);
-    compassCalibrationView->InitView(this);
+
     UIView::OnDragListener *compassDragListener = (UIView::OnDragListener *)OHOS::MainCompassPresenter::GetInstance();
     if (compassDragListener == nullptr) {
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "compassDragListener new fail");
@@ -86,7 +86,8 @@ void MainCompassView::OnStart()
     compassView->SetOnDragListener(compassDragListener);
     compassView->InitView(this);
 
-    
+    compassCalibrationView->SetOnDragListener(compassCalibrationDragListener);
+    compassCalibrationView->InitView(this);
     RootView::GetInstance()->Add(compassView);
     RootView::GetInstance()->Add(compassCalibrationView);