From: luozheng <1732036298@qq.com> Date: Mon, 26 Aug 2024 09:43:48 +0000 (+0800) Subject: 修复a2dp连接时候音乐播放器界面刷新死机问题 X-Git-Tag: release_V1.2.70_20241020_135402~563^2~28 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=ed107396818a033b6871a7550e7e0896e3707830;p=mirrors%2FFD230.git 修复a2dp连接时候音乐播放器界面刷新死机问题 --- 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 f981c7dc8..7db9e4edb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -846,23 +846,26 @@ namespace OHOS // 1.如果为手机音乐且手机音乐已连接那么上一首,下一首,播放或暂停,声音等按钮设置为可点击. // 2.如果不为手机音乐按钮就可点击 /* -------------------------------------------------------------------------- */ - bool touchableState = !musicSourceType; - play_or_pause_Button->SetTouchable(touchableState); - preMusicButton->SetTouchable(touchableState); - nextMusicButton->SetTouchable(touchableState); - soundButton->SetTouchable(touchableState); - playerModelButton->SetTouchable(touchableState); // 如果音乐来源为手机音乐,播放顺序按钮就不可用 - /* -------------------------------------------------------------------------- */ - /*暂停音乐*/ - uint8_t state = GetPlayerButtonState(); - int32_t playerState; /*获取Player的状态*/ - if (state == UICheckBox::UICheckBoxState::SELECTED) - { - PlayersModel::GetInstance()->PlayerStop(); - PlayersModel::GetInstance()->ClearActivateAudioInterrupt(); + if (play_or_pause_Button && preMusicButton && nextMusicButton && soundButton && playerModelButton) + { + bool touchableState = !musicSourceType; + play_or_pause_Button->SetTouchable(touchableState); + preMusicButton->SetTouchable(touchableState); + nextMusicButton->SetTouchable(touchableState); + soundButton->SetTouchable(touchableState); + playerModelButton->SetTouchable(touchableState); // 如果音乐来源为手机音乐,播放顺序按钮就不可用 + /* -------------------------------------------------------------------------- */ + /*暂停音乐*/ + uint8_t state = GetPlayerButtonState(); + int32_t playerState; /*获取Player的状态*/ + if (state == UICheckBox::UICheckBoxState::SELECTED) + { + PlayersModel::GetInstance()->PlayerStop(); + PlayersModel::GetInstance()->ClearActivateAudioInterrupt(); + } + /* -------------------------------------------------------------------------- */ + PreLoadPlayerModeImageRes(); } - /* -------------------------------------------------------------------------- */ - PreLoadPlayerModeImageRes(); } void PlayersView::UpdateMusicListStatus(void) @@ -981,6 +984,7 @@ namespace OHOS MusicSourceLabelSetText(STR_WATCH_MUSIC); /*手表音乐*/ SetMusicPlayerButtonIsTouchable(musicSourceType); } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdatePlayerView over!!"); } // 初始化音乐播放器主视图