From: luozheng <1732036298@qq.com> Date: Thu, 28 Nov 2024 06:49:13 +0000 (+0800) Subject: 音乐界面优化:若当前在播放手机音乐这时点击音乐列表中音乐会提示弹窗而不是点击无反应 X-Git-Tag: fd230_release_V1.3.102~7^2~7 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=feee58ef88c44e3f078fb997043741009238e27a;p=mirrors%2FFD230.git 音乐界面优化:若当前在播放手机音乐这时点击音乐列表中音乐会提示弹窗而不是点击无反应 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h index 5565d9694..3ece4e202 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-21 18:17:23 + * @LastEditTime: 2024-11-28 11:04:43 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h */ @@ -122,6 +122,8 @@ public: std::string getHexMusicNameFromMusicName(const std::string &musicName); int getIdToMusicNameMapNumber(void); void showIdToMusicNameMapData(void); + int getPreShowView(void); + void setPreShowView(int index); // /* -------------------------------------------------------------------------- */ private: bool phonePlayButtonState{false}; @@ -130,6 +132,7 @@ private: int64_t playerMusicDuration_{0}; int64_t playerProgressValue_{0}; std::unordered_map> idToMusicNameMap;//> + int preshowView{0}; private: PlayersCaseListAdapter *m_PlayersCaseListAdapter{nullptr}; int64_t duration_{0}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerTipView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerTipView.cpp index 4973b3571..5c1285368 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerTipView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerTipView.cpp @@ -2,11 +2,12 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-10-19 11:27:19 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-11-05 14:29:01 + * @LastEditTime: 2024-11-28 11:22:01 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerTipView.cpp */ #include "player/include/MusicPlayerTipView.h" #include "player/include/PlayersPresenter.h" +#include "player/include/PlayersModel.h" #include "wearable_log.h" #include "UiConfig.h" #include "ui_resource_string.h" @@ -79,7 +80,7 @@ namespace OHOS std::string viewId = view.GetViewId(); if (viewId == OKBUTTON) { - playersView->ChangeView(PlayersView::MUSIC_PLAYER_TIP_VIEW, PlayersView::MAIN_MUSICPLAYER_VIEW); + playersView->ChangeView(PlayersView::MUSIC_PLAYER_TIP_VIEW, PlayersModel::GetInstance()->getPreShowView()); } return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp index 8d1c55ed9..3dfd4f59c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp @@ -47,15 +47,6 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "playersView null!"); return false; } - /* -------------------------------------------------------------------------- */ - if(PlayersModel::GetInstance()->GetMusicSource() == false) { //本地音乐 - if (PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && - PlayersModel::GetInstance()->get_a2dp_sink_playing_state()) //若ct或tg端是已连接状态且当前a2dp_sink是已播放状态 - { - return false; - } - } - /* -------------------------------------------------------------------------- */ BtnOnListData(view); /* --------------------------- 若点击的是View类型是Button --------------------------- */ if (view.GetViewType() == UIViewType::UI_BUTTON) @@ -69,6 +60,14 @@ namespace OHOS } return true; } + else if(PlayersModel::GetInstance()->GetMusicSource() == false) { //本地音乐 + if (PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && + PlayersModel::GetInstance()->get_a2dp_sink_playing_state()) //若ct或tg端是已连接状态且当前a2dp_sink是已播放状态 + { + playersView->ChangeView(PlayersView::MUSIC_LIST_VIEW, PlayersView::MUSIC_PLAYER_TIP_VIEW); + return true; + } + } /* -------------------------------------------------------------------------- */ // 标记当前播放歌曲index_ PlayersModel::GetInstance()->SetCurrentIndex(index_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp index 4d768468d..041edf4f8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp @@ -1153,6 +1153,14 @@ bool PlayersModel::GetCurrentMusicIsPlaying(void) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "id = %d name.first = %s name.second = %s", entry.first,entry.second.first.c_str(),entry.second.second.c_str()); } } + int PlayersModel::getPreShowView(void) + { + return preshowView; + } + void PlayersModel::setPreShowView(int index) + { + preshowView = index; + } } #ifdef __cplusplus diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp index 2e4617cb3..2450e8042 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp @@ -1245,7 +1245,7 @@ void PlayerOnDragListener::OnDragChangMusicPlayerTipView(const DragEvent& event) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView GetInstance fail"); return; } - playersView->ChangeView(PlayersView::MUSIC_PLAYER_TIP_VIEW, PlayersView::MAIN_MUSICPLAYER_VIEW); + playersView->ChangeView(PlayersView::MUSIC_PLAYER_TIP_VIEW, PlayersModel::GetInstance()->getPreShowView()); X_DRAG_FLAG = true; } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp index 5524adeac..1ed558794 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -1367,7 +1367,7 @@ namespace OHOS { RootView::GetInstance()->Invalidate(); } - + PlayersModel::GetInstance()->setPreShowView(hideView); DestroyTempView(hideView); }