From: luozheng <1732036298@qq.com> Date: Tue, 3 Sep 2024 03:03:03 +0000 (+0800) Subject: 解决:手表音乐,播放中,点击音量再退出和点击音乐模式按钮,播放中的音乐会被暂停,播放进度会重新开始bug #590 X-Git-Tag: release_V1.2.70_20241020_135402~529^2~23 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=79d807d3e38a6dd823b1e9240628851e0e0477bf;p=mirrors%2FFD230.git 解决:手表音乐,播放中,点击音量再退出和点击音乐模式按钮,播放中的音乐会被暂停,播放进度会重新开始bug #590 --- 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 7db9e4edb..f71306099 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -855,13 +855,16 @@ namespace OHOS soundButton->SetTouchable(touchableState); playerModelButton->SetTouchable(touchableState); // 如果音乐来源为手机音乐,播放顺序按钮就不可用 /* -------------------------------------------------------------------------- */ - /*暂停音乐*/ - uint8_t state = GetPlayerButtonState(); - int32_t playerState; /*获取Player的状态*/ - if (state == UICheckBox::UICheckBoxState::SELECTED) + if (musicSourceType) //如果切換到手机音乐,且当前在放歌,就停止音乐 { - PlayersModel::GetInstance()->PlayerStop(); - PlayersModel::GetInstance()->ClearActivateAudioInterrupt(); + /*暂停音乐*/ + uint8_t state = GetPlayerButtonState(); + int32_t playerState; /*获取Player的状态*/ + if (state == UICheckBox::UICheckBoxState::SELECTED) + { + PlayersModel::GetInstance()->PlayerStop(); + PlayersModel::GetInstance()->ClearActivateAudioInterrupt(); + } } /* -------------------------------------------------------------------------- */ PreLoadPlayerModeImageRes(); @@ -967,7 +970,7 @@ namespace OHOS MusicSourceLabelSetText(STR_MOBILE_MUSIC); // 手机音乐 PhoneMusicConnectStatusLabelColor(false); } - SetMusicPlayerButtonIsTouchable(musicSourceType); + SetMusicPlayerButtonIsTouchable(true); } else { @@ -982,7 +985,7 @@ namespace OHOS MusicListButtonIsSetVisible(true); MusicSourceLabelSetText(STR_WATCH_MUSIC); /*手表音乐*/ - SetMusicPlayerButtonIsTouchable(musicSourceType); + SetMusicPlayerButtonIsTouchable(false); } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdatePlayerView over!!"); }