From: luozheng <1732036298@qq.com> Date: Sat, 24 May 2025 09:34:57 +0000 (+0800) Subject: 解决音乐界面死机问题 X-Git-Tag: leiniao_debug_1.0.0_20250922_020716~280 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=11ac29c7cf66dbc87a24ad23c23fb7c87d4df309;p=mirrors%2FFD230.git 解决音乐界面死机问题 --- diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativelauncher/src/NativeLauncher.cpp index 128d6dd80..0959763a4 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -36,6 +36,9 @@ //头文件加下面 #include "languagecode/include/LanguageSwitchModel.h" #include "graphic_config.h" +#include +#include "rebootandshutdown/include/RebootAndShutdownModel.h" +#include namespace OHOS { @@ -89,6 +92,14 @@ void NativeLauncher::InitNativeLauncher(LaunchMode mode) } // 初始化所有预加载slice InitAllNativeSlices(); + + PlayersModel::GetInstance()->AudioInit();//音乐初始化 + RebootAndShutdownModel::GetInstance().RegisterAllKeyEvents();// 注册按键事件 + //音乐列表初始化,放在nativelauncher 初始化,防止手表连接耳机时,操控耳机控制手表音乐造成死机 + do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_MUSICNAME_READ, nullptr, 0); + cm_initScreenBrightness();// 初始化屏幕亮度 + cm_initializeScreenDuration();// 初始化屏幕时长 + #ifdef FD230_650 CallerLogModel::GetInstance()->InitPhoneService(); GoalModel::GetInstance().GoalModelInitdata();//活动数据初始化 diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/VolumeSettingPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/VolumeSettingPresenter.h index d3e1bfdc1..ed77277ed 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/VolumeSettingPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/VolumeSettingPresenter.h @@ -1,9 +1,3 @@ -/* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: VolumeSettingView view - * Create: 2021-09-5 - */ - #ifndef VOLUME_SETTING_PRESENTER_H #define VOLUME_SETTING_PRESENTER_H @@ -12,7 +6,7 @@ #include "components/ui_view_group.h" #include "components/ui_slider.h" #include "VolumeSettingView.h" -// #include "player/include/PlayersView.h" +#include "player/include/PlayersView.h" namespace OHOS { #define INCREASE_BUTTON "increaseButton" @@ -21,8 +15,8 @@ namespace OHOS { #define VOLUME_VIEW "volumeview" typedef enum : uint16_t { - VOLUMEPHONE = 1, - VOLUMEPLAYERS = 3, + VOLUMEPHONE = 1, //声音系数为:手机 + VOLUMEPLAYERS = 3,//声音系数为音乐播放器 VOLUMEPHONENOTIFY = 4, } VolumeFactor; @@ -35,6 +29,7 @@ typedef enum : uint8_t { class VolumeSettingView; class VolumeSliderEventListener : public UISlider::UISliderEventListener, public UIView::OnClickListener, + public UIView::OnRotateListener, public UIView::OnDragListener { public: VolumeSliderEventListener(VolumeSettingView *volumeSetting); @@ -45,6 +40,7 @@ public: void ChangeVolume(VolumeChangeStatus status); bool OnClick(UIView& view, const ClickEvent& event) override; bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnRotateEnd(UIView& view, const RotateEvent& event); void SetPlayerCoefficients(int16_t value); void BtAndLocalVolumeSet(int16_t sounding); private: diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/VolumeSettingView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/VolumeSettingView.h index ade8d2254..aef19f4fd 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/VolumeSettingView.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/include/VolumeSettingView.h @@ -1,9 +1,3 @@ -/* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: VolemeSettingView view - * Create: 2021-09-5 - */ - #ifndef VOLUME_SETTING_VIEW_H #define VOLUME_SETTING_VIEW_H @@ -11,7 +5,7 @@ #include "components/ui_button.h" #include "components/ui_view_group.h" #include "components/ui_slider.h" - +#include "player/include/PlayersView.h" #include "wearable_log.h" #include "VolumeSettingPresenter.h" @@ -23,7 +17,7 @@ class VolumeSettingView : public UIViewGroup { public: VolumeSettingView(); ~VolumeSettingView(); - int16_t sounding{0}; + int16_t sounding{0}; //音量值 UISlider *GetProgress(void); bool SetUpVolume(void); @@ -35,6 +29,7 @@ private: UISlider *progress{nullptr}; UIButton *increaseButton{nullptr}; UIButton *decreaseButton{nullptr}; + UIImageView *VolumeVetor{nullptr}; int ShowVolume(); }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/VolumeSettingPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/VolumeSettingPresenter.cpp index d7ed2f75b..ccb5860dd 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/VolumeSettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/VolumeSettingPresenter.cpp @@ -18,7 +18,9 @@ #include "notification_manager.h" #include "BluetoothHeadsetEvent.h" #include "bts_avrcp_controller.h" -#include "PlayersView.h" +#include "ConfigModel.h" +#include "vibrator_service.h" +#include namespace OHOS { @@ -119,24 +121,53 @@ void VolumeSliderEventListener::ChangeVolume(VolumeChangeStatus status) } if (playerCoefficients == VOLUMEPLAYERS) { - BtAndLocalVolumeSet(volumeSettingView->sounding); + BtAndLocalVolumeSet(volumeSettingView->sounding); /*蓝牙耳机音乐调节*/ } if (playerCoefficients == VOLUMEPHONE || playerCoefficients == VOLUMEPHONENOTIFY) { - unsigned char volumeValue = (unsigned char) ((double) (volumeSettingView->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换 - SetSpeakerVolume(volumeValue); + // unsigned char volumeValue = (unsigned char) ((double) (volumeSettingView->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换 + SetSpeakerVolume((unsigned char)volumeSettingView->sounding); } } +//蓝牙耳机音量映射 (40 - 127) +static int mapVolume(int volume) +{ + // 音量映射 + if(volume <= 0) + return AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_0; + else if (volume >= 100) + return AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100; + else if (volume > 0 && volume <= 10) + return (10 * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100) / 100; + else if (volume > 10 && volume <= 20) + return (20 * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100) / 100; + else if (volume > 20 && volume <= 30) + return (30 * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100) / 100; + else if (volume > 30 && volume <= 40) + return (40 * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100) / 100; + else + return volume * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100 / 100; +} + extern BtAvrcpTgInf g_avrcp_srv_inf; void VolumeSliderEventListener::BtAndLocalVolumeSet(int16_t sounding) { if (g_avrcp_srv_inf.avrcp_srv_conn_stat == PROFILE_STATE_CONNECTED) { - uint8_t volume = sounding * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100 / 100; // 100:本地音量最大值 - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "avrcp volume = %d", volume); + // uint8_t volume = sounding * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100 / 100; // 100:本地音量最大值 + uint8_t volume = mapVolume(sounding); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "手表音量设置同步远端BT音量 %d", volume); (void)avrcp_ct_set_absolute_volume(&(g_avrcp_srv_inf.bd_addr), volume); // 手表音量设置同步远端BT音量 } + /* -------------------------- 若ct或tg端是已连接状态且当前为手机音乐 ------------------------- */ + if (PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && PlayersModel::GetInstance()->GetMusicSource()) + { + uint8_t volume = sounding * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100 / 100; // 100:本地音量最大值 + BtAvrcpVolumeChangedSyncMedia(volume);// 手表音量设置同步手机音量 + } + /* -------------------------------------------------------------------------- */ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "audio volume = %d", sounding); - AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, sounding); // 本地音量设置 + // AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, sounding); // 本地音量设置 + uapi_systemVolumeSet(sounding);//本地音量设置 } void VolumeSliderEventListener::OnRelease(int32_t value) @@ -153,7 +184,23 @@ void VolumeSliderEventListener::SetPlayerCoefficients(int16_t value) void VolumeSliderEventListener::OnChange(int32_t value) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnChange %d", value); - ChangeVolume(VOLUMEDRAG); + // ChangeVolume(VOLUMEDRAG); +} + +bool VolumeSliderEventListener::OnRotateEnd(UIView& view, const RotateEvent& event) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeSliderEventListener::OnRotateEnd"); + UISlider *slider = dynamic_cast(&view); + UISlider *progress = volumeSettingView->GetProgress(); + if (slider != nullptr && progress != nullptr) + { + if (slider == progress) + { + ChangeVolume(VOLUMEDRAG); + ui_api_vibrate_once_func();//受设置中震动强度控制 + } + } + return true; } bool VolumeSliderEventListener::OnDrag(UIView& view, const DragEvent& event) @@ -167,8 +214,7 @@ bool VolumeSliderEventListener::OnDrag(UIView& view, const DragEvent& event) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnDrag:playersView new fail"); return false; } - volumeSettingView->SetVisible(false); - playersView->SetVisible(true); + playersView->ChangeView(PlayersView::MUSIC_VOLUME_CONTROL_VIEW,PlayersView::MAIN_MUSICPLAYER_VIEW); } if (playerCoefficients == VOLUMEPHONE) { MainCallingView *mainCallView = MainCallingView::GetInstance(); @@ -186,7 +232,7 @@ bool VolumeSliderEventListener::OnDrag(UIView& view, const DragEvent& event) volumeSettingView->SetVisible(false); NotificationManager::GetInstance()->SetVolumeScreenStatus(false); } - RootView::GetInstance()->Invalidate(); + RootView::GetInstance()->Invalidate(); } } return true; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/VolumeSettingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/VolumeSettingView.cpp index e8eeb4df7..1f8a31252 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/VolumeSettingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/VolumeSettingView.cpp @@ -15,10 +15,10 @@ static constexpr uint16_t BUTTON_Y = 0; static constexpr uint16_t BUTTON_Y2 = 363; static constexpr uint16_t BUTTON_WIDTH = 90; static constexpr uint16_t BUTTON_HEIGHT = 90; -static constexpr uint16_t SLIDER_X = 207; -static constexpr uint16_t SLIDER_Y = 90; -static constexpr uint16_t SLIDER_WIDTH = 40; -static constexpr uint16_t SLIDER_HEIGHT = 274; +static constexpr uint16_t SLIDER_X = 167; +static constexpr uint16_t SLIDER_Y = 77; +static constexpr uint16_t SLIDER_WIDTH = 130; +static constexpr uint16_t SLIDER_HEIGHT = 310; constexpr uint16_t VOLUME_OK = 0; constexpr int16_t VOLUME_ERROR = (-1); @@ -32,18 +32,28 @@ VolumeSettingView::~VolumeSettingView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeSettingView::~VolumeSettingView"); RemoveAll(); + FocusManager::GetInstance()->ClearFocus(); if (listener != nullptr) { delete listener; listener = nullptr; } - delete increaseButton; - increaseButton = nullptr; - - delete decreaseButton; - decreaseButton = nullptr; - - delete progress; - progress = nullptr; + if(increaseButton) { + delete increaseButton; + increaseButton = nullptr; + } + if(decreaseButton) { + delete decreaseButton; + decreaseButton = nullptr; + } + if(VolumeVetor!=nullptr) + { + delete VolumeVetor; + VolumeVetor = nullptr; + } + if(progress!=nullptr){ + delete progress; + progress = nullptr; + } } bool VolumeSettingView::SetUpVolume(void) @@ -65,6 +75,24 @@ bool VolumeSettingView::SetUpVolume(void) progress->SetDirection(UISlider::Direction::DIR_BOTTOM_TO_TOP); progress->SetViewId(VOLUME_PROGRESS); progress->SetRange(VOLUME_MAX, VOLUME_MIN); + progress->SetStyle(STYLE_BORDER_RADIUS, 100); + progress->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + progress->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + progress->SetSliderColor(Color::GetColorFromRGBA(0x19, 0x19, 0x19, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); + progress->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff); + FocusManager::GetInstance()->RequestFocus(progress); + FocusManager::GetInstance()->RequestFocusByDirection(FOCUS_DIRECTION_DOWN); + progress->SetRotateFactor(1.0); + + VolumeVetor = new UIImageView(); + if (VolumeVetor == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VolumeVetor new fail"); + return false; + } + VolumeVetor->SetPosition(213, 213, 40, 40); + VolumeVetor->SetSrc("/user/res/VolumeControlVector.bin"); + if (listener == nullptr) { listener = new VolumeSliderEventListener(this); @@ -76,12 +104,14 @@ bool VolumeSettingView::SetUpVolume(void) progress->SetSliderEventListener(listener); progress->SetOnClickListener(listener); progress->SetOnDragListener(listener); + progress->SetOnRotateListener(listener); progress->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); SetViewId(VOLUME_VIEW); SetOnDragListener(listener); SetDraggable(true); SetTouchable(true); Add(progress); + Add(VolumeVetor); ShowVolume(); return true; @@ -118,6 +148,7 @@ int VolumeSettingView::ShowVolume(void) increaseButton->SetImageSrc(image, image); increaseButton->SetOnClickListener(listener); Add(increaseButton); + increaseButton->SetVisible(false); if (decreaseButton == nullptr) { decreaseButton = new UIButton(); @@ -131,6 +162,7 @@ int VolumeSettingView::ShowVolume(void) image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_DECREASE_BUTTON, PLAYER_IAMGES); decreaseButton->SetImageSrc(image, image); decreaseButton->SetOnClickListener(listener); + decreaseButton->SetVisible(false); Add(decreaseButton); return VOLUME_OK; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/player/src/PlayersView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/player/src/PlayersView.cpp index 67d1609b7..18e6446e6 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/player/src/PlayersView.cpp @@ -130,7 +130,7 @@ namespace OHOS /*刷新音乐列表*/ void PlayersView::RefreshMusicListList(void) { - if(musicList) + if (musicList) { musicList->RefreshList(); } @@ -161,7 +161,7 @@ namespace OHOS /*获取音乐播放和暂停复选按钮的状态*/ UICheckBox::UICheckBoxState PlayersView::GetPlayerButtonState(void) { - if(play_or_pause_Button == nullptr) + if (play_or_pause_Button == nullptr) { return UICheckBox::UICheckBoxState::UNSELECTED; } @@ -180,7 +180,7 @@ namespace OHOS void PlayersView::SetPlayerCtrVolume(float leftVolume, float rightVolume) { - if (PlayersModel::GetInstance()->GetPlayerCtr().get() != nullptr) + if (PlayersModel::GetInstance()->GetPlayerCtr().get() != nullptr) { PlayersModel::GetInstance()->GetPlayerCtr()->SetVolume(leftVolume, rightVolume); } @@ -234,7 +234,7 @@ namespace OHOS /*创建音乐列表视图*/ UIViewGroup *PlayersView::CreateMusicListGroupView(void) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MusicPlayerSourceView::CreateMusicPlayerSourceView"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MusicPlayerSourceView::CreateMusicPlayerSourceView"); if (musicListGroupView == nullptr) { musicListGroupView = new UIViewGroup(); @@ -361,6 +361,7 @@ namespace OHOS musicListScrollView->Add(musicListIsEmptyLabel); musicListScrollView->Add(musicList); musicListGroupView->Add(musicListScrollView); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MusicPlayerSourceView::CreateMusicPlayerSourceView end"); return musicListGroupView; } @@ -665,8 +666,8 @@ namespace OHOS } play_or_pause_Button->SetPosition(195, 195, 80, 80); uint8_t state = UICheckBox::UICheckBoxState::MAX_STATUS_NUM; - bool isplayingflag = PlayersModel::GetInstance()->GetCurrentMusicIsPlaying();//获取当前音乐是否是在播放中 - play_or_pause_Button->SetState(isplayingflag?UICheckBox::UICheckBoxState::SELECTED:UICheckBox::UICheckBoxState::UNSELECTED); + bool isplayingflag = PlayersModel::GetInstance()->GetCurrentMusicIsPlaying(); // 获取当前音乐是否是在播放中 + play_or_pause_Button->SetState(isplayingflag ? UICheckBox::UICheckBoxState::SELECTED : UICheckBox::UICheckBoxState::UNSELECTED); play_or_pause_Button->SetOnClickListener(clickListener); return true; } @@ -862,14 +863,14 @@ namespace OHOS { int32_t playerState; PlayersModel::GetInstance()->GetPlayerCtr()->GetPlayerState(playerState); - if (playerState == PLAYER_STARTED || playerState == PLAYER_PAUSED) //如果当前是已经播放或播放暂停状态 + if (playerState == PLAYER_STARTED || playerState == PLAYER_PAUSED) // 如果当前是已经播放或播放暂停状态 { PlayersModel::GetInstance()->PlayerStop(); PlayersModel::GetInstance()->ClearActivateAudioInterrupt(); } } - //更新音乐播放器的声音进度条 + // 更新音乐播放器的声音进度条 void PlayersView::UpdateVolumeValue(void) { if (volumeSettingView != nullptr && volumeSettingView->GetProgress() != nullptr) @@ -879,7 +880,7 @@ namespace OHOS } } - //初始化音乐播放器的进度条 + // 初始化音乐播放器的进度条 void PlayersView::initPlayProgress(void) { PlayersModel::GetInstance()->updatePlayProgress(); @@ -899,8 +900,8 @@ namespace OHOS { // bool value = PlayersModel::GetInstance()->get_player_state(); bool value = false; - if (PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && - PlayersModel::GetInstance()->get_a2dp_sink_playing_state()) //若ct或tg端是已连接状态且当前a2dp_sink是已播放状态 + if (PlayersModel::GetInstance()->get_avrcp_ct_or_tg_is_connected() && + PlayersModel::GetInstance()->get_a2dp_sink_playing_state()) // 若ct或tg端是已连接状态且当前a2dp_sink是已播放状态 { value = true; } @@ -908,7 +909,7 @@ namespace OHOS { value = false; } - SetPlayerButtonState(value ? UICheckBox::UICheckBoxState::SELECTED:UICheckBox::UICheckBoxState::UNSELECTED); + SetPlayerButtonState(value ? UICheckBox::UICheckBoxState::SELECTED : UICheckBox::UICheckBoxState::UNSELECTED); /*停止音乐*/ StopCurPlayingMusic(); } @@ -986,14 +987,14 @@ namespace OHOS void PlayersView::UpdatePlayerView(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdatePlayerView"); - #ifdef SUPPORT_BLE_SERVICE - bool phoneMusicConnectStatus = uapi_a2dp_snk_get_device_connect_state();// 获取a2dp连接状态 - #else +#ifdef SUPPORT_BLE_SERVICE + bool phoneMusicConnectStatus = uapi_a2dp_snk_get_device_connect_state(); // 获取a2dp连接状态 +#else bool phoneMusicConnectStatus = false; // 模拟手机音乐连接状态 - #endif +#endif bool musicSourceType = PlayersModel::GetInstance()->GetMusicSource(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "phoneMusicConnectStatus %d,musicSourceType %d",phoneMusicConnectStatus,musicSourceType); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "phoneMusicConnectStatus %d,musicSourceType %d", phoneMusicConnectStatus, musicSourceType); ImageInfo *image; if (musicSourceType) { @@ -1064,8 +1065,8 @@ namespace OHOS initPlayProgress(); /* -------------------------------------------------------------------------- */ - // PlayersListGroup::GetInstance()->SetUpListCase(); - // PlayersModel::GetInstance()->PlayerInit(); + PlayersListGroup::GetInstance()->SetUpListCase(); + PlayersModel::GetInstance()->PlayerInit(); // do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_MUSICNAME_READ, nullptr, 0); SetTouchable(true); SetDraggable(true); @@ -1399,7 +1400,7 @@ namespace OHOS if (RootView::GetInstance() != nullptr) { - RootView::GetInstance()->Invalidate(); + RootView::GetInstance()->Invalidate(); } PlayersModel::GetInstance()->setPreShowView(hideView); DestroyTempView(hideView); @@ -1432,9 +1433,9 @@ namespace OHOS group[thisView] = musicPlayerSourceView->CreateMusicPlayerSourceView(); Add(group[thisView]); } - if (musicPlayerSourceView != nullptr ) + if (musicPlayerSourceView != nullptr) { - if(musicPlayerSourceView->GetMusicPlayerSourcescrollView() != nullptr) + if (musicPlayerSourceView->GetMusicPlayerSourcescrollView() != nullptr) { musicPlayerSourceView->GetMusicPlayerSourcescrollView()->RequestFocus(); } @@ -1462,9 +1463,9 @@ namespace OHOS group[thisView] = volumeSettingView; Add(group[thisView]); } - if(volumeSettingView) + if (volumeSettingView) { - if(volumeSettingView->GetProgress()) + if (volumeSettingView->GetProgress()) { volumeSettingView->GetProgress()->RequestFocus(); }