Merge #2743 into sdk650pathc0423 from refs/changes/2743/head
author罗正 <1732036298@qq.com>
Sun, 16 Nov 2025 09:14:28 +0000 (09:14 +0000)
committer彭磊 <1624952103@qq.com>
Sun, 16 Nov 2025 09:14:28 +0000 (09:14 +0000)
fd272,去掉蓝牙界面中蓝牙耳机相关代码

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

  - fd272,去掉蓝牙界面中蓝牙耳机相关代码

Signed-off-by: 罗正 <1732036298@qq.com>
Merged-by: aliyun6865282430 <1624952103@qq.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/2743
code/sdk/application/wearable/fd272/nativeapp/nativeui/classicbluetooth/include/ClassicBlueToothView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothPresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/classicbluetooth/src/ClassicBlueToothView.cpp

index 2d878fd..ea6dae9 100644 (file)
@@ -19,7 +19,6 @@
 #include "wearable_log.h"\r
 namespace OHOS\r
 {\r
-    static constexpr const char *BLUETOOTHEARPHONEBUTTON = "BlueToothEarPhoneButton";             // 蓝牙耳机按钮ID\r
     static constexpr const char *TRADIONALBLUETOOTHBUTTON = "TradionalBluetoothButton";           // 传统蓝牙服按钮ID\r
     static constexpr const char *BLUETOOTHSERVICEOPTIONSBUTTON = "BluetoothServiceOptionsButton"; // 蓝牙服务选项按钮ID\r
     // 返回setting视图界面\r
@@ -57,10 +56,8 @@ namespace OHOS
         bool SetUpBlueToothToggleButton(void);\r
         UIScrollView *BlueToothScrollView = nullptr;\r
         UILabelExt *Title = nullptr;\r
-        UILabelButtonExt *BlueToothEarPhoneButton = nullptr;       // 蓝牙耳机按钮\r
         UILabelButtonExt *TradionalBlueToothButton = nullptr;      // 传统蓝牙按钮\r
         UILabelButtonExt *BluetoothServiceOptionsButton = nullptr; // 蓝牙服务选项按钮\r
-        UILabelExt *BlueToothEarPhoneLabel = nullptr;       // 蓝牙耳机\r
         UILabelExt *TradionalBlueToothLabel = nullptr;      // 传统蓝牙\r
         UILabelExt *BluetoothServiceOptionsLabel = nullptr; // 蓝牙服务选项\r
         UILabelExt *AttentionLabel = nullptr;\r
index 60a8823..e5b6e55 100644 (file)
@@ -69,11 +69,6 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::GetInstance");\r
             return false;\r
         }\r
-\r
-        if (strcmp(view.GetViewId(), BLUETOOTHEARPHONEBUTTON) == 0)\r
-        {\r
-            NativeAbility::GetInstance().EnterSlice(VIEW_BLUETOOTH_EARPHONE);\r
-        }\r
         else if (strcmp(view.GetViewId(), BLUETOOTHSERVICEOPTIONSBUTTON) == 0)\r
         {\r
             if (classicBlueToothView->GetTradionalBlueToothToggleButton()->GetState() == true)\r
index 0ecb248..d0345aa 100644 (file)
@@ -38,11 +38,6 @@ namespace OHOS
                     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
@@ -53,11 +48,6 @@ namespace OHOS
                     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
@@ -155,18 +145,9 @@ namespace OHOS
             .height = 35,\r
             .fontSize = 30,\r
             .lineHeigh = 35,\r
-            .textId = STR_BLUETOOTH_HEADPHONES, /*蓝牙耳机*/\r
+            .textId = STR_TRADITIONAL_BLUETOOTH,\r
             .lineBreakMode = UILabel::LINE_BREAK_OSCILLATION,\r
         };\r
-        BlueToothEarPhoneLabel = SetClassicBlueToothViewLabel(labelconfig);\r
-        if (nullptr == BlueToothEarPhoneLabel)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::BlueToothEarPhoneLabel is nullptr!");\r
-            return false;\r
-        }\r
-        /* -------------------------------------------------------------------------- */\r
-        labelconfig.top = 273;\r
-        labelconfig.textId = STR_TRADITIONAL_BLUETOOTH; /*传统蓝牙*/\r
         TradionalBlueToothLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == TradionalBlueToothLabel)\r
         {\r
@@ -174,7 +155,7 @@ namespace OHOS
             return false;\r
         }\r
         /* -------------------------------------------------------------------------- */\r
-        labelconfig.top = 393;\r
+        labelconfig.top = 273;\r
         labelconfig.textId = STR_BLUETOOTH_SERVICE_OPTIONS; /*蓝牙服务选项*/\r
         BluetoothServiceOptionsLabel = SetClassicBlueToothViewLabel(labelconfig);\r
         if (nullptr == BluetoothServiceOptionsLabel)\r
@@ -189,12 +170,17 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ClassicBlueToothView::AttentionLabel is nullptr!");\r
             return false;\r
         }\r
-        AttentionLabel->SetPosition(53, 499, 360, 180);  // 位置大小\r
+        int y = 0;\r
+        if (BluetoothServiceOptionsButton)\r
+        {\r
+            y = BluetoothServiceOptionsButton->GetY() + BluetoothServiceOptionsButton->GetHeight() + 39;\r
+        }\r
+        AttentionLabel->SetPosition(53, y, 360, 180);    // 位置大小\r
         AttentionLabel->SetStyle(STYLE_TEXT_FONT, 20);   // 字体大小\r
         AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 30); // 字体行高\r
         //.text = "注:开启后10分钟没连接成功会自动关闭,因为传统蓝牙长时间打开会增加电耗,建议在有需要的时候使用(该功能主要用于电话拨打/通知、音乐控制/传输等)",\r
         // AttentionLabel->SetTextId(STR_AUTO_OFF_BLUETOOTH_NOTE);\r
-        //TODO:多国语言\r
+        // TODO:多国语言\r
         AttentionLabel->SetTextId(STR_AUTO_OFF_BLUETOOTH_NOTE2);\r
         AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
         AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
@@ -208,18 +194,6 @@ namespace OHOS
     // 按钮初始化\r
     bool ClassicBlueToothView::SetUpBlueToothButton(void)\r
     {\r
-        BlueToothEarPhoneButton = new UILabelButtonExt();\r
-        if (BlueToothEarPhoneButton == nullptr)\r
-        {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::BlueToothEarPhoneButton new  fail!");\r
-            return false;\r
-        }\r
-        BlueToothEarPhoneButton->SetPosition(43, 120, 380, 100);\r
-        BlueToothEarPhoneButton->SetViewId(BLUETOOTHEARPHONEBUTTON);\r
-        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, 0xff000000, UIButton::PRESSED);\r
         /* -------------------------------------------------------------------------- */\r
         TradionalBlueToothButton = new UILabelButtonExt();\r
         if (TradionalBlueToothButton == nullptr)\r
@@ -227,7 +201,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::TradionalBlueToothButton new  fail!");\r
             return false;\r
         }\r
-        TradionalBlueToothButton->SetPosition(43, 240, 380, 100);\r
+        TradionalBlueToothButton->SetPosition(43, 120, 380, 100);\r
         TradionalBlueToothButton->SetViewId(TRADIONALBLUETOOTHBUTTON);\r
         TradionalBlueToothButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
         TradionalBlueToothButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 16);\r
@@ -239,14 +213,13 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::BluetoothServiceOptionsButton new  fail!");\r
             return false;\r
         }\r
-        BluetoothServiceOptionsButton->SetPosition(43, 360, 380, 100);\r
+        BluetoothServiceOptionsButton->SetPosition(43, 240, 380, 100);\r
         BluetoothServiceOptionsButton->SetViewId(BLUETOOTHSERVICEOPTIONSBUTTON);\r
         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, 0xff000000, UIButton::PRESSED);\r
         /* -------------------------------------------------------------------------- */\r
-        BlueToothEarPhoneButton->SetOnClickListener(presenter_);\r
         BluetoothServiceOptionsButton->SetOnClickListener(presenter_);\r
 \r
         return true;\r
@@ -258,10 +231,10 @@ namespace OHOS
         TradionalBlueToothToggleButton = new UIToggleButton();\r
         if (nullptr == TradionalBlueToothToggleButton)\r
         {\r
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::BlueToothEarPhoneButton new  fail!");\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::TradionalBlueToothToggleButton new  fail!");\r
             return false;\r
         }\r
-        TradionalBlueToothToggleButton->SetPosition(298, 265, 100, 50);\r
+        TradionalBlueToothToggleButton->SetPosition(298, 145, 100, 50);\r
         TradionalBlueToothToggleButton->SetState(ConfigModel::GetInstance()->GetClassicBlueToothState());\r
         TradionalBlueToothToggleButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
         TradionalBlueToothToggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);\r
@@ -293,16 +266,14 @@ namespace OHOS
             ClassicBlueToothViewInit();\r
             initViewStatus = true;\r
         }\r
-        if(BlueToothScrollView == nullptr)\r
+        if (BlueToothScrollView == nullptr)\r
         {\r
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothServiceOptionsView::BlueToothScrollView is nullptr!");\r
             return;\r
         }\r
         BlueToothScrollView->Add(Title);\r
-        BlueToothScrollView->Add(BlueToothEarPhoneButton);\r
         BlueToothScrollView->Add(TradionalBlueToothButton);\r
         BlueToothScrollView->Add(BluetoothServiceOptionsButton);\r
-        BlueToothScrollView->Add(BlueToothEarPhoneLabel);\r
         BlueToothScrollView->Add(TradionalBlueToothLabel);\r
         BlueToothScrollView->Add(BluetoothServiceOptionsLabel);\r
         BlueToothScrollView->Add(AttentionLabel);\r