From: luozheng <1732036298@qq.com> Date: Fri, 17 Jan 2025 02:28:10 +0000 (+0800) Subject: 解决#1270,ios app上传音乐到手表后,手表端部分音乐名称显示与app端不一致bug(安卓APP需要同步修改) X-Git-Tag: v1.3.113-repair_tp~31 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F1632%2F5;p=mirrors%2FFD230.git 解决#1270,ios app上传音乐到手表后,手表端部分音乐名称显示与app端不一致bug(安卓APP需要同步修改) --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersCaseListAdapter.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersCaseListAdapter.h index f9e4f1fdb..6839edc13 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersCaseListAdapter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersCaseListAdapter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-09 16:46:56 + * @LastEditTime: 2025-01-16 18:35:24 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersCaseListAdapter.h */ @@ -32,6 +32,7 @@ namespace OHOS uint16_t GetCount() override; private: + bool GetCurrentMusicIsPlaying(void); UIView::OnClickListener *listener{nullptr}; }; } // namespace OHOS 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 000e34dd9..84e0b2c6a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp @@ -140,6 +140,16 @@ namespace OHOS return PlayersListGroup::GetInstance()->GetCase().Size(); } + bool PlayersCaseListAdapter::GetCurrentMusicIsPlaying(void) + { + int state = PlayersModel::GetInstance()->GetPlayerState(); + if (state == PlayerStates::PLAYER_STARTED || state == PlayerStates::PLAYER_PAUSED || state == PlayerStates::PLAYER_PLAYBACK_COMPLETE) { + return true; + } else { + return false; + } + } + UIView *PlayersCaseListAdapter::GetView(UIView *inView, int16_t index) { List &playersCaseList = PlayersListGroup::GetInstance()->GetCase(); @@ -157,10 +167,10 @@ namespace OHOS node = node->next_; } /* -------------------------------------------------------------------------- */ - // std::string strSongName = node->data_.sliceId; + //歌名:3033332ee585abe5baa6e7a9bae997b42de69c80e5908ee79a84e68898e5bdb9 033.八度空间-最后的战役 std::string strSongName = PlayersModel::GetInstance()->getHexMusicNameFromMusicName(node->data_.sliceId); - std::string pureName = strSongName.substr(0, strSongName.rfind(".")); - const char *songName = pureName.c_str(); // 获取纯净歌曲名 + // std::string pureName = strSongName.substr(0, strSongName.rfind(".")); + const char *songName = strSongName.c_str(); // 获取纯净歌曲名 /* -------------------------------------------------------------------------- */ PlayerListItemView *item = nullptr; PlayerListItem listitemData; @@ -173,7 +183,7 @@ namespace OHOS { item = static_cast(inView); } - if (PlayersModel::GetInstance()->getcurrentplayingmusicname() == node->data_.sliceId && PlayersModel::GetInstance()->GetCurrentMusicIsPlaying()) + if (PlayersModel::GetInstance()->getcurrentplayingmusicname() == node->data_.sliceId && GetCurrentMusicIsPlaying()) { item->UpdateItemViewStyle(true); }