From feee58ef88c44e3f078fb997043741009238e27a Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 28 Nov 2024 14:49:13 +0800 Subject: [PATCH] =?utf8?q?=E9=9F=B3=E4=B9=90=E7=95=8C=E9=9D=A2=E4=BC=98?= =?utf8?q?=E5=8C=96=EF=BC=9A=E8=8B=A5=E5=BD=93=E5=89=8D=E5=9C=A8=E6=92=AD?= =?utf8?q?=E6=94=BE=E6=89=8B=E6=9C=BA=E9=9F=B3=E4=B9=90=E8=BF=99=E6=97=B6?= =?utf8?q?=E7=82=B9=E5=87=BB=E9=9F=B3=E4=B9=90=E5=88=97=E8=A1=A8=E4=B8=AD?= =?utf8?q?=E9=9F=B3=E4=B9=90=E4=BC=9A=E6=8F=90=E7=A4=BA=E5=BC=B9=E7=AA=97?= =?utf8?q?=E8=80=8C=E4=B8=8D=E6=98=AF=E7=82=B9=E5=87=BB=E6=97=A0=E5=8F=8D?= =?utf8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/player/include/PlayersModel.h | 5 ++++- .../nativeui/player/src/MusicPlayerTipView.cpp | 5 +++-- .../player/src/PlayersCaseListAdapter.cpp | 17 ++++++++--------- .../nativeui/player/src/PlayersModel.cpp | 8 ++++++++ .../nativeui/player/src/PlayersPresenter.cpp | 2 +- .../nativeui/player/src/PlayersView.cpp | 2 +- 6 files changed, 25 insertions(+), 14 deletions(-) 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); } -- 2.17.1