From febdf7cd9ef0dac0d2c33fe0655a59834133debb Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Wed, 18 Sep 2024 13:05:46 +0000 Subject: [PATCH] Merge #985 into sdk602patch0626 from refs/changes/985/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/985/head: (16 commits squashed) - #524,解决:录音删除,删除后不是返回到录音列表界面,返回的是录音界面bug #658,解决,手表,录音频繁点击会有蓝色效果 - #656,解决,手表,闹钟偶现0000闹钟提醒bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 4G界面添加“注:启用4G,可能会加速消耗电量”提醒 - 运动识别界面添加提醒标签,#192,解决,运动识别界面单一bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 根据禅道上期望:APP查找手表和闹钟,勿扰睡眠静音模式下都有响铃和震动提醒 #421解决, 睡眠模式,闹钟无响铃震动bug - 解决静音模式错误开启后会全局静音bug,根据禅道期望“来电铃声、短信消息提醒,勿扰睡眠静音模式下只有亮屏提醒” - #717,解决,设置界面向上滑有黑色空白,需优化bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - #716,解决,设置屏幕与亮度界面右滑返回上一级界面,有上下晃动,优化退出晃动bug - #720,解决,手表默认通话音量过小,手表是恢复出厂设置后查看的bug - 修复msg_senter关于喝水提醒被覆盖代码 - 1.添加APP在调节系统音量时候若当前界面在音乐的的声音调节视图则ui同步显示设置的音量值。 2.解决音乐从本地音乐切换到手机音乐在切换到本地音乐切换不回来bug - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/985 --- .../src/DisplayBrightnessView.cpp | 14 ++-- .../phoneservice/src/PhoneService.cpp | 49 +++++++----- .../nativeui/player/include/PlayersView.h | 4 +- .../player/src/MusicPlayerSourceView.cpp | 1 + .../nativeui/player/src/PlayersModel.cpp | 6 +- .../nativeui/player/src/PlayersView.cpp | 34 +++++--- .../nativeui/settings/include/SettingModel.h | 8 +- .../settings/include/SettingPresenter.h | 8 +- .../nativeui/settings/include/SettingView.h | 4 +- .../nativeui/settings/src/SettingAdapter.cpp | 6 +- .../nativeui/settings/src/SettingItemView.cpp | 4 +- .../nativeui/settings/src/SettingModel.cpp | 22 ++++- .../settings/src/SettingPresenter.cpp | 27 ++++++- .../nativeui/settings/src/SettingView.cpp | 80 +++++++++++++++---- .../src/SoundAndVibrationModel.cpp | 15 ++-- .../msg_center/src/msg_center_customer.cpp | 4 +- 16 files changed, 211 insertions(+), 75 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp index 437da1383..3323422a5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp @@ -75,6 +75,10 @@ namespace OHOS delete p_ScreenDurationView; p_ScreenDurationView = nullptr; } + for (int i = DISPLAYBRIGHTNESSVIEW; i < MAX_DISPLAYBRIGHTNESSVIEWID; i++) + { + DisplayBrightnessScrollView[i] = nullptr; + } } // 显示与亮度视图scrollView初始化 @@ -89,12 +93,12 @@ namespace OHOS DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetViewId(DISPLAY_BRIGHTNESS_VIEW); DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetScrollBlankSize(75); - DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetReboundSize(35); + // DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetReboundSize(35); DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetDirection(1); - DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetMaxScrollDistance(1000); - DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetThrowDrag(true); + // DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetMaxScrollDistance(1000); + // DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetThrowDrag(true); DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->RequestFocus(); - DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetRotateFactor(2); + DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->SetRotateFactor(1.0); UIView::OnDragListener *draglistener = static_cast(DisplayBrightnessPresenter::GetInstance()); if (draglistener == nullptr) { @@ -402,7 +406,7 @@ namespace OHOS DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessLabel); DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessCheckBoxButton); - if(uapi_sleep_mode_flag_get()) + if (uapi_sleep_mode_flag_get()) { RaiseToBrightnessCheckBoxButton->SetTouchable(false); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp index 54ce0a475..87fbc47d1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -1884,31 +1884,34 @@ unsigned char GetCallCurrVolume(void) { if(OHOS::CallerLogModel::GetInstance()->GetCallSource() == OHOS::CallerLogModel::CallSourceCat1) { - int32_t volume = PhoneCAT1AudioGetVolume(); - int32_t minVolume = PhoneAudioGetCAT1MinVolume(); - int32_t maxVolume = PhoneAudioGetCAT1MAXVolume(); - unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换 + // int32_t volume = PhoneCAT1AudioGetVolume(); + // int32_t minVolume = PhoneAudioGetCAT1MinVolume(); + // int32_t maxVolume = PhoneAudioGetCAT1MAXVolume(); + // // unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换 - if (volume != 0 && hfpVolume == 0) { - hfpVolume = 1; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d", - volume, minVolume, maxVolume, hfpVolume); - return hfpVolume; + + // if (volume != 0 && hfpVolume == 0) { + // hfpVolume = 1; + // } + // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d", + // volume, minVolume, maxVolume, hfpVolume); + // return hfpVolume; + return PhoneCAT1AudioGetVolume(); } else { - int32_t volume = PhoneAudioGetVolume(); - int32_t minVolume = PhoneAudioGetMinVolume(); - int32_t maxVolume = PhoneAudioGetMaxVolume(); - unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换 + // int32_t volume = PhoneAudioGetVolume(); + // int32_t minVolume = PhoneAudioGetMinVolume(); + // int32_t maxVolume = PhoneAudioGetMaxVolume(); + // // unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换 - if (volume != 0 && hfpVolume == 0) { - hfpVolume = 1; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d", - volume, minVolume, maxVolume, hfpVolume); - return hfpVolume; + // // if (volume != 0 && hfpVolume == 0) { + // // hfpVolume = 1; + // // } + // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d", + // volume, minVolume, maxVolume, hfpVolume); + // return hfpVolume; + return PhoneAudioGetVolume(); } @@ -1967,7 +1970,8 @@ void set_speaker_volume(unsigned char hfpVolume,int type) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] start, CallSourceCat1:%d", hfpVolume); int32_t minVolume = PhoneAudioGetCAT1MinVolume(); int32_t maxVolume = PhoneAudioGetCAT1MAXVolume(); - int32_t volume = hfpVolume * (maxVolume - minVolume)/ CALL_VOLUME_MAX;// 转换 + // int32_t volume = hfpVolume * (maxVolume - minVolume)/ CALL_VOLUME_MAX;// 转换 + int32_t volume = hfpVolume; WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] minVolume:%d, maxVolume:%d, volume:%d", minVolume, maxVolume, volume); @@ -1983,7 +1987,8 @@ void set_speaker_volume(unsigned char hfpVolume,int type) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] start, hfpVolume:%d", hfpVolume); int32_t minVolume = PhoneAudioGetMinVolume(); int32_t maxVolume = PhoneAudioGetMaxVolume(); - int32_t volume = hfpVolume * (maxVolume - minVolume) / CALL_VOLUME_MAX; // 转换 + // int32_t volume = hfpVolume * (maxVolume - minVolume) / CALL_VOLUME_MAX; // 转换 + int32_t volume = hfpVolume; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] minVolume:%d, maxVolume:%d, volume:%d", minVolume, maxVolume, volume); 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 5e1304da1..16ea701ba 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-08-20 17:39:13 + * @LastEditTime: 2024-09-18 19:13:53 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/player/include/PlayersView.h */ @@ -102,6 +102,8 @@ namespace OHOS void UpdatePlayerView(void); void UpdateMusicListStatus(void); void OnClickBackKeyToMainMusicPlayerView(void); + void StopCurPlayingMusic(); + void UpdateVolumeValue(void); VolumeSettingView *GetVolumeSettingView(); PlayerListDelSongView *GetPlayerListDelSongView(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp index 97472c9c1..90fb34697 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/MusicPlayerSourceView.cpp @@ -65,6 +65,7 @@ namespace OHOS { PlayersModel::GetInstance()->SetMusicSource(true); UpdateBluetoothHeadSetViewIsVisible(); + playersView->StopCurPlayingMusic(); // 1.a2dp未连接,向手机发起a2dp连接 // 如果蓝牙没连接直接是跳转到蓝牙连接失败视图,连接了就有一个主动去连手机的a2dp过程,5秒超市 // if (!phonebluetoothcon) 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 9a99086f0..0cb06b536 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp @@ -843,11 +843,7 @@ bool PlayersModel::GetCurrentMusicIsPlaying(void) else { if(g_PlayerTimes < 2) /*3秒切换时间*/ { - bool a2dp = uapi_a2dp_snk_get_device_connect_state();// 获取a2dp连接状态 - if(!a2dp) - { - playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MUSIC_SOURCE_VIEW); - } + playersView->ChangeView(PlayersView::MUISC_CONNECTING, PlayersView::MUSIC_SOURCE_VIEW); } } return; 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 96a33f9ed..d6cea874d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersView.cpp @@ -14,6 +14,7 @@ #include "main/include/MainViewSample.h" #include "wearable_log.h" #include "settings/include/SettingModel.h" +#include namespace OHOS { static PlayersView *g_pPlayersView = nullptr; @@ -838,6 +839,27 @@ namespace OHOS } } + // 停止当前正在播放的音乐 + void PlayersView::StopCurPlayingMusic() + { + uint8_t state = GetPlayerButtonState(); + if (state == UICheckBox::UICheckBoxState::SELECTED) + { + PlayersModel::GetInstance()->PlayerStop(); + PlayersModel::GetInstance()->ClearActivateAudioInterrupt(); + } + } + + //更新音乐播放器的声音进度条 + void PlayersView::UpdateVolumeValue(void) + { + if (volumeSettingView != nullptr && volumeSettingView->GetProgress() != nullptr) + { + int val = uapi_systemVolumeGet(); + volumeSettingView->GetProgress()->SetValue(val); + } + } + /// @brief 设置音乐播放按钮是否可点击 /// @param musicSourceType 音乐来源类型 false:手表音乐 true 手机音乐 /// @param phoneMusicConnectStatus 手机音乐连接状态 @@ -852,19 +874,13 @@ namespace OHOS play_or_pause_Button->SetTouchable(touchableState); preMusicButton->SetTouchable(touchableState); nextMusicButton->SetTouchable(touchableState); - soundButton->SetTouchable(touchableState); + // soundButton->SetTouchable(touchableState); playerModelButton->SetTouchable(touchableState); // 如果音乐来源为手机音乐,播放顺序按钮就不可用 /* -------------------------------------------------------------------------- */ if (musicSourceType) // 如果切換到手机音乐,且当前在放歌,就停止音乐 { - /*暂停音乐*/ - uint8_t state = GetPlayerButtonState(); - int32_t playerState; /*获取Player的状态*/ - if (state == UICheckBox::UICheckBoxState::SELECTED) - { - PlayersModel::GetInstance()->PlayerStop(); - PlayersModel::GetInstance()->ClearActivateAudioInterrupt(); - } + /*停止音乐*/ + StopCurPlayingMusic(); } /* -------------------------------------------------------------------------- */ PreLoadPlayerModeImageRes(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingModel.h b/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingModel.h index fde1d10d9..c8a4cd819 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingModel.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-24 17:50:33 + * @LastEditTime: 2024-09-14 19:57:56 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingModel.h */ @@ -27,6 +27,10 @@ namespace OHOS void InitSettingItem(); const SettingItem *GetSettinglistItems() const; uint8_t GetSettingListNum() const; + void SetStartIndex(uint16_t index); + uint16_t GetStartIndex(void); + void SetHeadItemY(int y); + int GetHeadItemY(void); bool GetPhoneConnectStatus(void); bool GetEarPhoneConnectStatus(void); bool GetBlueToothConnectStatus(void); @@ -41,6 +45,8 @@ namespace OHOS virtual ~SettingModel(); SettingItem settings[SETTING_ITEM_COUNT] = {VIEW_INVALID, nullptr, STR_EXERCISE_GENERAL, false}; int usedLen; + uint16_t startIndex{0}; + int headItemY{0}; bool phoneConnectStatus{false}; bool earphoneConnectStatus{false}; bool btConnectStatus{false}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingPresenter.h index fe5692830..c29e368f0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingPresenter.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-19 11:58:05 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-22 11:05:00 + * @LastEditTime: 2024-09-14 20:14:00 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingPresenter.h */ #ifndef SETTING_PRESENTER_H @@ -24,7 +24,11 @@ namespace OHOS SettingPresenter(); ~SettingPresenter() override; static SettingPresenter *GetInstance(); - + void SetStartIndex(uint16_t index); + uint16_t GetStartIndex(void); + void SetHeadItemY(int y); + int GetHeadItemY(void); + int GetListItemNum(); void OnStart() override; void OnResume() override; diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingView.h b/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingView.h index 02d1af315..9f442dce4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-30 09:14:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-22 11:13:50 + * @LastEditTime: 2024-09-14 20:06:44 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/include/SettingView.h */ #ifndef SETTING_VIEW_H @@ -36,6 +36,8 @@ namespace OHOS private: void CreateSettingView(void); void ClearAll(void); + void settingListOnSetUpView(void); + void settingListOnStop(void); SettingAdapter *listAdapter{nullptr}; UIScrollView *scrollView{nullptr}; UIList *contentList{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingAdapter.cpp index 5ee43375d..5f4ba086d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingAdapter.cpp @@ -2,10 +2,11 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-01-29 15:37:44 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-05-07 20:11:17 + * @LastEditTime: 2024-09-14 21:19:30 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingAdapter.cpp */ -#include "SettingAdapter.h" +// #include "SettingAdapter.h" +#include "settings/include/SettingAdapter.h" namespace OHOS { SettingAdapter::SettingAdapter() {} @@ -77,6 +78,7 @@ namespace OHOS { item->GetNeedToUpdateImage()->SetVisible(false); } + item->SetViewIndex(index); return item; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp index 47064868c..06680a958 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-27 19:48:49 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-11 16:46:26 + * @LastEditTime: 2024-09-18 10:12:06 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingItemView.cpp */ @@ -19,7 +19,7 @@ namespace OHOS static constexpr int16_t SETTINGLABELEXT_X = 115; static constexpr int16_t SETTINGLABELEXT_Y = 33; static constexpr int16_t SETTINGLABELEXT_W = 180; - static constexpr int16_t SETTINGLABELEXT_H = 40; + static constexpr int16_t SETTINGLABELEXT_H = 35; static constexpr int16_t SETTINGLABELEXT_TEXT_FONT = 30; static constexpr int16_t SETTINGLABELEXT_LINE_HEIGHT = 35; static constexpr int16_t SETTINGLABELEXT_ROLLSPEED = 70; diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp index d9b0e049b..1bfbc3622 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-18 09:09:13 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-09-11 16:52:29 + * @LastEditTime: 2024-09-14 19:58:19 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp */ #include "settings/include/SettingModel.h" @@ -45,6 +45,26 @@ namespace OHOS usedLen = index; } + void SettingModel::SetStartIndex(uint16_t index) + { + startIndex = index; + } + + uint16_t SettingModel::GetStartIndex(void) + { + return startIndex; + } + + void SettingModel::SetHeadItemY(int y) + { + headItemY = y; + } + + int SettingModel::GetHeadItemY(void) + { + return headItemY; + } + const SettingItem *SettingModel::GetSettinglistItems() const { return settings; diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp index dffffffb2..0986f9181 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-12 11:44:04 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-29 17:49:05 + * @LastEditTime: 2024-09-18 09:39:55 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingPresenter.cpp */ /* @@ -45,6 +45,31 @@ namespace OHOS return g_pSettingPresenter; } + void SettingPresenter::SetStartIndex(uint16_t index) + { + settingModel->SetStartIndex(index); + } + + uint16_t SettingPresenter::GetStartIndex(void) + { + return settingModel->GetStartIndex(); + } + + void SettingPresenter::SetHeadItemY(int y) + { + settingModel->SetHeadItemY(y); + } + + int SettingPresenter::GetHeadItemY(void) + { + return settingModel->GetHeadItemY(); + } + + int SettingPresenter::GetListItemNum() + { + return settingModel->GetSettingListNum(); + } + void SettingPresenter::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnStart"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingView.cpp index 94efc0bb2..e6a2827b9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-07-12 09:55:29 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-22 18:30:57 + * @LastEditTime: 2024-09-18 10:49:14 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingView.cpp */ @@ -28,7 +28,7 @@ namespace OHOS static constexpr int16 LIST_POS = 20; static constexpr int16 SNUM_2 = 2; static constexpr int16 ROLLSPEED = 70; - static constexpr int16 REBOUNDSIZE = 35; + static constexpr int16 REBOUNDSIZE = 30; SettingView::SettingView() { @@ -125,17 +125,21 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::OnStart::contentList is nullptr"); return; } - contentList->SetPosition(SETTING_LIST_POSITION_X, SETTING_LIST_POSITION_Y, 380, 400); + contentList->SetPosition(SETTING_LIST_POSITION_X, SETTING_LIST_POSITION_Y, 380, 360); contentList->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); - contentList->SetScrollBlankSize(75); - // contentList->SetSelectPosition(820 / SNUM_2); // middle position + contentList->SetScrollBlankSize(30); contentList->SetDraggable(true); contentList->SetThrowDrag(true); contentList->EnableAutoAlign(true); contentList->SetReboundSize(REBOUNDSIZE); contentList->SetMaxScrollDistance(MAX_SCR_DIS); + contentList->SetSwipeACCLevel(800); /*设置手指抬起屏幕后的补偿距离。*/ contentList->RequestFocus(); - contentList->SetRotateFactor(2); + contentList->SetRotateFactor(1.0); + /* ----------------------------------- Add ---------------------------------- */ + scrollView->Add(title); + scrollView->Add(contentList); + container_->Add(scrollView); } void SettingView::OnStart() @@ -163,15 +167,7 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::OnSetUpView"); View::OnSetUpView(); - if (scrollView == nullptr || contentList == nullptr || listAdapter == nullptr || title == nullptr) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView:: OnSetUpView has nullptr"); - return; - } - scrollView->Add(title); - scrollView->Add(contentList); - contentList->SetAdapter(listAdapter); - container_->Add(scrollView); + settingListOnSetUpView(); Draw(); return; } @@ -188,6 +184,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::OnStop"); View::OnStop(); RootView::GetInstance()->ClearOnKeyActListener(); + settingListOnStop(); ClearAll(); return; } @@ -197,4 +194,57 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::AddSettingItemToList"); listAdapter->AddListItem(item); } + + void SettingView::settingListOnSetUpView(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::settingListOnSetUpView"); + if (contentList == nullptr || listAdapter == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SettingView::settingListOnSetUpView fail!!"); + return; + } + uint16_t startIndex = 0; + int16_t headY = 0; + int NUM_2 = 2; + int screen_h = Screen::GetInstance().GetHeight(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetStartIndex = %d,GetListItemNum = %d", presenter_->GetStartIndex(), presenter_->GetListItemNum()); + if (presenter_->GetStartIndex() >= presenter_->GetListItemNum()) + { + startIndex = presenter_->GetListItemNum() - 1; + headY = screen_h / NUM_2; + } + else + { + uint16_t presliceId = NativeAbility::GetInstance().GetPreSliceId(); + if (presliceId == VIEW_MAIN) + { + startIndex = 0; + headY = 0; + } + else + { + startIndex = presenter_->GetStartIndex(); + headY = presenter_->GetHeadItemY(); + } + if (headY == 0) + { + headY = screen_h / NUM_2; + } + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "startIndex = %d,headY = %d", startIndex, headY); + contentList->SetStartIndex(startIndex); + contentList->SetAdapter(listAdapter); + contentList->RefreshList(); + contentList->ScrollBy(headY); + } + + void SettingView::settingListOnStop(void) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::settingListOnStop"); + int16_t listHeadY = contentList->GetChildrenHead()->GetY(); + int16_t listHeadIndex = contentList->GetChildrenHead()->GetViewIndex(); + presenter_->SetHeadItemY(listHeadY); + presenter_->SetStartIndex(listHeadIndex); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listHeadY = %d,listHeadIndex = %d", listHeadY, listHeadIndex); + } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp index 8d00b8ed5..d7e65e490 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-02-23 09:17:00 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-19 17:47:54 + * @LastEditTime: 2024-09-18 19:34:06 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp */ #include "soundandvibration/include/SoundAndVibrationModel.h" @@ -12,6 +12,7 @@ #include "soundandvibration/include/CallVolumeView.h" #include "wearable_log.h" #include "ConfigModel.h" +#include "player/include/PlayersView.h" namespace OHOS { @@ -29,14 +30,16 @@ namespace OHOS bool SoundAndVibrationModel::UpdateSystemVolume(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationModel::UpdateSystemVolume"); - SystemVolumeView *p_SystemVolumeView = SystemVolumeView::GetInstance(); - if (p_SystemVolumeView == nullptr) + if (SystemVolumeView::GetInstance()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::GetInstance fail!!"); - return false; + SystemVolumeView::GetInstance()->UpdateSystemVolumeSliderValue(); } - p_SystemVolumeView->UpdateSystemVolumeSliderValue(); + //同步显示音乐的声音进度条 + if(PlayersView::GetInstance()) + { + PlayersView::GetInstance()->UpdateVolumeValue(); + } return true; } diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 23fec06b6..2e8324e0c 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -124,7 +124,7 @@ const PriorityMapper PRI_MAPPER[] = { #endif {TOPIC_EVENT_FIND_WATCH,PRIORITY_TWO},// 找手表 [2] {TOPIC_EVENT_CANCEL_FIND_WATCH,PRIORITY_TWO},// 取消找手表 [2] - {TOPIC_EVENT_DRINKREMINDER,PRIORITY_THREE},//喝水提醒 [3] + {TOPIC_EVENT_DRINKREMINDER,PRIORITY_TWO},//喝水提醒 [2] {TOPIC_EVENT_MESSAGENOTE,PRIORITY_THREE},//消息提醒 [3] {TOPIC_EVENT_MESSAGE_UPDATA,PRIORITY_TWO},//消息更新提醒 [3] {TOPIC_EVENT_SLEEPNOTE,PRIORITY_THREE},//睡眠弹窗 [3] @@ -1133,7 +1133,7 @@ void MsgCenterNotifyDrinkReminderProc(const Topic topic, Request *req) // unused(topic); unused(req); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyDrinkReminderProc !"); - DrinkReminderViewEventListener::GetInstance().set_screen_on_and_vibration(); + // DrinkReminderViewEventListener::GetInstance().set_screen_on_and_vibration(); if (CheckPriority(topic)) { NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); -- 2.17.1