传统蓝牙Slice优化修改
authorluozheng <1732036298@qq.com>
Tue, 23 Jul 2024 03:14:18 +0000 (11:14 +0800)
committerluozheng <1732036298@qq.com>
Tue, 23 Jul 2024 03:14:18 +0000 (11:14 +0800)
code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/MainBluetoothView.cpp
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothPresenter.h
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/BluetoothServiceOptionsView.cpp
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp

index 4792a68..3c6aa8c 100644 (file)
@@ -342,7 +342,8 @@ void MainBluetoothView::ChangeSettingView()
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::ChangeSettingView");\r
     BluetoothModel::GetInstance()->SetTagConnectView(false);\r
     BluetoothModel::GetInstance()->SetTagScanDeviceClicked(false);\r
-    NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING);\r
+    // NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING);\r
+    NativeAbility::GetInstance().Back();\r
 }\r
 \r
 void MainBluetoothView::DropEarPhoneView()\r
index 06f9536..0404af4 100644 (file)
@@ -1,3 +1,10 @@
+/*\r
+ * @Author: luozheng 1732036298@qq.com\r
+ * @Date: 2024-04-25 11:50:51\r
+ * @LastEditors: luozheng 1732036298@qq.com\r
+ * @LastEditTime: 2024-07-23 10:15:46\r
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/include/ClassicBlueToothPresenter.h\r
+ */\r
 #ifndef CLASSIC_BLUETOOTH_PRESENTER_H\r
 #define CLASSIC_BLUETOOTH_PRESENTER_H\r
 #include "Presenter.h"\r
@@ -16,21 +23,21 @@ namespace OHOS
     public:\r
         ClassicBlueToothPresenter();\r
         virtual ~ClassicBlueToothPresenter();\r
+        static ClassicBlueToothPresenter *GetInstance();\r
 \r
         virtual void OnStart() override;\r
         virtual void OnPause() override;\r
         virtual void OnResume() override;\r
         virtual void OnStop() override;\r
 \r
-        static ClassicBlueToothPresenter *GetInstance();\r
-\r
     private:\r
-        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
         bool OnClick(UIView &view, const ClickEvent &event) override;\r
         bool OnDrag(UIView &view, const DragEvent &event) override;\r
         bool OnDragEnd(UIView &view, const DragEvent &event) override;\r
         bool OnChange(UICheckBox::UICheckBoxState state) override;\r
         bool OnKeyAct(UIView &view, const KeyEvent &event) override;\r
+\r
+        bool X_DRAG_FLAG{false};\r
     };\r
 }\r
 \r
index 694965b..7461ab1 100644 (file)
@@ -4,7 +4,9 @@
 #include "UiConfig.h"
 #include "wearable_log.h"
 #include "PhoneService.h"
+#include "phoneservice/include/PhoneService.h"
 #include "BluetoothModel.h"
+#include "ui_resource_string.h"
 namespace OHOS
 {
     static BluetoothServiceOptionsView *g_pBluetoothServiceOptionsView{nullptr};
@@ -31,31 +33,48 @@ namespace OHOS
     {
         if (initViewStatus == true)
         {
-            BlueToothScrollView->RemoveAll();
-
-            delete Title;
-            Title = nullptr;
-
-            delete HFP_Image;
-            HFP_Image = nullptr;
-
-            delete A2DP_Image;
-            A2DP_Image = nullptr;
-
-            delete HFP_Label;
-            HFP_Label = nullptr;
-
-            delete A2DP_Label;
-            A2DP_Label = nullptr;
-
-            delete HFP_ToggleButton;
-            HFP_ToggleButton = nullptr;
-
-            delete A2DP_ToggleButton;
-            A2DP_ToggleButton = nullptr;
-
-            delete BlueToothScrollView;
-            BlueToothScrollView = nullptr;
+            if (BlueToothScrollView != nullptr)
+            {
+                BlueToothScrollView->RemoveAll();
+
+                if (Title != nullptr)
+                {
+                    delete Title;
+                    Title = nullptr;
+                }
+                if (HFP_Image != nullptr)
+                {
+                    delete HFP_Image;
+                    HFP_Image = nullptr;
+                }
+                if (A2DP_Image != nullptr)
+                {
+                    delete A2DP_Image;
+                    A2DP_Image = nullptr;
+                }
+                if (HFP_Label != nullptr)
+                {
+                    delete HFP_Label;
+                    HFP_Label = nullptr;
+                }
+                if (A2DP_Label != nullptr)
+                {
+                    delete A2DP_Label;
+                    A2DP_Label = nullptr;
+                }
+                if (HFP_ToggleButton != nullptr)
+                {
+                    delete HFP_ToggleButton;
+                    HFP_ToggleButton = nullptr;
+                }
+                if (A2DP_ToggleButton != nullptr)
+                {
+                    delete A2DP_ToggleButton;
+                    A2DP_ToggleButton = nullptr;
+                }
+                delete BlueToothScrollView;
+                BlueToothScrollView = nullptr;
+            }
         }
     }
 
@@ -95,9 +114,8 @@ namespace OHOS
         label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); // 位置大小
         label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);                                       // 字体大小
         label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);                                    // 字体行高
-        //label->SetText(labelconfig.text);                                                           // 内容
-        label->SetTextId(labelconfig.textId);                                                          
-        label->SetLineBreakMode(labelconfig.lineBreakMode);                                           // 断行模式。
+        label->SetTextId(labelconfig.textId);
+        label->SetLineBreakMode(labelconfig.lineBreakMode); // 断行模式。
         label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);
         return label;
     }
@@ -107,14 +125,13 @@ namespace OHOS
     {
         LabelConfig labelconfig = {
             .left = 93,
-            .top = 52,
+            .top = 50,
             .width = 280,
             .height = 40,
             .fontSize = 30,
             .lineHeigh = 35,
-            //.text = "蓝牙服务选项",
-            .textId = STR_BLUETOOTH_SERVICE_OPTIONS,
-            .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+            .textId = STR_BLUETOOTH_SERVICE_OPTIONS, /*蓝牙服务选项*/
+            .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
         };
         Title = SetBluetoothServiceOptionsViewLabel(labelconfig);
         if (nullptr == Title)
@@ -131,9 +148,8 @@ namespace OHOS
             .height = 40,
             .fontSize = 30,
             .lineHeigh = 35,
-            //.text = "通话蓝牙",
-            .textId = STR_HFP,
-            .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,
+            .textId = STR_HFP, /*通话蓝牙*/
+            .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,
         };
         HFP_Label = SetBluetoothServiceOptionsViewLabel(labelconfig);
         if (nullptr == HFP_Label)
@@ -142,8 +158,7 @@ namespace OHOS
             return false;
         }
         labelconfig.top = 273;
-        //labelconfig.text = "媒体蓝牙";
-        labelconfig.textId = STR_A2DP;
+        labelconfig.textId = STR_A2DP; /*媒体蓝牙*/
         A2DP_Label = SetBluetoothServiceOptionsViewLabel(labelconfig);
         if (nullptr == A2DP_Label)
         {
@@ -164,7 +179,7 @@ namespace OHOS
             return false;
         }
         HFP_ToggleButton->SetPosition(298, 145, 100, 50);
-        HFP_ToggleButton->SetState(uapi_hfp_connect_state());//ConfigModel::GetInstance()->GetHFPState());
+        HFP_ToggleButton->SetState(uapi_hfp_connect_state()); // ConfigModel::GetInstance()->GetHFPState());
         HFP_ToggleButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
         HFP_ToggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
         /* -------------------------------------------------------------------------- */
@@ -180,6 +195,11 @@ namespace OHOS
         A2DP_ToggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
         /* -------------------------------------------------------------------------- */
         UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(BluetoothServiceOptionsPresenter::GetInstance());
+        if (nullptr == clickListener)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothServiceOptionsPresenter::GetInstance fail!!");
+            return false;
+        }
         HFP_ToggleButton->SetOnClickListener(clickListener);
         A2DP_ToggleButton->SetOnClickListener(clickListener);
 
@@ -226,33 +246,23 @@ namespace OHOS
     /// @param  void
     void BluetoothServiceOptionsView::BluetoothServiceOptionsViewInit(void)
     {
-        if (!SetUpBlueToothScrollView())
-        {
-            return;
-        }
-
-        if (!SetUpBlueToothImageView())
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothServiceOptionsView::BluetoothServiceOptionsViewInit");
+        if (!SetUpBlueToothScrollView() || !SetUpBlueToothImageView() || !SetUpBlueToothLabel() || !SetUpBlueToothToggleButton())
         {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothServiceOptionsView::BluetoothServiceOptionsViewInit fail!!");
             return;
         }
-
-        if (!SetUpBlueToothLabel())
-        {
-            return;
-        }
-
-        if (!SetUpBlueToothToggleButton())
-        {
-            return;
-        }
-
-        initViewStatus = true;
     }
 
     void BluetoothServiceOptionsView::OnStart()
     {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothServiceOptionsView::OnStart");
         View<BluetoothServiceOptionsPresenter>::OnStart();
-        BluetoothServiceOptionsViewInit();
+        if (!initViewStatus)
+        {
+            BluetoothServiceOptionsViewInit();
+            initViewStatus = true;
+        }
 
         // 增加按键监听
         RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::BluetoothServiceOptionsPresenter::GetInstance();
index e91a7ed..b63e968 100644 (file)
@@ -1,8 +1,8 @@
 /*\r
  * @Author: luozheng 1732036298@qq.com\r
  * @Date: 2024-04-25 11:50:57\r
- * @LastEditors: SnickerSun snickersun@163.com\r
- * @LastEditTime: 2024-07-03 15:18:50\r
+ * @LastEditors: luozheng 1732036298@qq.com\r
+ * @LastEditTime: 2024-07-23 10:18:06\r
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp\r
  */\r
 #include "classicbluetooth/include/ClassicBlueToothPresenter.h"\r
@@ -14,6 +14,7 @@
 #include <ohos_types.h>\r
 #include "wearable_log.h"\r
 #include "ConfigModel.h"\r
+#include <UiConfig.h>\r
 namespace OHOS\r
 {\r
     // 当前Presenter属性实例化的内存指针\r
@@ -36,23 +37,25 @@ namespace OHOS
 \r
     void ClassicBlueToothPresenter::OnStart()\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothPresenter::OnStart");\r
         Presenter<ClassicBlueToothView>::OnStart();\r
     }\r
 \r
     void ClassicBlueToothPresenter::OnPause(void)\r
     {\r
-\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothPresenter::OnPause");\r
         Presenter<ClassicBlueToothView>::OnPause();\r
     }\r
 \r
     void ClassicBlueToothPresenter::OnResume(void)\r
     {\r
-\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothPresenter::OnResume");\r
         Presenter<ClassicBlueToothView>::OnResume();\r
     }\r
 \r
     void ClassicBlueToothPresenter::OnStop(void)\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothPresenter::OnStop");\r
         Presenter<ClassicBlueToothView>::OnStop();\r
     }\r
 \r
@@ -85,8 +88,11 @@ namespace OHOS
     bool ClassicBlueToothPresenter::OnDrag(UIView &view, const DragEvent &event)\r
     {\r
         UNUSED(view);\r
-        UNUSED(event);\r
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothPresenter::OnDrag");\r
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动\r
+        {\r
+            X_DRAG_FLAG = true;\r
+        }\r
         return true;\r
     }\r
 \r
@@ -94,9 +100,10 @@ namespace OHOS
     {\r
         UNUSED(view);\r
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothPresenter::OnDragEnd");\r
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && X_DRAG_FLAG)\r
         {\r
             NativeAbility::GetInstance().Back();\r
+            X_DRAG_FLAG = false;\r
         }\r
 \r
         return true;\r
@@ -128,7 +135,7 @@ namespace OHOS
 \r
     bool ClassicBlueToothPresenter::OnKeyAct(UIView &view, const KeyEvent &event)\r
     {\r
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothPresenter::OnKeyAct");\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothPresenter::OnKeyAct");\r
         uint16 keyID = event.GetKeyId();\r
         uint16 keyState = event.GetState();\r
         // 如果是power键,且是亮屏状态,按键释放就返回上一级\r
index 520695e..7891457 100644 (file)
@@ -16,7 +16,6 @@ namespace OHOS
     ClassicBlueToothView::~ClassicBlueToothView()\r
     {\r
         WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "~ClassicBlueToothView::ClassicBlueToothView");\r
-        ClearAll();\r
         g_pClassicBlueToothView = nullptr;\r
     }\r
 \r
@@ -29,34 +28,52 @@ namespace OHOS
     {\r
         if (initViewStatus == true)\r
         {\r
-            BlueToothScrollView->RemoveAll();\r
-\r
-            delete Title;\r
-            Title = nullptr;\r
-\r
-            delete BlueToothEarPhoneButton;\r
-            BlueToothEarPhoneButton = nullptr;\r
-\r
-            delete TradionalBlueToothButton;\r
-            TradionalBlueToothButton = nullptr;\r
-\r
-            delete BluetoothServiceOptionsButton;\r
-            BluetoothServiceOptionsButton = nullptr;\r
-\r
-            delete BlueToothEarPhoneLabel;\r
-            BlueToothEarPhoneLabel = nullptr;\r
-\r
-            delete TradionalBlueToothLabel;\r
-            TradionalBlueToothLabel = nullptr;\r
-\r
-            delete AttentionLabel;\r
-            AttentionLabel = nullptr;\r
-\r
-            delete TradionalBlueToothToggleButton;\r
-            TradionalBlueToothToggleButton = nullptr;\r
-\r
-            delete BlueToothScrollView;\r
-            BlueToothScrollView = nullptr;\r
+            if (BlueToothScrollView)\r
+            {\r
+                BlueToothScrollView->RemoveAll();\r
+                if (Title != nullptr)\r
+                {\r
+                    delete Title;\r
+                    Title = nullptr;\r
+                }\r
+                if (BlueToothEarPhoneButton != nullptr)\r
+                {\r
+                    delete BlueToothEarPhoneButton;\r
+                    BlueToothEarPhoneButton = nullptr;\r
+                }\r
+                if (TradionalBlueToothButton != nullptr)\r
+                {\r
+                    delete TradionalBlueToothButton;\r
+                    TradionalBlueToothButton = nullptr;\r
+                }\r
+                if (BluetoothServiceOptionsButton != nullptr)\r
+                {\r
+                    delete BluetoothServiceOptionsButton;\r
+                    BluetoothServiceOptionsButton = nullptr;\r
+                }\r
+                if (BlueToothEarPhoneLabel != nullptr)\r
+                {\r
+                    delete BlueToothEarPhoneLabel;\r
+                    BlueToothEarPhoneLabel = nullptr;\r
+                }\r
+                if (TradionalBlueToothLabel != nullptr)\r
+                {\r
+                    delete TradionalBlueToothLabel;\r
+                    TradionalBlueToothLabel = nullptr;\r
+                }\r
+                if (AttentionLabel != nullptr)\r
+                {\r
+                    delete AttentionLabel;\r
+                    AttentionLabel = nullptr;\r
+                }\r
+                if (TradionalBlueToothToggleButton != nullptr)\r
+                {\r
+                    delete TradionalBlueToothToggleButton;\r
+                    TradionalBlueToothToggleButton = nullptr;\r
+                }\r
+                delete BlueToothScrollView;\r
+                BlueToothScrollView = nullptr;\r
+            }\r
         }\r
     }\r
 \r
@@ -69,9 +86,10 @@ namespace OHOS
             return false;\r
         }\r
         BlueToothScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
-        BlueToothScrollView->SetScrollBlankSize(35);\r
+        BlueToothScrollView->SetScrollBlankSize(50);\r
         BlueToothScrollView->SetReboundSize(50);\r
         BlueToothScrollView->SetDirection(1);\r
+        BlueToothScrollView->RequestFocus();\r
         UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(ClassicBlueToothPresenter::GetInstance());\r
         if (draglistener == nullptr)\r
         {\r
@@ -96,7 +114,6 @@ namespace OHOS
         label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); // 位置大小\r
         label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);                                       // 字体大小\r
         label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);                                    // 字体行高\r
-        // label->SetText(labelconfig.text);                                                           // 内容\r
         label->SetTextId(labelconfig.textId);\r
         label->SetLineBreakMode(labelconfig.lineBreakMode); // 断行模式。\r
         label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);\r
@@ -108,14 +125,13 @@ namespace OHOS
     {\r
         LabelConfig labelconfig = {\r
             .left = 93,\r
-            .top = 52,\r
+            .top = 50,\r
             .width = 300,\r
             .height = 35,\r
             .fontSize = 30,\r
             .lineHeigh = 35,\r
-            //.text = "蓝牙",\r
-            .textId = STR_BLUETOOTH,\r
-            .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,\r
+            .textId = STR_BLUETOOTH, /*蓝牙*/\r
+            .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,\r
         };\r
         Title = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == Title)\r
@@ -132,9 +148,8 @@ namespace OHOS
             .height = 35,\r
             .fontSize = 30,\r
             .lineHeigh = 35,\r
-            //.text = "蓝牙耳机",\r
-            .textId = STR_BLUETOOTH_HEADPHONES,\r
-            .lineBreakMode = UILabel::LINE_BREAK_MARQUEE,\r
+            .textId = STR_BLUETOOTH_HEADPHONES, /*蓝牙耳机*/\r
+            .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,\r
         };\r
         BlueToothEarPhoneLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == BlueToothEarPhoneLabel)\r
@@ -144,8 +159,7 @@ namespace OHOS
         }\r
         /* -------------------------------------------------------------------------- */\r
         labelconfig.top = 273;\r
-        // labelconfig.text = "传统蓝牙";\r
-        labelconfig.textId = STR_TRADITIONAL_BLUETOOTH;\r
+        labelconfig.textId = STR_TRADITIONAL_BLUETOOTH; /*传统蓝牙*/\r
         TradionalBlueToothLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == TradionalBlueToothLabel)\r
         {\r
@@ -154,8 +168,7 @@ namespace OHOS
         }\r
         /* -------------------------------------------------------------------------- */\r
         labelconfig.top = 393;\r
-        // labelconfig.text = "蓝牙服务选项";\r
-        labelconfig.textId = STR_BLUETOOTH_SERVICE_OPTIONS;\r
+        labelconfig.textId = STR_BLUETOOTH_SERVICE_OPTIONS; /*蓝牙服务选项*/\r
         BluetoothServiceOptionsLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == BluetoothServiceOptionsLabel)\r
         {\r
@@ -172,10 +185,10 @@ namespace OHOS
         AttentionLabel->SetPosition(53, 499, 360, 180);  // 位置大小\r
         AttentionLabel->SetStyle(STYLE_TEXT_FONT, 20);   // 字体大小\r
         AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 30); // 字体行高\r
-        //.text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用\n\n(该功能主要用于电话拨打/通知、音乐控制/传输等)",\r
-        //SetLabelId(AttentionLabel, STR_AUTO_OFF_BLUETOOTH_NOTE);\r
+        //.text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用(该功能主要用于电话拨打/通知、音乐控制/传输等)",\r
         AttentionLabel->SetTextId(STR_AUTO_OFF_BLUETOOTH_NOTE);\r
         AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
+        AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
         AttentionLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); // 断行模式。\r
         AttentionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
         /* -------------------------------------------------------------------------- */\r
@@ -197,7 +210,7 @@ namespace OHOS
         BlueToothEarPhoneButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
         BlueToothEarPhoneButton->SetImagePosition(326, 37);\r
         BlueToothEarPhoneButton->SetImageSrc(PNG_SETTING_NEXT_IMAGE, PNG_SETTING_NEXT_IMAGE);\r
-        BlueToothEarPhoneButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);\r
+        BlueToothEarPhoneButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);\r
         /* -------------------------------------------------------------------------- */\r
         TradionalBlueToothButton = new UILabelButtonExt();\r
         if (TradionalBlueToothButton == nullptr)\r
@@ -222,11 +235,10 @@ namespace OHOS
         BluetoothServiceOptionsButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
         BluetoothServiceOptionsButton->SetImagePosition(326, 37);\r
         BluetoothServiceOptionsButton->SetImageSrc(PNG_SETTING_NEXT_IMAGE, PNG_SETTING_NEXT_IMAGE);\r
-        BluetoothServiceOptionsButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);\r
+        BluetoothServiceOptionsButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);\r
         /* -------------------------------------------------------------------------- */\r
-        UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(ClassicBlueToothPresenter::GetInstance());\r
-        BlueToothEarPhoneButton->SetOnClickListener(clickListener);\r
-        BluetoothServiceOptionsButton->SetOnClickListener(clickListener);\r
+        BlueToothEarPhoneButton->SetOnClickListener(presenter_);\r
+        BluetoothServiceOptionsButton->SetOnClickListener(presenter_);\r
 \r
         return true;\r
     }\r
@@ -244,8 +256,7 @@ namespace OHOS
         TradionalBlueToothToggleButton->SetState(ConfigModel::GetInstance()->GetClassicBlueToothState());\r
         TradionalBlueToothToggleButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
         TradionalBlueToothToggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);\r
-        UICheckBox::OnChangeListener *changeListener = static_cast<UICheckBox::OnChangeListener *>(ClassicBlueToothPresenter::GetInstance());\r
-        TradionalBlueToothToggleButton->SetOnChangeListener(changeListener);\r
+        TradionalBlueToothToggleButton->SetOnChangeListener(presenter_);\r
         return true;\r
     }\r
 \r
@@ -258,37 +269,25 @@ namespace OHOS
     /// @param  void\r
     void ClassicBlueToothView::ClassicBlueToothViewInit(void)\r
     {\r
-        if (!SetUpBlueToothScrollView())\r
-        {\r
-            return;\r
-        }\r
-\r
-        if (!SetUpBlueToothButton())\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::ClassicBlueToothViewInit");\r
+        if (!SetUpBlueToothScrollView() || !SetUpBlueToothButton() || !SetUpBlueToothLabel() || !SetUpBlueToothToggleButton())\r
         {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::ClassicBlueToothViewInit fail!!");\r
             return;\r
         }\r
-\r
-        if (!SetUpBlueToothLabel())\r
-        {\r
-            return;\r
-        }\r
-\r
-        if (!SetUpBlueToothToggleButton())\r
-        {\r
-            return;\r
-        }\r
-\r
-        initViewStatus = true;\r
     }\r
 \r
     void ClassicBlueToothView::OnStart()\r
     {\r
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::OnStart");\r
         View<ClassicBlueToothPresenter>::OnStart();\r
-        ClassicBlueToothViewInit();\r
+        if (!initViewStatus)\r
+        {\r
+            ClassicBlueToothViewInit();\r
+            initViewStatus = true;\r
+        }\r
 \r
-        // 增加按键监听\r
-        RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::ClassicBlueToothPresenter::GetInstance();\r
-        RootView::GetInstance()->SetOnKeyActListener(keyactListener);\r
+        RootView::GetInstance()->SetOnKeyActListener(presenter_); // 增加按键监听\r
     }\r
 \r
     void ClassicBlueToothView::OnSetUpView()\r
@@ -305,6 +304,7 @@ namespace OHOS
         BlueToothScrollView->Add(AttentionLabel);\r
         BlueToothScrollView->Add(TradionalBlueToothToggleButton);\r
         RootView::GetInstance()->Add(BlueToothScrollView);\r
+        container_ = BlueToothScrollView;\r
         Draw();\r
     }\r
 \r
@@ -321,6 +321,7 @@ namespace OHOS
         View<ClassicBlueToothPresenter>::OnStop();\r
         RootView::GetInstance()->RemoveAll();\r
         RootView::GetInstance()->ClearOnKeyActListener();\r
+        ClearAll();\r
         return;\r
     }\r
 \r