From 924c14eee1646feb1098071d1eb446a9c7b39495 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Fri, 6 Dec 2024 02:17:06 +0000 Subject: [PATCH] Merge #1494 into sdk602patch0911 from refs/changes/1494/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/1494/head: (8 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的歌曲若在播放中,在删除其他音乐后,当前音乐播放状态会变成未播放状态。 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/1494 --- .../nativeui/aivoice/include/AiVoiceModel.h | 3 ++- .../nativeui/aivoice/src/AiVoiceModel.cpp | 9 ++++++++- .../player/include/PlayerListDelSongView.h | 5 +++-- .../nativeui/player/include/PlayersView.h | 3 ++- .../player/src/PlayerListDelSongView.cpp | 18 ++++++++++++++++-- .../player/src/PlayersCaseListAdapter.cpp | 3 ++- .../nativeui/player/src/PlayersModel.cpp | 10 ---------- .../nativeui/player/src/PlayersPresenter.cpp | 2 +- .../nativeui/player/src/PlayersView.cpp | 9 +++++++++ .../src/notify/findwatch_notification.cpp | 10 +++++++--- 10 files changed, 50 insertions(+), 22 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h index e3e25d49e..027fc8cf9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:14:43 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-16 18:26:13 + * @LastEditTime: 2024-12-05 15:06:19 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h */ #ifndef AI_VOICE_MODEL_H @@ -95,6 +95,7 @@ namespace OHOS void ai_start_screen60s_timer(uint32_t interval = 30*1000); void ai_stop_screen60s_timer(void); void reset_ai_screen60s_timer_time(); + bool get_screen60s_timer_is_stop(void); void start_listening_timer(uint32_t interval = 1000); void stop_listening_timer(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp index d1486a911..16eb9612a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-20 15:14:50 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-11-05 11:16:39 + * @LastEditTime: 2024-12-05 15:04:21 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp */ #include "aivoice/include/AiVoiceModel.h" @@ -795,6 +795,13 @@ namespace OHOS } } + bool AiVoiceModel::get_screen60s_timer_is_stop(void) + { + if(g_screen60s_timer == nullptr) + return true; + else + return false; + } static osTimerId_t g_listeningEndHandle = nullptr; static int8_t LISTENING_TIMEOUT = 10; // 10s钟无操作关闭该视图 static void AIListeningCallbackProc(int data) 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 e01aa52f5..9e8c3c976 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-08-12 18:24:31 + * @LastEditTime: 2024-12-05 21:03:56 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayerListDelSongView.h */ @@ -44,7 +44,7 @@ namespace OHOS virtual ~PlayerListDelSongView(); static PlayerListDelSongView *GetInstance(void); UIViewGroup *CreatePlayerListDelSongView(); - void SetTheDelSongLabelStyle(const char *songName); + void SetTheDelSongLabelStyle(const char *songName,int index); void DeleteSongNameFile(void); UIButton *GetEnsureDeleteButton(void); UIButton *GetCancelDeleteButton(void); @@ -65,6 +65,7 @@ namespace OHOS UIButton *cancelDeleteButton{nullptr}; std::string delSongName; + int deleteSongIndex{0}; UIView::OnDragListener *dragListener{nullptr}; UIView::OnClickListener *buttonClickListener{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h index 3d2eba03f..febe0e36e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.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-19 14:38:21 + * @LastEditTime: 2024-12-05 20:38:46 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h */ @@ -98,6 +98,7 @@ namespace OHOS PlayersCaseListAdapter *GetMusicListAdapter(void); UIList *GetMusicListList(void); + void RefreshMusicListList(void); UICircleProgress *GetPlaybackProgress(void); UICheckBox::UICheckBoxState GetPlayerButtonState(void); 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 26e96a37a..37508333a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayerListDelSongView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayerListDelSongView.cpp @@ -85,9 +85,10 @@ namespace OHOS /// @brief 设置歌曲名标签样式 /// @param songName 歌曲名 - void PlayerListDelSongView::SetTheDelSongLabelStyle(const char *songName) + void PlayerListDelSongView::SetTheDelSongLabelStyle(const char *songName,int index) { delSongName = songName; + deleteSongIndex = index; if (songNameLabel != nullptr) { songNameLabel->SetText(PlayersModel::GetInstance()->getHexMusicNameFromMusicName(songName).c_str()); @@ -103,7 +104,20 @@ namespace OHOS if (uapi_delete_files(path.c_str())) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Deleted file: %s successed!", 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 3dfd4f59c..9fc2d1280 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersCaseListAdapter.cpp @@ -56,7 +56,7 @@ namespace OHOS playersView->ChangeView(PlayersView::MUSIC_LIST_VIEW, PlayersView::MUSIC_DELETE_VIEW); if (playersView->GetPlayerListDelSongView()) { - playersView->GetPlayerListDelSongView()->SetTheDelSongLabelStyle(musicPlayName); + playersView->GetPlayerListDelSongView()->SetTheDelSongLabelStyle(musicPlayName, view.GetViewIndex()); } return true; } @@ -105,6 +105,7 @@ namespace OHOS } PlayersModel::GetInstance()->PlayerStat(); } + playersView->RefreshMusicListList();//刷新音乐列表 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "index = %d ,uri = %s.", PlayersModel::GetInstance()->GetCurrentIndex(), PlayersModel::GetInstance()->GetPlayerUri().c_str()); return 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 041edf4f8..1cde3a627 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp @@ -181,16 +181,6 @@ void PlayersModel::SetCurrentIndex(int16_t value) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersModel::SetCurrentIndex,value = %d",value); currentIndex = value; - /* --------------------------------- 刷新音乐列表 --------------------------------- */ - PlayersView *playersView = PlayersView::GetInstance(); - if (playersView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView null!"); - return; - } - if(playersView->GetMusicListList()!=nullptr){ - playersView->GetMusicListList()->RefreshList(); - } - /* -------------------------------------------------------------------------- */ } int16_t PlayersModel::GetPlayerModel(void) 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 2450e8042..987d0062d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersPresenter.cpp @@ -460,7 +460,7 @@ void PlayersListGroup::SetUpListCase() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "musicName = %s,index = %d",playerCaseInfo.sliceId,playerCaseInfo.index); playersCaseList_->PushBack(playerCaseInfo); } - PlayersModel::GetInstance()->showIdToMusicNameMapData(); + // PlayersModel::GetInstance()->showIdToMusicNameMapData();//关闭打印 } List& PlayersListGroup::GetCase() 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 3503e3393..8f2a9a7e4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -127,6 +127,15 @@ namespace OHOS return musicList; } + /*刷新音乐列表*/ + void PlayersView::RefreshMusicListList(void) + { + if(musicList) + { + musicList->RefreshList(); + } + } + /*获取音乐列表的适配器*/ PlayersCaseListAdapter *PlayersView::GetMusicListAdapter(void) { diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index 07dffb342..ac59001e5 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:33:47 - * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-11-27 10:53:09 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-12-05 15:18:11 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。 * 以下是基本的实现步骤: @@ -40,6 +40,7 @@ #include "vibrator_service.h" #include "../../../../../../../drivers/peripheral/utils/custom_runtime.h" #include +#include "aivoice/include/AiVoiceModel.h" namespace OHOS { @@ -498,7 +499,10 @@ namespace OHOS FindWatchViewEventListener::GetInstance().FindWatchRingPlayStop(); FindWatchViewEventListener::GetInstance().ResumeScreenBrightness(); FindWatchViewEventListener::GetInstance().FindWatch_StopTimer(); - ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); + if(OHOS::AiVoiceModel::GetInstance().get_screen60s_timer_is_stop()) //如果在AI界面查找手表且60s的常亮屏定时器不在,可以取消常亮屏 + { + ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); + } } /* ----------------------- FindWatchRingPlayerListener ---------------------- */ -- 2.17.1