From 6c0da7d2be7b866f1f9ceb0fd969747719a04d0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Fri, 6 Dec 2024 10:12:20 +0000 Subject: [PATCH] Merge #1499 into sdk602patch0911 from refs/changes/1499/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/1499/head: (12 commits squashed) - 将主界面进入applist界面Power键触发由释放事件改为按下事件,1.加快界面进入速度;2,解决手表息屏状态下(主界面)按Power键概率性会进入applist界面(需要多台手表验证) - 修复了音乐播放器从本地音乐切到手机音乐后音乐播放按钮显示不正确问题 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 解决音乐播放器界面进入音乐来源视图后在切换到音乐的调节音量视图旋转表冠不起作用问题 - 解决绑定死机问题,待验证 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 解决在AI界面查找手表后,AI界面的60s常亮屏,被取消问题 - 解决音乐播放器中音乐列表播放状态UI显示问题:如,索引0的歌曲若在播放中,在删除其他音乐后,当前音乐播放状态会变成未播放状态。 - 解决手机APP批量删除本地音乐时,当前正在播放的音乐UI状态被改变问题 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 修改SOS拨号功能键触发秒数为2s - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: Caisking <3449750381@qq.com> Reviewed-by: 罗正 <1732036298@qq.com> Reviewed-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Reviewed-by: aliyun6865282430 <1624952103@qq.com> Merged-by: Caisking <3449750381@qq.com> CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1499 --- .../player/include/PlayerListDelSongView.h | 2 +- .../nativeui/player/include/PlayersModel.h | 6 ++++- .../player/src/PlayerListDelSongView.cpp | 13 ---------- .../player/src/PlayersCaseListAdapter.cpp | 3 ++- .../nativeui/player/src/PlayersModel.cpp | 25 +++++++++++++++++++ .../src/RebootAndShutdownModel.cpp | 9 ++++--- 6 files changed, 38 insertions(+), 20 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayerListDelSongView.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayerListDelSongView.h index 9e8c3c976..beb84819f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayerListDelSongView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayerListDelSongView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:03 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-12-05 21:03:56 + * @LastEditTime: 2024-12-06 10:39:03 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayerListDelSongView.h */ 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 3ece4e202..9710ac9da 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-11-28 11:04:43 + * @LastEditTime: 2024-12-05 21:56:01 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersModel.h */ @@ -114,12 +114,15 @@ public: bool get_a2dp_sink_playing_state(void); void HandPausePhoneMusic(void); void HandPlayPhoneMusic(void); + std::string getcurrentplayingmusicname(void); + void setcurrentplayingmusicname(std::string name); // /* -------------------------------------------------------------------------- */ std::unordered_map> &getIdToMusicNameMap(void); std::string getRealMusicNameById(int id); std::string getShowMusicNameById(int id); uint16_t getIdFromMusicName(const std::string &musicName); std::string getHexMusicNameFromMusicName(const std::string &musicName); + std::string getMusicNameFromHexMusicName(const std::string &musicName); int getIdToMusicNameMapNumber(void); void showIdToMusicNameMapData(void); int getPreShowView(void); @@ -153,6 +156,7 @@ private: void RandomPlayout(void); void NextSong(int16_t index); int16_t currentIndex{0}; //当前在播哪一首歌的索引 + std::string currentplayingmusicname; //当前在播哪一首歌的名称 int16_t playerModel{0}; char *currentSongName{nullptr}; bool isStopAndReset{false}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayerListDelSongView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayerListDelSongView.cpp index 37508333a..fb4094573 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayerListDelSongView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayerListDelSongView.cpp @@ -105,19 +105,6 @@ namespace OHOS if (uapi_delete_files(path.c_str())) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Deleted file: %s successed!", path.c_str()); - int index = PlayersModel::GetInstance()->GetCurrentIndex(); - if(deleteSongIndex < index) - { - if(index - 1 < 0) - { - index = 0; - } - else - { - index--; - } - PlayersModel::GetInstance()->SetCurrentIndex(index); - } } else { 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 9fc2d1280..000e34dd9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp @@ -75,6 +75,7 @@ namespace OHOS std::string strSrcMusic(APP_MUSIC_PATH); std::string tempStr("/"); std::string strName = musicPlayName; + PlayersModel::GetInstance()->setcurrentplayingmusicname(musicPlayName); PlayersModel::GetInstance()->SetPlayerUri(strSrcMusic + tempStr + strName); // 设置播放路径Uri state = playersView->GetPlayerButtonState(); @@ -172,7 +173,7 @@ namespace OHOS { item = static_cast(inView); } - if (PlayersModel::GetInstance()->GetCurrentIndex() == index && PlayersModel::GetInstance()->GetCurrentMusicIsPlaying()) + if (PlayersModel::GetInstance()->getcurrentplayingmusicname() == node->data_.sliceId && PlayersModel::GetInstance()->GetCurrentMusicIsPlaying()) { item->UpdateItemViewStyle(true); } 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 1cde3a627..7dd2ad83f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp @@ -250,6 +250,7 @@ int PlayersModel::PlayerInit(void) char strFile[BUFFER_SIZE] = "No music files"; sliceId = strFile; } + currentplayingmusicname = sliceId;//记录当前播放的歌曲的名称 std::string strSongName = sliceId; std::string pureName = strSongName.substr(0, strSongName.rfind(".")); const char *songName = pureName.c_str(); @@ -279,6 +280,7 @@ void PlayersModel::NextSong(int16_t index) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetCase %d sliceId err!!!", index); return; } + currentplayingmusicname = sliceId;//记录当前播放的歌曲的名称 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GetCase sliceId %s.", sliceId); std::string strSrcMusic(APP_MUSIC_PATH); std::string tempStr("/"); @@ -1129,6 +1131,19 @@ bool PlayersModel::GetCurrentMusicIsPlaying(void) } return ""; } + + //根据UTF-8文件名查找对应的16进制文件名 + std::string PlayersModel::getMusicNameFromHexMusicName(const std::string &musicName) + { + for (const auto &entry : idToMusicNameMap) + { + if (entry.second.second == musicName) + { + return entry.second.first; // 返回对应音乐名 + } + } + return ""; + } //获取 idToMusicNameMap 的 zize 大小 int PlayersModel::getIdToMusicNameMapNumber(void) @@ -1151,6 +1166,16 @@ bool PlayersModel::GetCurrentMusicIsPlaying(void) { preshowView = index; } + //获取当前播放的音乐名字 + std::string PlayersModel::getcurrentplayingmusicname() + { + return currentplayingmusicname; + } + //设置当前播放的音乐名字 + void PlayersModel::setcurrentplayingmusicname(std::string name) + { + currentplayingmusicname = name; + } } #ifdef __cplusplus diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index f42b0f4c0..5f2bbcae4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-18 14:55:27 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-11-30 15:21:59 + * @LastEditTime: 2024-12-06 17:26:44 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp */ @@ -323,14 +323,15 @@ namespace OHOS static void HandFuncKeyOnLongPress(void) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress)); + // GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress)); + SOSKeyLongPress(); } - /*注册功能键的长按(8s)事件*/ + /*注册功能键的长按事件*/ bool RebootAndShutdownModel::RegisterFuncKeyLongPressEvent(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownModel::RegisterFuncKeyLongPressEvent"); - int32_t ret = uapi_button_register_event_cb(SOSKeyLongPress, BUTTON1_LONGPRESS_3S); + int32_t ret = uapi_button_register_event_cb(SOSKeyLongPress, BUTTON1_LONGPRESS_2S); if (ret != ERRCODE_SUCC) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Register PowerKey LongPress Event error, ret = %d", ret); -- 2.17.1