From: 罗正yun <1732036298@qq.com> Date: Fri, 5 Jan 2024 11:45:54 +0000 (+0800) Subject: 修改音乐来源视图 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=a19bc9f42e1908e490f3a3e7620bb58e65b8e152;p=mirrors%2FFD230.git 修改音乐来源视图 --- diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/include/BluetoothView.h b/code/sdk/application/wearable/nativeapp/nativeui/player/include/BluetoothView.h index 77d24a763..7e12904f1 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/include/BluetoothView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/include/BluetoothView.h @@ -12,6 +12,7 @@ #include "components/ui_radio_button.h" #include "components/ui_label_button.h" #include "components/ui_view_group.h" +#include "components/ui_scroll_view.h" #include "BaseView.h" namespace OHOS { @@ -20,14 +21,18 @@ class BluetoothView { public: BluetoothView(); virtual ~BluetoothView(); - UIViewGroup *LoadBluetoothView(void); + UIViewGroup *LoadMusicSourceView(void); static BluetoothView *GetInstance(void); UIViewGroup *group{nullptr}; + UIScrollView *scrollView{nullptr}; UIRadioButton *GetPhoneButton(void); UIRadioButton *GetWatchButton(void); UIButton *GetSettingButton(void); - UILabelButton *GetDeleteButton(void); private: + UILabel *titleLabel{nullptr}; + UIImageView *phoneBackground{nullptr}; + UIImageView *watchBackground{nullptr}; + UIImageView *bluetoothBackground{nullptr}; UILabel *watchLabel{nullptr}; UILabel *phoneLabel{nullptr}; UILabel *bluetoothLabel{nullptr}; @@ -37,15 +42,12 @@ private: UIRadioButton *watchButton{nullptr}; UIRadioButton *phoneButton{nullptr}; UIButton *settingButton{nullptr}; - UILabelButton *deleteButton{nullptr}; - int LoadRadioButton(); - int LoadButtonView(); - int LoadLabelButton(); - int LoadLabel(); - int LoadImage(); - - void SetUpButton(UILabelButton *btn, const Point& point, int16_t width, int16_t height, - UIView::OnClickListener *listener); + int LoadTitleLabel(void); + int LoadImageBackGround(void); + int LoadRadioButton(void); + int LoadButtonView(void); + int LoadLabel(void); + int LoadImage(void); }; } // namespace OHOS #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/src/BluetoothView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/player/src/BluetoothView.cpp index b6534909a..d03e9e494 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/src/BluetoothView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/src/BluetoothView.cpp @@ -8,36 +8,37 @@ #include "UiConfig.h" #include "BluetoothEarPhoneView.h" #include "PlayersPresenter.h" - +#include "ui_resource_image.h" +#include "common/image_cache_manager.h" namespace OHOS { static BluetoothView *g_bluetoothView{nullptr}; -static constexpr uint16_t TEXT_WIDTH = 155; -static constexpr uint16_t TEXT_HEIGHT = 40; +static constexpr uint16_t TEXT_WIDTH = 120; +static constexpr uint16_t TEXT_HEIGHT = 35; static constexpr uint16_t HEIGHT = 55; -static constexpr uint16_t HEIGHT2 = 75; -static constexpr uint16_t WIDTH = 55; -static constexpr uint16_t WIDTH2 = 75; +static constexpr uint16_t HEIGHT2 = 40; +static constexpr uint16_t WIDTH = 80; +static constexpr uint16_t WIDTH2 = 80; static constexpr uint16_t BUTTON_WIDTH = 180; static constexpr uint16_t BUTTON_HEIGHT = 40; constexpr uint16_t BLUETOOTH_OK = 0; constexpr int16_t BLUETOOTH_ERROR = (-1); -static constexpr uint16_t IMAGE_X = 50; -static constexpr uint16_t IMAGE_Y = 98; -static constexpr uint16_t IMAGE_Y2 = 187; -static constexpr uint16_t IMAGE_Y3 = 278; -static constexpr uint16_t STEP_LABEL_X = 155; -static constexpr uint16_t BUTTON_X = 320; -static constexpr uint16_t BUTTON_X2 = 313; +static constexpr uint16_t IMAGE_X = 83; +static constexpr uint16_t IMAGE_Y = 150; +static constexpr uint16_t IMAGE_Y2 = 270; +static constexpr uint16_t IMAGE_Y3 = 390; +static constexpr uint16_t STEP_LABEL_X = 143; +static constexpr uint16_t BUTTON_X = 300; +static constexpr uint16_t BUTTON_X2 = 326; static constexpr uint16_t BUTTON_X3 = 135; -static constexpr uint16_t BUTTON_Y = 104; -static constexpr uint16_t BUTTON_Y2 = 194; -static constexpr uint16_t BUTTON_Y3 = 278; +static constexpr uint16_t BUTTON_Y = 140; +static constexpr uint16_t BUTTON_Y2 = 260; +static constexpr uint16_t BUTTON_Y3 = 397; static constexpr uint16_t BUTTON_Y4 = 402; -static constexpr uint16_t STEP_LABEL_Y = 108; -static constexpr uint16_t STEP_LABEL_Y2 = 199; -static constexpr uint16_t STEP_LABEL_Y3 = 290; +static constexpr uint16_t STEP_LABEL_Y = 153; +static constexpr uint16_t STEP_LABEL_Y2 = 273; +static constexpr uint16_t STEP_LABEL_Y3 = 393; BluetoothView::BluetoothView() { @@ -60,17 +61,19 @@ BluetoothView::~BluetoothView() if (click != nullptr) { delete click; } + click = nullptr; delete phoneButton; phoneButton = nullptr; delete settingButton; settingButton = nullptr; - click = deleteButton->GetOnClickListener(); - if (click != nullptr) { - delete click; - } - click = nullptr; - delete deleteButton; - deleteButton = nullptr; + delete titleLabel; + titleLabel = nullptr; + delete phoneBackground; + phoneBackground = nullptr; + delete watchBackground; + watchBackground = nullptr; + delete bluetoothBackground; + bluetoothBackground = nullptr; delete watchLabel; watchLabel = nullptr; delete phoneLabel; @@ -83,6 +86,8 @@ BluetoothView::~BluetoothView() phoneImage = nullptr; delete bluetoothImage; bluetoothImage = nullptr; + delete scrollView; + scrollView = nullptr; delete group; group = nullptr; g_bluetoothView = nullptr; @@ -98,11 +103,6 @@ UIButton *BluetoothView::GetSettingButton(void) return settingButton; } -UILabelButton *BluetoothView::GetDeleteButton(void) -{ - return deleteButton; -} - UIRadioButton *BluetoothView::GetWatchButton(void) { return watchButton; @@ -130,9 +130,9 @@ public: return false; } if (view_ == (UIView *)bluetoothView->GetWatchButton()) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "watchButton OnClick"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "watchButton OnClick");//手表音乐 } else if (view_ == (UIView *)bluetoothView->GetPhoneButton()) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "phoneButton OnClick"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "phoneButton OnClick");//手机音乐 } else if (view_ == (UIView *)bluetoothView->GetSettingButton()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "settingButton OnClick"); JumpView *jumpView = JumpView::GetInstance(); @@ -142,8 +142,6 @@ public: } jumpView->ChangeView(JumpView::BluetoothJumpViewNum::BLUETOOTHEVIEW, JumpView::BluetoothJumpViewNum::BLUETOOTHEARPHONEVIEW); - } else if (view_ == (UIView *)bluetoothView->GetDeleteButton()) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "deleteButton OnClick"); } return true; } @@ -151,120 +149,107 @@ private: UIView *view_ = nullptr; }; -void BluetoothView::SetUpButton(UILabelButton *btn, const Point& point, - int16_t width, int16_t height, UIView::OnClickListener *listener) +/// @brief 加载标题文本:音乐来源 +/// @return +int BluetoothView::LoadTitleLabel(void) { - if (btn == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "btn null!"); - return; + if (titleLabel == nullptr) { + titleLabel = new UILabel(); + if (titleLabel == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel new fail"); + return BLUETOOTH_ERROR; + } } - btn->SetPosition(point.x, point.y, width, height); - btn->SetOnClickListener(listener); + titleLabel->SetPosition(173, 52, 120, 35); + titleLabel->SetText("音乐来源"); + titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_THIRTY_SIZE); + return BLUETOOTH_OK; } -int BluetoothView::LoadRadioButton() +/// @brief 加载要放置各种组件的背景图片,一共三个 +/// @return +int BluetoothView::LoadImageBackGround(void) { - if (watchButton == nullptr) { - watchButton = new UIRadioButton("MusicCategory"); - if (watchButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "watchButton UIRadio new fail"); + if(phoneBackground == nullptr){ + phoneBackground = new UIImageView(); + if (phoneBackground == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneBackground UIImageView new fail"); return BLUETOOTH_ERROR; } } - if (phoneButton == nullptr) { - phoneButton = new UIRadioButton("MusicCategory"); - if (phoneButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneButton UIRadio new fail"); + if(watchBackground == nullptr){ + watchBackground = new UIImageView(); + if (watchBackground == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "watchBackground UIImageView new fail"); return BLUETOOTH_ERROR; } } - UIView::OnClickListener *listener1 = new BluetoothOnClickListener(reinterpret_cast(watchButton)); - if (listener1 == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listener1 new fail"); - return BLUETOOTH_ERROR; - } - watchButton->SetPosition(BUTTON_X, BUTTON_Y, WIDTH, HEIGHT); - watchButton->SetOnClickListener(listener1); - watchButton->SetTouchable(false); - UIView::OnClickListener *listener2 = new BluetoothOnClickListener(reinterpret_cast(phoneButton)); - if (listener2 == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listener2 new fail"); - return BLUETOOTH_ERROR; + if(bluetoothBackground == nullptr){ + bluetoothBackground = new UIImageView(); + if (bluetoothBackground == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetoothBackground UIImageView new fail"); + return BLUETOOTH_ERROR; + } } - phoneButton->SetPosition(BUTTON_X, BUTTON_Y2, WIDTH, HEIGHT); - phoneButton->SetOnClickListener(listener2); - phoneButton->SetTouchable(false); + + const char* BackgroundImage = "/user/res/SETTING_BACKGROUND.bin"; + phoneBackground->SetPosition(43,120); + phoneBackground->SetStyle(STYLE_BORDER_RADIUS, 100); + phoneBackground->SetSrc(BackgroundImage); + + watchBackground->SetPosition(43,240); + watchBackground->SetStyle(STYLE_BORDER_RADIUS, 100); + watchBackground->SetSrc(BackgroundImage); + + bluetoothBackground->SetPosition(43,360); + bluetoothBackground->SetStyle(STYLE_BORDER_RADIUS, 100); + bluetoothBackground->SetSrc(BackgroundImage); return BLUETOOTH_OK; } -int BluetoothView::LoadLabelButton() +/// @brief 加载图片图标 +/// @param +/// @return +int BluetoothView::LoadImage(void) { - struct Point pointBtn; - // 跳转按钮 - pointBtn.x = BUTTON_X2; - pointBtn.y = BUTTON_Y3; - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::PlayersPresenter::GetInstance(); - if (clickListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance fail"); - return BLUETOOTH_ERROR; - } - settingButton->SetPosition(pointBtn.x, pointBtn.y, WIDTH, HEIGHT); - settingButton->SetOnClickListener(clickListener); - settingButton->SetImageSrc(PNG_SETTTING_BUTTON_IMAGE, PNG_SETTTING_BUTTON_IMAGE); - settingButton->SetViewId(BLUETOOTH_SETTING_BUTTON); - // 删除按钮 - pointBtn.x = BUTTON_X3; - pointBtn.y = BUTTON_Y4; - UIView::OnClickListener *listener4 = new BluetoothOnClickListener(reinterpret_cast(deleteButton)); - if (listener4 == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listener4 new fail"); + ImageInfo *image; + // 图片图标 + phoneImage = new UIImageView(); + if (phoneImage == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneImage new fail"); return BLUETOOTH_ERROR; } - SetUpButton(deleteButton, pointBtn, BUTTON_WIDTH, BUTTON_HEIGHT, listener4); - deleteButton->SetText("删除音乐"); - deleteButton->SetVisible(false); - return BLUETOOTH_OK; -} + phoneImage->SetPosition(IMAGE_X, IMAGE_Y, WIDTH2, HEIGHT2); + image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_PHONE_WHITE, PLAYER_IAMGES); + phoneImage->SetSrc(image); -int BluetoothView::LoadButtonView() -{ - if (LoadRadioButton() == BLUETOOTH_ERROR) { + + watchImage = new UIImageView(); + if (watchImage == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "watchImage new fail"); return BLUETOOTH_ERROR; } - if (settingButton == nullptr) { - settingButton = new UIButton(); - if (settingButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "settingButton UIButton new fail"); - return BLUETOOTH_ERROR; - } - } - if (deleteButton == nullptr) { - deleteButton = new UILabelButton(); - if (deleteButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "deleteButton UILabelButton new fail"); - return BLUETOOTH_ERROR; - } - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "LoadButtonView"); - if (LoadLabelButton() == BLUETOOTH_ERROR) { + watchImage->SetPosition(IMAGE_X, IMAGE_Y2, WIDTH2, HEIGHT2); + image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_LOCAL_MUSIC_WHITE, PLAYER_IAMGES); + watchImage->SetSrc(image); + + bluetoothImage = new UIImageView(); + if (bluetoothImage == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetoothImage new fail"); return BLUETOOTH_ERROR; } + bluetoothImage->SetPosition(IMAGE_X, IMAGE_Y3, WIDTH2, HEIGHT2); + image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_EARPHONE_WHITE, PLAYER_IAMGES); + bluetoothImage->SetSrc(image); return BLUETOOTH_OK; } +/// @brief 加载文本 +/// @param +/// @return int BluetoothView::LoadLabel(void) { - // 标题文本 - if (watchLabel == nullptr) { - watchLabel = new UILabel(); - if (watchLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "watchLabel new fail"); - return BLUETOOTH_ERROR; - } - } - watchLabel->SetPosition(STEP_LABEL_X, STEP_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); - watchLabel->SetText("手表音乐"); - watchLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_THIRTY_SIZE); + /* -------------------------------------------------------------------------- */ if (phoneLabel == nullptr) { phoneLabel = new UILabel(); if (phoneLabel == nullptr) { @@ -275,6 +260,18 @@ int BluetoothView::LoadLabel(void) phoneLabel->SetPosition(STEP_LABEL_X, STEP_LABEL_Y2, TEXT_WIDTH, TEXT_HEIGHT); phoneLabel->SetText("手机音乐"); phoneLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_THIRTY_SIZE); + /* -------------------------------------------------------------------------- */ + if (watchLabel == nullptr) { + watchLabel = new UILabel(); + if (watchLabel == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "watchLabel new fail"); + return BLUETOOTH_ERROR; + } + } + watchLabel->SetPosition(STEP_LABEL_X, STEP_LABEL_Y, TEXT_WIDTH, TEXT_HEIGHT); + watchLabel->SetText("手表音乐"); + watchLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_THIRTY_SIZE); + /* -------------------------------------------------------------------------- */ if (bluetoothLabel == nullptr) { bluetoothLabel = new UILabel(); if (bluetoothLabel == nullptr) { @@ -285,64 +282,133 @@ int BluetoothView::LoadLabel(void) bluetoothLabel->SetPosition(STEP_LABEL_X, STEP_LABEL_Y3, TEXT_WIDTH, TEXT_HEIGHT); bluetoothLabel->SetText("蓝牙音乐"); bluetoothLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_THIRTY_SIZE); + /* -------------------------------------------------------------------------- */ return BLUETOOTH_OK; } -int BluetoothView::LoadImage(void) +/// @brief 加载两个radiobutton +/// @return +int BluetoothView::LoadRadioButton(void) { - // 图片图标 - watchImage = new UIImageView(); - if (watchImage == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "watchImage new fail"); + /* -------------------------------------------------------------------------- */ + if (phoneButton == nullptr) { + phoneButton = new UIRadioButton("MusicCategory"); + if (phoneButton == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneButton UIRadio new fail"); + return BLUETOOTH_ERROR; + } + } + UIView::OnClickListener *listener1 = new BluetoothOnClickListener(reinterpret_cast(phoneButton)); + if (listener1 == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listener1 new fail"); return BLUETOOTH_ERROR; } - watchImage->SetPosition(IMAGE_X, IMAGE_Y, WIDTH2, HEIGHT2); - watchImage->SetSrc(PNG_WATCH_IMAGE); - - phoneImage = new UIImageView(); - if (phoneImage == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneImage new fail"); + phoneButton->SetPosition(BUTTON_X, BUTTON_Y, WIDTH, HEIGHT); + phoneButton->SetImages(PNG_CHECKBOX_ON_IMAGE,PNG_CHECKBOX_OFF_IMAGE); + phoneButton->SetOnClickListener(listener1); + + /* -------------------------------------------------------------------------- */ + if (watchButton == nullptr) { + watchButton = new UIRadioButton("MusicCategory"); + if (watchButton == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "watchButton UIRadio new fail"); + return BLUETOOTH_ERROR; + } + } + UIView::OnClickListener *listener2 = new BluetoothOnClickListener(reinterpret_cast(watchButton)); + if (listener2 == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listener2 new fail"); return BLUETOOTH_ERROR; } - phoneImage->SetPosition(IMAGE_X, IMAGE_Y2, WIDTH2, HEIGHT2); - phoneImage->SetSrc(PNG_PHONE_IMAGE); + watchButton->SetPosition(BUTTON_X, BUTTON_Y2, WIDTH, HEIGHT); + watchButton->SetImages(PNG_CHECKBOX_ON_IMAGE,PNG_CHECKBOX_OFF_IMAGE); + watchButton->SetOnClickListener(listener2); + /* -------------------------------------------------------------------------- */ + return BLUETOOTH_OK; +} - bluetoothImage = new UIImageView(); - if (bluetoothImage == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetoothImage new fail"); +/// @brief 加载蓝牙耳机按钮视图 +/// @return +int BluetoothView::LoadButtonView(void) +{ + if (settingButton == nullptr) { + settingButton = new UIButton(); + if (settingButton == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "settingButton UIButton new fail"); + return BLUETOOTH_ERROR; + } + } + // 跳转按钮 + UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::PlayersPresenter::GetInstance(); + if (clickListener == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "clickListener GetInstance fail"); return BLUETOOTH_ERROR; } - bluetoothImage->SetPosition(IMAGE_X, IMAGE_Y3, WIDTH2, HEIGHT2); - bluetoothImage->SetSrc(PNG_BLUETOOTH_IMAGE); + settingButton->SetPosition(BUTTON_X2,BUTTON_Y3, WIDTH, HEIGHT); + settingButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + settingButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + settingButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + settingButton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED); + settingButton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED); + settingButton->SetOnClickListener(clickListener); + settingButton->SetImageSrc(PNG_SETTING_NEXT_IMAGE, PNG_SETTING_NEXT_IMAGE); + settingButton->SetViewId(BLUETOOTH_SETTING_BUTTON); return BLUETOOTH_OK; } -UIViewGroup *BluetoothView::LoadBluetoothView() + +/// @brief 加载音乐来源视图 +/// @return +UIViewGroup *BluetoothView::LoadMusicSourceView(void) { - if (group == nullptr) { + if(group == nullptr) + { group = new UIViewGroup(); if (group == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail"); return nullptr; } } - group->SetPosition(0, 0); - group->SetWidth(HORIZONTAL_RESOLUTION); - group->SetHeight(VERTICAL_RESOLUTION); - LoadButtonView(); - LoadLabel(); + group->SetPosition(0, 0, 466, 466); + group->SetStyle(STYLE_BACKGROUND_OPA, 0); + if (scrollView == nullptr) { + scrollView = new UIScrollView(); + if (scrollView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "scrollView new fail"); + return nullptr; + } + } + scrollView->SetPosition(0, 0,466,466); + scrollView->SetScrollBlankSize(40); + scrollView->SetReboundSize(50); + scrollView->SetDirection(1); + group->Add(scrollView); + + LoadTitleLabel(); + LoadImageBackGround(); LoadImage(); + LoadLabel(); + LoadRadioButton(); + LoadButtonView(); + + scrollView->Add(titleLabel); + + scrollView->Add(phoneBackground); + scrollView->Add(watchBackground); + scrollView->Add(bluetoothBackground); + + scrollView->Add(watchImage); + scrollView->Add(phoneImage); + scrollView->Add(bluetoothImage); + + scrollView->Add(watchLabel); + scrollView->Add(phoneLabel); + scrollView->Add(bluetoothLabel); + + scrollView->Add(watchButton); + scrollView->Add(phoneButton); + scrollView->Add(settingButton); - group->Add(watchLabel); - group->Add(phoneLabel); - group->Add(bluetoothLabel); - group->Add(watchButton); - group->Add(phoneButton); - group->Add(settingButton); - group->Add(deleteButton); - group->Add(watchImage); - group->Add(phoneImage); - group->Add(bluetoothImage); UIView::OnDragListener *earDragListener = (UIView::OnDragListener *)OHOS::PlayerOnDragListener::GetInstance(); if (earDragListener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "earDragListener GetInstance fail"); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersPresenter.cpp index 70159e4ca..98190380e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersPresenter.cpp @@ -146,6 +146,7 @@ bool JumpView::ChangeBluetoothEarListView(int16_t hideView, int16_t thisView) return true; } +//切换到音乐来源视图 bool JumpView::ChangeBluetoothView(int16_t hideView, int16_t thisView) { UNUSED(hideView); @@ -157,7 +158,7 @@ bool JumpView::ChangeBluetoothView(int16_t hideView, int16_t thisView) return false; } // init view - UIViewGroup *group = bluetoothView->LoadBluetoothView(); + UIViewGroup *group = bluetoothView->LoadMusicSourceView(); if (group == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail"); return false;