From: 罗正yun <1732036298@qq.com> Date: Mon, 25 Dec 2023 10:30:19 +0000 (+0800) Subject: 音乐播放视图主界面修改 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=3223122326399e30408ce9f8b950f9c3569ff655;p=mirrors%2FFD230.git 音乐播放视图主界面修改 --- diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/ui_resource_image.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/ui_resource_image.h index 483c701a2..f79de41b4 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/ui_resource_image.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/ui_resource_image.h @@ -1,27 +1,40 @@ #ifndef UI_RESOURCE_IMAGE_H #define UI_RESOURCE_IMAGE_H #include -namespace OHOS { +namespace OHOS +{ static const int DIR_MASK = 0xfff00000; static const int PNG_MASK = 0x000fffff; static const int HEART_HEARTRATECOOR = 0x100001; static const int HEART_HEARTRATE_BOTTOM = 0x100002; static const int HEART_HEARTRATE_TOP = 0x100003; - static const int PLAYER_PLAYERSMODEL_RANDOM = 0x200001; - static const int PLAYER_INCREASE_BUTTON = 0x200002; - static const int PLAYER_PLAYERSMODEL_SEQUENCE = 0x200003; - static const int PLAYER_DECREASE_BUTTON = 0x200004; - static const int PLAYER_PLAYERSMODEL_LOOP = 0x200005; - static const int PLAYER_PLAYER = 0x200006; - static const int PLAYER_BACK_GROUND = 0x200007; - static const int PLAYER_SOUND_IMAGE = 0x200008; - static const int PLAYER_MUTE_BUTTON = 0x200009; - static const int PLAYER_OPTIONS_IMAGE = 0x20000a; - static const int PLAYER_NEXT_BUTTON = 0x20000b; - static const int PLAYER_PLAYERSMODEL_REPEATS = 0x20000c; - static const int PLAYER_PLAYERHIGHLIGHT = 0x20000d; - static const int PLAYER_PRE_BUTTOW = 0x20000e; + /* -------------------------------------------------------------------------- */ + static const int PLAYER_BACKGROUND = 0x200001; // 音乐背景 + static const int PLAYER_DECREASE_BUTTON = 0x200002; // 点击后声音减少 + static const int PLAYER_EARPHONE = 0x200003; // 大的蓝牙耳机的icon + static const int PLAYER_EARPHONE_COLOR = 0x200004; // 蓝牙耳机模式绿色图片 + static const int PLAYER_EARPHONE_WHITE = 0x200005; // 蓝牙耳机模式白色图片 + static const int PLAYER_ELLIPSE = 0x200006; // 椭圆 + static const int PLAYER_INCREASE_BUTTON = 0x200007; // 点击后声音加 + static const int PLAYER_LOCAL_MUSIC_COLOR = 0x200008; // 本地音乐模式绿色图片,默认本地模式 + static const int PLAYER_LOCAL_MUSIC_WHITE = 0x200009; // 本地音乐模式白色图片 + static const int PLAYER_MUSIC_DELETE = 0x20000a; // 删除音乐 + static const int PLAYER_MUSIC_LIST = 0x20000b; // 音乐列表 + static const int PLAYER_MUSIC_NEXT = 0x20000c; // 下一首音乐 + static const int PLAYER_MUSIC_PROVE = 0x20000d; // 上一首音乐 + static const int PLAYER_MUSIC_VOICE = 0x20000e; // 音量 + static const int PLAYER_MUTE_BUTTON = 0x20000f; // 静音 + static const int PLAYER_PAUSE = 0x200010; // 播放暂停 + static const int PLAYER_PHONE_COLOR = 0x200011; // 手机音乐模式绿色图片 + static const int PLAYER_PHONE_WHITE = 0x200012; // 手机音乐模式白色图片 + static const int PLAYER_PLAY = 0x200013; // 播放音乐 + static const int PLAYER_PLAYERSMODEL_LOOP = 0x200014; // 播放模式:循环播放 + static const int PLAYER_PLAYERSMODEL_RANDOM = 0x200015; // 播放模式:随机播放 + static const int PLAYER_PLAYERSMODEL_REPEATS = 0x200016; // 播放模式:单曲循环 + static const int PLAYER_PLAYERSMODEL_SEQUENCE = 0x200017; // 播放模式循序播放 + static const int PLAYER_PLAYING = 0x200018; // 播放音乐中 + /* -------------------------------------------------------------------------- */ static const int CLOCK_HAND24HOUR_IMAGE_PATH = 0x300001; static const int CLOCK_BIGCIRCLE_IMAGE_PATH = 0x300002; static const int CLOCK_PROGRESS_IMAGE_PATH = 0x300003; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersView.h b/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersView.h index 897c068f4..87344686a 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersView.h @@ -76,13 +76,16 @@ private: int ShowUpButtonOptions(); int ShowUpButtonView(); int ShowUpCircleProgress(); + int ShowUpMusicListbutton(); bool ShowUpPlayerMode(); void SetUpButton(UIButton *btn, const Point& point, int16_t width, int16_t height, UIView::OnClickListener *listener); bool LoadPlayerImage(UIImageView *View, uint32_t resId); bool LoadPlayerImage(UIButton *button, uint32_t resId, uint32_t hlResId); - UIImageView *backGround{nullptr}; + UIImageView *backGround{nullptr}; //音乐播放器背景 + UIImageView *elipse{nullptr}; //放复选框的绿色椭圆图片 + UIButton * music_list_button{nullptr}; //音乐列表按钮 UILabel *subTitleLabel{nullptr}; //副标题标签:在这里为音乐作者 PlayersCaseListAdapter *adapterText{nullptr}; UILabel *titleLabel{nullptr}; //主标题标签:在这里为音乐名 @@ -108,6 +111,7 @@ private: UIView::OnClickListener *prelistener{nullptr}; UIView::OnClickListener *modellistener{nullptr}; UIView::OnClickListener *optionslistener{nullptr}; + UIView::OnClickListener *music_list_button_listener{nullptr}; bool viewiInitStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersView.cpp index 801f2697f..c704a5348 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersView.cpp @@ -269,8 +269,8 @@ void PlayersView::SetUpButton(UIButton *btn, const Point& point, //复选框:选中播放未选中暂停 int PlayersView::ShowUpCheckBoxButton() { - ImageInfo *image; - ImageInfo *hlImage; + ImageInfo *ImagePlay; + ImageInfo *ImagerPause; if (playerButton == nullptr) { playerButton = new UICheckBox(); } @@ -286,11 +286,11 @@ int PlayersView::ShowUpCheckBoxButton() WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playerlistener new fail"); return OHOS_FAILURE; } - playerButton->SetPosition(140, 139, 172, 172); // 140:x 139:y 172:width 172:height + playerButton->SetPosition(195, 195, 80, 80); // 140:x 139:y 172:width 172:height playerButton->SetOnClickListener(playerlistener); - image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_PLAYER, PLAYER_IAMGES); //播放图片 - hlImage = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_PLAYERHIGHLIGHT, PLAYER_IAMGES);//暂停图片 - playerButton->SetImages(hlImage, image); + ImagePlay = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_PLAY, PLAYER_IAMGES); //播放图片 + ImagerPause = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_PAUSE, PLAYER_IAMGES);//暂停图片 + playerButton->SetImages(ImagePlay, ImagerPause); Add(playerButton); soundlistener = new ButtonOnClickListener(reinterpret_cast(soundButton)); @@ -299,9 +299,9 @@ int PlayersView::ShowUpCheckBoxButton() return OHOS_FAILURE; } soundButton->SetTouchable(true); - soundButton->SetPosition(178, 316, 95, 76); // 178:x 316:y 95:width 76:height + soundButton->SetPosition(321, 321, 60, 60); soundButton->SetOnClickListener(soundlistener); - if (LoadPlayerImage(soundButton, PLAYER_SOUND_IMAGE) == false) { + if (LoadPlayerImage(soundButton, PLAYER_MUSIC_VOICE) == false) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playerModelButton LoadPlayerImage fail"); return false; } @@ -313,36 +313,45 @@ int PlayersView::ShowUpButton() { struct Point pointBtn; ImageInfo *image; - pointBtn.x = 331; // 331:x - pointBtn.y = 168; // 168:y + pointBtn.x = 366; // 366:x + pointBtn.y = 213; // 213:y nextlistener = new ButtonOnClickListener(reinterpret_cast(nextButton)); if (nextlistener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "nextlistener new fail"); return OHOS_FAILURE; } - SetUpButton(nextButton, pointBtn, 93, 116, nextlistener); // 93:width 116:height - image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_NEXT_BUTTON, PLAYER_IAMGES); + SetUpButton(nextButton, pointBtn, 60, 60, nextlistener); // 93:width 116:height + image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUSIC_NEXT, PLAYER_IAMGES); nextButton->SetImageSrc(image, image); - pointBtn.x = 31; // 31:x - pointBtn.y = 168; // 168:y + nextButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + nextButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + nextButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffbfbfb, UIButton::PRESSED); + nextButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + nextButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + pointBtn.x = 60; // 60:x + pointBtn.y = 213; // 213:y prelistener = new ButtonOnClickListener(reinterpret_cast(preButton)); if (prelistener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "prelistener new fail"); return OHOS_FAILURE; } - SetUpButton(preButton, pointBtn, 86, 116, prelistener); // 86:width 116:height - image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_PRE_BUTTOW, PLAYER_IAMGES); + SetUpButton(preButton, pointBtn, 60, 60, prelistener); // 86:width 116:height + image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUSIC_PROVE, PLAYER_IAMGES); preButton->SetImageSrc(image, image); - - pointBtn.x = 87; // 87:x - pointBtn.y = 316; // 316:y + preButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + preButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + preButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffbfbfb, UIButton::PRESSED); + preButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + preButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + pointBtn.x = 105; // 105:x + pointBtn.y = 321; // 321:y modellistener = new ButtonOnClickListener(reinterpret_cast(playerModelButton)); if (modellistener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "modellistener new fail"); return OHOS_FAILURE; } playerModelButton->SetTouchable(true); - playerModelButton->SetPosition(pointBtn.x, pointBtn.y, 95, 76); // 95:width 76:height + playerModelButton->SetPosition(pointBtn.x, pointBtn.y, 60, 60); playerModelButton->SetOnClickListener(modellistener); if (ShowUpPlayerMode() == false) { return OHOS_FAILURE; @@ -395,6 +404,9 @@ int PlayersView::ShowUpButtonView() if (optionsButton == nullptr) { optionsButton = new UIButton(); } + if (music_list_button == nullptr) { + music_list_button = new UIButton(); + } if (pullButton == nullptr) { pullButton = new UIButton(); } @@ -420,6 +432,33 @@ int PlayersView::ShowUpButtonView() if (ret == OHOS_FAILURE) { return OHOS_FAILURE; } + ret = ShowUpMusicListbutton(); + if (ret == OHOS_FAILURE) { + return OHOS_FAILURE; + } + return OHOS_SUCCESS; +} + +//显示音乐列表按钮 +int PlayersView::ShowUpMusicListbutton() +{ + struct Point pointBtn; + pointBtn.x = 213; + pointBtn.y = 35; + music_list_button_listener = new ButtonOnClickListener(reinterpret_cast(music_list_button)); + if (music_list_button_listener == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "music_list_button_listener new fail"); + return OHOS_FAILURE; + } + SetUpButton(music_list_button, pointBtn, 60, 60, music_list_button_listener); // 75:width 76:height + ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUSIC_LIST, PLAYER_IAMGES); + music_list_button->SetImageSrc(image, image); + music_list_button->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + music_list_button->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + music_list_button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffbfbfb, UIButton::PRESSED); + music_list_button->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + music_list_button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + return OHOS_SUCCESS; } /* @@ -429,16 +468,21 @@ int PlayersView::ShowUpButtonView() int PlayersView::ShowUpButtonOptions() { struct Point pointBtn; - pointBtn.x = 284; // 284 : x - pointBtn.y = 316; // 316 : y + pointBtn.x = 213; + pointBtn.y = 366; optionslistener = new ButtonOnClickListener(reinterpret_cast(optionsButton)); if (optionslistener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "optionslistener new fail"); return OHOS_FAILURE; } - SetUpButton(optionsButton, pointBtn, 75, 76, optionslistener); // 75:width 76:height - ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_OPTIONS_IMAGE, PLAYER_IAMGES); + SetUpButton(optionsButton, pointBtn, 60, 60, optionslistener); // 75:width 76:height + ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_LOCAL_MUSIC_COLOR, PLAYER_IAMGES); optionsButton->SetImageSrc(image, image); + optionsButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + optionsButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + optionsButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffbfbfb, UIButton::PRESSED); + optionsButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + optionsButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); pointBtn.x = 178; // 178:x pointBtn.y = 394; // 394:y @@ -456,17 +500,21 @@ int PlayersView::ShowUpCircleProgress() return OHOS_FAILURE; } } - playbackProgress->SetPosition(140, 139, 172, 172); // 140:x 139:y 172:width 172:height - playbackProgress->SetCenterPosition(86, 86); // 86:x 86:y + playbackProgress->SetPosition(158, 158, 150, 150); + playbackProgress->SetCenterPosition(75, 75); playbackProgress->SetRange(PLAY_PROGRESS_MAX, PLAY_PROGRESS_MIN); - playbackProgress->SetRadius(86); // 86:radius + playbackProgress->SetRadius(70); playbackProgress->SetStartAngle(0); playbackProgress->SetEndAngle(360); // 360: end angle playbackProgress->SetValue(0); - playbackProgress->SetBackgroundStyle(STYLE_LINE_COLOR, Color::Gray().full); - playbackProgress->SetForegroundStyle(STYLE_LINE_COLOR, Color::Red().full); - playbackProgress->SetBackgroundStyle(STYLE_LINE_WIDTH, 3); // 3:width - playbackProgress->SetForegroundStyle(STYLE_LINE_WIDTH, 3); // 3:width + playbackProgress->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + playbackProgress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000); + playbackProgress->SetBackgroundStyle(STYLE_LINE_COLOR, 0xfff61313); + playbackProgress->SetBackgroundStyle(STYLE_LINE_WIDTH, 0); + playbackProgress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xfffbfbfb); + playbackProgress->SetForegroundStyle(STYLE_BORDER_COLOR, 0xffffffff); + playbackProgress->SetForegroundStyle(STYLE_LINE_COLOR, 0xffffffff); + playbackProgress->SetForegroundStyle(STYLE_LINE_WIDTH, 6); // 6:width Add(playbackProgress); return OHOS_SUCCESS; } @@ -514,11 +562,25 @@ bool PlayersView::InitBackGround(void) } } backGround->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (LoadPlayerImage(backGround, PLAYER_BACK_GROUND) == false) { + if (LoadPlayerImage(backGround, PLAYER_BACKGROUND) == false) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "backGround LoadPlayerImage fail"); return false; } + /* -------------------------------------------------------------------------- */ + if(elipse == nullptr){ + elipse = new UIImageView(); + if(elipse ==nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "elipse new fail"); + return false; + } + } + elipse->SetPosition(173,173,120,120); + if (LoadPlayerImage(elipse, PLAYER_ELLIPSE) == false) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "elipse LoadPlayerImage fail"); + return false; + } Add(backGround); + Add(elipse); return true; } //创建音乐名,作者名 @@ -562,6 +624,7 @@ bool PlayersView::OnDragEvent(const DragEvent& event) return false; } +//初始化音乐播放器主视图 bool PlayersView::InitView(void) { int ret; @@ -571,7 +634,7 @@ bool PlayersView::InitView(void) return false; } - CreatePlayerMusicName(); + //CreatePlayerMusicName(); // changeView CreateJumpView(); // OnClick diff --git a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp index 303fb5330..c12093c5b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp @@ -168,7 +168,7 @@ bool ScreenModels::LoadAppImages(std::string file, UIImageView *view, uint32_t r void ScreenModels::PreLoadAppimages(void) { - LoadAppMultiImages(PLAYER_IAMGES, PLAYER_PLAYERSMODEL_RANDOM, PLAYER_PLAYERHIGHLIGHT); + LoadAppMultiImages(PLAYER_IAMGES, PLAYER_PLAYERSMODEL_RANDOM, PLAYER_PLAY); LoadAppMultiImages(DIAL_CLOCK, CLOCK_HAND24HOUR_IMAGE_PATH, CLOCK_TUESDAY_IMAGE_PATH); //LoadAppMultiImages(CLOCK_IAMGES, CLOCK_HAND24HOUR_IMAGE_PATH, CLOCK_TUESDAY_IMAGE_PATH); LoadAppMultiImages(COMPASS_IAMGES, COMPASS_ROTATE_CENTER_IMAGE, COMPASS_COMPASS); diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/player/player.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/player/player.bin index 6743f92e6..4ad3caac2 100644 Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/player/player.bin and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fs/user/res/player/player.bin differ