From c9c2f2b0730d6e625f7a25ea5ccfeb49c6a512dc Mon Sep 17 00:00:00 2001
From: luozheng <1732036298@qq.com>
Date: Wed, 19 Jun 2024 19:06:16 +0800
Subject: [PATCH] =?utf8?q?=E5=A3=B0=E9=9F=B3=E4=B8=8E=E9=9C=87=E5=8A=A8sli?=
=?utf8?q?ce=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
---
.../nativelauncher/include/UiConfig.h | 2 +
.../nativeui/applist/src/ApplistModel.cpp | 5 +-
.../nativeui/findphone/src/FindPhoneView.cpp | 8 +-
.../language/Language_xml/input_list_zh.txt | 3 +-
.../language/Language_xml/language_zh.xml | 1 +
.../fd230app/nativeui/language/font/en.lang | Bin 8966 -> 8971 bytes
.../fd230app/nativeui/language/font/ja.lang | Bin 7269 -> 7274 bytes
.../language/font/ui_resource_string.h | 3 +-
.../fd230app/nativeui/language/font/zh.lang | Bin 8836 -> 8853 bytes
.../include/CallVolumePresenter.h | 3 +-
.../include/CallVolumeView.h | 9 +-
.../include/SoundAndVibrationModel.h | 7 +-
.../include/SoundAndVibrationPresenter.h | 3 +-
.../include/SoundAndVibrationView.h | 9 +-
.../include/SystemVolumePresenter.h | 3 +-
.../include/SystemVolumeView.h | 8 +-
.../include/VibrationModeView.h | 4 +-
.../src/CallVolumePresenter.cpp | 15 +-
.../soundandvibration/src/CallVolumeView.cpp | 73 ++++++----
.../src/SoundAndVibrationModel.cpp | 66 ++++++++-
.../src/SoundAndVibrationPresenter.cpp | 49 ++++---
.../src/SoundAndVibrationView.cpp | 136 +++++++++---------
.../SoundAndVibrationVolumeSettingView.cpp | 12 +-
.../src/SystemVolumePresenter.cpp | 12 +-
.../src/SystemVolumeView.cpp | 79 ++++++----
.../src/VibrationModeView.cpp | 50 ++++---
.../nativeui/uiservice/include/ui_service.h | 6 +-
.../nativeui/uiservice/src/ui_service.cpp | 41 ++++++
.../service/ble_service/blemoder/bletest.cpp | 12 +-
.../fd230/fs/user/res/font/en.lang | Bin 8966 -> 8971 bytes
.../fd230/fs/user/res/font/ja.lang | Bin 7269 -> 7274 bytes
.../fs/user/res/font/ui_resource_string.h | 3 +-
.../fd230/fs/user/res/font/zh.lang | Bin 8836 -> 8853 bytes
33 files changed, 396 insertions(+), 226 deletions(-)
diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h
index 637ca8c61..faff5e53c 100644
--- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h
+++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h
@@ -271,6 +271,7 @@ namespace OHOS
static constexpr const char *PNG_APPLIST_BLUETOOTH_IMAGE = APP_LIST_PATH "/Bluetooth.bin"; // èç
static constexpr const char *PNG_APPLIST_BREATHE_IMAGE = APP_LIST_PATH "/breathe.bin"; // å¼å¸è®ç»
static constexpr const char *PNG_APPLIST_GOAL_IMAGE = APP_LIST_PATH "/sport.bin"; // æ¯æ¥ç®æ
+ static constexpr const char *PNG_APPLIST_VOICE_IMAGE = APP_LIST_PATH "/voice.bin"; // 声é³
/* ---------------------------------- å¿«éè®ç» ---------------------------------- */
static constexpr const char *PNG_TRAING_BOUTTONMORE_IMAGE = APP_RES_PATH "/Training/More.bin";
@@ -322,6 +323,7 @@ namespace OHOS
static constexpr const char *PNG_TOGGLEBUTTON_OFF_IMAGE = APP_RES_PATH "/TOGGLEBUTTON_OFF.bin"; // togglebutttonæªéä¸å¾ç
static constexpr const char *PNG_TOGGLEBUTTON_ON_IMAGE = APP_RES_PATH "/TOGGLEBUTTON_ON.bin"; // togglebutttonéä¸å¾ç
static constexpr const char *PNG_ATTENTION_IMAGE = APP_RES_PATH "/Attention.bin"; // 注æ
+ static constexpr const char *PNG_BUTTON_466x100_IMAGE = APP_RES_PATH "/466x100button.bin";
static constexpr const char *PNG_SUCC_IMAGE = APP_RES_PATH "/OK.bin"; // æå
diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp
index 25105cb27..e2bdc19f5 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp
@@ -17,8 +17,8 @@
#include "AppViewIDs.h"
#include "components/ui_label_ext.h"
#include "language/font/ui_resource_string.h"
-#include "ApplistModel.h"
-#include "ApplistPresenter.h"
+#include "applist/include/ApplistModel.h"
+#include "applist/include/ApplistPresenter.h"
#include "SetDesktopModel.h"
#include "themestyle/include/ThemeStyleModel.h"
@@ -44,6 +44,7 @@ namespace OHOS
{VIEW_THEME_STYLE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_THEME_IMAGE, "æ¾ç¤ºæ¹å¼", STR_DISPLAY_MODE, nullptr},
{VIEW_SET_CARD, PNG_APPLIST_CARDSET_IMAGE, PNG_APPLIST_CARDSET_IMAGE, "å¡ç管ç", STR_CARD_MANAGEMENT, nullptr},
{VIEW_SET_DIAL, PNG_APPLIST_CHANGEDIAL_IMAGE, PNG_APPLIST_CHANGEDIAL_IMAGE, "æ´æ¢è¡¨ç", STR_WATCH_FACE, nullptr},
+ {VIEW_SOUND_VIBRATION, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_VOICE_IMAGE, "声é³", STR_WATCH_FACE, nullptr},
{VIEW_CLASSIC_BLUETOOTH, PNG_APPLIST_BLUETOOTH_IMAGE, PNG_APPLIST_BLUETOOTH_IMAGE, "èç", STR_BLUETOOTH, nullptr},
{VIEW_DNOTDISTURB, PNG_APPLIST_DISTURB_IMAGE, PNG_APPLIST_DISTURB_IMAGE, "å¿æ°æ¨¡å¼", STR_DO_NOT_DISTURB, nullptr},
{VIEW_FLASHLIGHT, PNG_APPLIST_FLASHLIGHT_IMAGE, PNG_APPLIST_FLASHLIGHT_IMAGE, "æçµç", STR_FLASHLIGHT, nullptr},
diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
index a26308895..f2a833352 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-27 10:47:46
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-07 18:33:39
+ * @LastEditTime: 2024-06-19 15:36:22
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp
*/
#include "findphone/include/FindPhoneView.h"
@@ -173,8 +173,7 @@ namespace OHOS
}
FindPhoneLabelButton->SetPosition(0, 366, 466, 100);
FindPhoneLabelButton->SetViewId(FINDPHONE_LABELBUTTON);
- const char *ImgSrc = "/user/res/466x100button.bin";
- FindPhoneLabelButton->SetImageSrc(ImgSrc, ImgSrc);
+ FindPhoneLabelButton->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE);
//FindPhoneLabelButton->SetText("å
³é");
FindPhoneLabelButton->SetTextId(STR_CLOSE);
FindPhoneLabelButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
@@ -272,8 +271,7 @@ namespace OHOS
}
FindPhoneLabelButton->SetPosition(0, 366, 466, 100);
FindPhoneLabelButton->SetViewId(FINDPHONE_LABELBUTTON);
- const char *ImgSrc = "/user/res/466x100button.bin";
- FindPhoneLabelButton->SetImageSrc(ImgSrc, ImgSrc);
+ FindPhoneLabelButton->SetImageSrc(PNG_466x100BUTTON_IMAGE, PNG_466x100BUTTON_IMAGE);
//FindPhoneLabelButton->SetText("忢");
FindPhoneLabelButton->SetTextId(STR_STOP);
FindPhoneLabelButton->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
index 4a4619843..e080bb323 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt
@@ -458,4 +458,5 @@ STR_TABULAR_DISPLAY$å表æ¾ç¤º
STR_GRID_DISPLAY$ç½æ ¼æ¾ç¤º
STR_CELLULAR_DISPLAY$èçªæ¾ç¤º
STR_RECORDING_LIST$å½é³å表
-STR_CRLEMPTY$å½åå½é³å表为空
\ No newline at end of file
+STR_CRLEMPTY$å½åå½é³å表为空
+STR_CALL_VOLUME$éè¯é³é
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
index d30f5155d..503010b7b 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml
@@ -460,4 +460,5 @@
+
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang
index 7dc97fa77e8813929b31f524f7ce7bbf398b185f..8b36d0d4464d3e760958754e6ae4b633aa15ce77 100644
GIT binary patch
delta 39
jcmZp3>vj{ZH2d9|n#X_wZf+D!WM`bPxtM*jG$R85$T$ft
delta 35
fcmeBnYjYEw62$o;HID%W+}J3Z$iBIXeS$Oqn(zoh
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/ja.lang
index 29e8216b3743d0b71e74a6aafa8cde8da37b4897..527f904b70d93e629dbf0d5f653d3a5730c9574e 100644
GIT binary patch
delta 39
jcmaEA@ybH9GN{}uE0F;O+}tRd$j|8&sPc8
delta 35
fcmaE5@zg@p!1!2NRw4rmxUo?*k$rO&`+E@ps6Pno
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h b/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
index 0769074ff..eb9eee311 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/language/font/ui_resource_string.h
@@ -482,7 +482,8 @@ enum UIResourceTextId : uint16_t {
STR_SUN = 469,
STR_RECORDING_LIST = 470,
STR_CRLEMPTY = 471,
- STR_MAX_ID = 472,
+ STR_CALL_VOLUME = 472,
+ STR_MAX_ID = 473,
}; // UIResourceTextId
enum FontLanguageId : uint8_t {
diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/zh.lang
index 22553ae6f778771b71fc0ab8b21e4453b16081b7..7ed341fb0fc1526b7e2dd80057fbd6611fec7b74 100644
GIT binary patch
delta 52
xcmZp1o$4yOWl5t;RR#kJxVcd@k)4T8dUFZ8fHd#RhFLGx&wV+6^UL;r1^{nG5WxTd
delta 35
fcmbR0+TtoYo4>oQDuV$9+}J3Z$iBIXolhD7nQsTV
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumePresenter.h
index 918a9e9b8..e330b9e44 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumePresenter.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumePresenter.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 16:24:23
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-19 15:17:28
+ * @LastEditTime: 2024-06-19 18:58:47
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumePresenter.h
*/
#ifndef CALL_VOLUME_PRESENTER_H
@@ -65,6 +65,7 @@ namespace OHOS
bool OnDrag(UIView &view, const DragEvent &event) override;
bool OnDragEnd(UIView &view, const DragEvent &event);
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // å¢å æé®äºä»¶
+ bool X_DRAG_FLAG{false};
};
} // namespace OHOS
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumeView.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumeView.h
index 14562a9ea..ad72166e5 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumeView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumeView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 15:37:44
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-19 15:11:50
+ * @LastEditTime: 2024-06-19 18:49:04
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/CallVolumeView.h
*/
#ifndef CALL_VOLUME_VIEW_H
@@ -24,19 +24,18 @@ namespace OHOS
CallVolumeView();
virtual ~CallVolumeView();
static CallVolumeView *GetInstance(void);
+ bool UpdateCallVolumeSliderValue(void);
void OnStart() override;
void OnSetUpView() override;
void OnTearDownView() override;
void OnStop() override;
- UIScrollView *CallVolumeViewInit(void);
- void ClearAll();
-
private:
+ void ClearAll();
+ UIScrollView *CallVolumeViewInit(void);
UIScrollView *CallVolumeScrollView{nullptr};
SoundAndVibrationVolumeSettingView *p_SoundAndVibrationVolumeSettingView{nullptr};
- UIView::OnDragListener *volumeDragListener{nullptr};
bool initViewStatus{false};
};
} // namespace OHOS
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationModel.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationModel.h
index 162e6338f..0e6985216 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationModel.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationModel.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-02-23 09:17:12
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-22 17:39:22
+ * @LastEditTime: 2024-06-19 17:40:28
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationModel.h
*/
#ifndef SOUND_AND_VIBRATION_MODEL_H
@@ -14,7 +14,10 @@ namespace OHOS
{
public:
static SoundAndVibrationModel *GetInstance(void);
-
+ bool UpdateSystemVolume(void);
+ bool UpdateCallVolume(void);
+ bool UpdateVibrationModePickerSelectIndex(void);
+ bool UpdateSilentModeSwitch(void);
void SetVibrationReminderToggleButtonStaus(int value);
int GetVibrationReminderToggleButtonStaus();
void SetSilentModeToggleButtonStatus(bool value);
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationPresenter.h
index d3cbfa6c9..19c6c8ac9 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationPresenter.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationPresenter.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-02-19 10:39:08
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-22 16:09:04
+ * @LastEditTime: 2024-06-19 14:37:36
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationPresenter.h
*/
#ifndef SOUND_AND_VIBRATION_PRESENTER_H
@@ -44,6 +44,7 @@ namespace OHOS
bool OnChange(UICheckBox::UICheckBoxState state) override;
bool OnRotate(UIView& view, const RotateEvent& event);
bool OnRotateEnd(UIView& view, const RotateEvent& event);
+ bool X_DRAG_FLAG{false};
};
} // namespace OHOS
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h
index 7ce0244c1..b8c021bac 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-19 21:03:26
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-06 15:13:58
+ * @LastEditTime: 2024-06-19 17:44:40
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SoundAndVibrationView.h
*/
#ifndef SOUND_AND_VIBRATION_VIEW_H
@@ -43,7 +43,7 @@ namespace OHOS
int16_t w;
int16_t h;
const char *ViewId;
- //std::string Text;
+ // std::string Text;
int16_t TextId;
};
SoundAndVibrationView();
@@ -53,7 +53,8 @@ namespace OHOS
bool ChangeVibrationModeView(int16_t thisView);
bool ClickFunc(int16_t interface);
void ChangeView(int16_t hideView, int16_t showView);
- VibrationModeView*GetVibrationModeView(void);
+ VibrationModeView *GetVibrationModeView(void);
+ bool UpdateSilentModeSwitchStatus(void);
void OnStart() override;
void OnSetUpView() override;
@@ -64,7 +65,7 @@ namespace OHOS
VibrationModeView *vibrationModeView{nullptr};
private:
- void InitView(void);
+ void CreateSoundAndVibrationView(void);
void ClearAll(void);
UILabelButtonExt *SetUpButton_Ext(ButtonConfig &buttonconfig, bool nextImgVisible);
bool InitSoundAndVibrationScrollView(void);
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumePresenter.h
index a2fedbf47..40cda0855 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumePresenter.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumePresenter.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 16:24:30
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-19 14:53:45
+ * @LastEditTime: 2024-06-19 17:04:30
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumePresenter.h
*/
#ifndef SYSTEM_VOLUME_PRESENTER_H
@@ -38,6 +38,7 @@ namespace OHOS
bool OnDrag(UIView &view, const DragEvent &event) override;
bool OnDragEnd(UIView &view, const DragEvent &event);
bool OnKeyAct(UIView &view, const KeyEvent &event) override; // å¢å æé®äºä»¶
+ bool X_DRAG_FLAG{false};
};
} // namespace OHOS
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumeView.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumeView.h
index b8b70dadf..0d0c9ad0d 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumeView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumeView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-01-29 15:37:44
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-19 15:11:54
+ * @LastEditTime: 2024-06-19 17:25:37
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/SystemVolumeView.h
*/
#ifndef SYSTEM_VOLUME_VIEW_H
@@ -24,16 +24,16 @@ namespace OHOS
SystemVolumeView();
virtual ~SystemVolumeView();
static SystemVolumeView *GetInstance(void);
+ bool UpdateSystemVolumeSliderValue(void);
void OnStart() override;
void OnSetUpView() override;
void OnTearDownView() override;
void OnStop() override;
- UIScrollView *SystemVolumeViewInit(void);
- void ClearAll();
-
private:
+ void ClearAll();
+ UIScrollView *SystemVolumeViewInit(void);
UIScrollView *SystemVolumeScrollView{nullptr};
SoundAndVibrationVolumeSettingView *p_SoundAndVibrationVolumeSettingView{nullptr};
bool initViewStatus{false};
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/VibrationModeView.h b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/VibrationModeView.h
index c3ea861f0..d92b773f0 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/VibrationModeView.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/VibrationModeView.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-22 14:35:10
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-22 16:59:48
+ * @LastEditTime: 2024-06-19 15:18:07
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/include/VibrationModeView.h
*/
#ifndef VIBRATION_MODE_H
@@ -15,6 +15,7 @@
namespace OHOS
{
+ static constexpr const char *VIBRATION_MODE_VIEWID = "VibrationModeViewId";
class VibrationModeView
{
public:
@@ -25,6 +26,7 @@ namespace OHOS
UIScrollView *GetVibrationModeScrollView(void);
UILabelButtonExt *GetVibrationModeLabelButton(void);
UIPicker *GetVibrationModePicker(void);
+ bool UpdatePickerSelectIndex(void);
private:
void ClearAll();
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp
index 04b36061b..5301aa02e 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-30 09:14:38
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-19 15:17:16
+ * @LastEditTime: 2024-06-19 18:58:32
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumePresenter.cpp
*/
#include "AppViewIDs.h"
@@ -14,6 +14,7 @@
#include "common/key_code.h"
#include "custom_utils.h"
#include
+#include
// ç³»ç»é³é
namespace OHOS
@@ -67,11 +68,10 @@ namespace OHOS
bool CallVolumePresenter::OnDrag(UIView &view, const DragEvent &event)
{
UNUSED(view);
- UNUSED(event);
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
- (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumePresenter::OnDrag");
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // æå¨è¿ç¨ä¸å¤ææ¯å¦æ¯æ°´å¹³æ»å¨
{
- NativeAbility::GetInstance().Back();
+ CallVolumePresenter::X_DRAG_FLAG = true;
}
return true;
}
@@ -79,10 +79,11 @@ namespace OHOS
bool CallVolumePresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
UNUSED(view);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationPresenter::OnDragEnd");
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumePresenter::OnDragEnd");
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && CallVolumePresenter::X_DRAG_FLAG)
{
NativeAbility::GetInstance().Back();
+ CallVolumePresenter::X_DRAG_FLAG = false;
}
return true;
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumeView.cpp
index 7c657dd78..bc93bc85d 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumeView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/CallVolumeView.cpp
@@ -19,7 +19,6 @@ namespace OHOS
CallVolumeView::~CallVolumeView()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolumeView::~CallVolumeView");
- ClearAll();
g_pCallVolumeView = nullptr;
}
@@ -32,6 +31,13 @@ namespace OHOS
{
if (initViewStatus == true)
{
+ if (container_ != nullptr)
+ {
+ container_->RemoveAll();
+ delete container_;
+ container_ = nullptr;
+ }
+
delete p_SoundAndVibrationVolumeSettingView;
p_SoundAndVibrationVolumeSettingView = nullptr;
}
@@ -39,6 +45,7 @@ namespace OHOS
UIScrollView *CallVolumeView::CallVolumeViewInit(void)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumeView::CallVolumeViewInit");
p_SoundAndVibrationVolumeSettingView = new SoundAndVibrationVolumeSettingView(CALL_VOLUME);
if (p_SoundAndVibrationVolumeSettingView == nullptr)
{
@@ -52,60 +59,68 @@ namespace OHOS
return nullptr;
}
- UIView::OnDragListener *volumeDragListener = static_cast(CallVolumePresenter::GetInstance());
- if (volumeDragListener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingPresenter GetInstance fail");
- return nullptr;
- }
- CallVolumeScrollView->SetOnDragListener(volumeDragListener);
- if (CallVolumeScrollView == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_SoundAndVibrationVolumeSettingView->SetUpVolumeProcess fail!!");
- return nullptr;
- }
-
- // p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(PhoneAudioGetVolume());
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolume = %d", PhoneAudioGetVolume());
- // p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(GetCallCurrVolume());
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolume = %d", GetCallCurrVolume());
-
- int callVolume = ConfigModel::GetInstance()->GetCallVolume();
- p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(callVolume);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolume = %d", callVolume);
-
- initViewStatus = true;
return CallVolumeScrollView;
}
void CallVolumeView::OnStart()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumeView::OnStart");
View::OnStart();
+ SetContainerView(new UIViewGroup());
+ container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+ container_->SetOnDragListener(presenter_);
- CallVolumeViewInit();
+ if (!initViewStatus)
+ {
+ CallVolumeViewInit();
+ initViewStatus = true;
+ }
+ UpdateCallVolumeSliderValue();
- RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::CallVolumePresenter::GetInstance();
- RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+ RootView::GetInstance()->SetOnKeyActListener(presenter_);
+ return;
}
void CallVolumeView::OnSetUpView()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumeView::OnSetUpView");
View::OnSetUpView();
- RootView::GetInstance()->Add(CallVolumeScrollView);
+ container_->Add(CallVolumeScrollView);
Draw();
+ return;
}
void CallVolumeView::OnTearDownView()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumeView::OnTearDownView");
View::OnTearDownView();
return;
}
void CallVolumeView::OnStop()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumeView::OnStop");
View::OnStop();
RootView::GetInstance()->ClearOnKeyActListener();
- RootView::GetInstance()->RemoveAll();
+ ClearAll();
return;
}
+
+ // æ´æ°éè¯é³éæ¡çå¼
+ bool CallVolumeView::UpdateCallVolumeSliderValue(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallVolumeView::UpdateCallVolumeSliderValue");
+ if (p_SoundAndVibrationVolumeSettingView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolumeView::p_SoundAndVibrationVolumeSettingView is nullptr!");
+ return false;
+ }
+ int callVolume = ConfigModel::GetInstance()->GetCallVolume();
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolume = %d", callVolume);
+ p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(callVolume);
+
+ return true;
+ }
}
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 3d0cbb2bd..8d00b8ed5 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp
@@ -2,11 +2,14 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-02-23 09:17:00
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-22 17:43:36
+ * @LastEditTime: 2024-06-19 17:47:54
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationModel.cpp
*/
#include "soundandvibration/include/SoundAndVibrationModel.h"
#include "soundandvibration/include/SoundAndVibrationPresenter.h"
+#include "soundandvibration/include/VibrationModeView.h"
+#include "soundandvibration/include/SystemVolumeView.h"
+#include "soundandvibration/include/CallVolumeView.h"
#include "wearable_log.h"
#include "ConfigModel.h"
namespace OHOS
@@ -22,6 +25,65 @@ namespace OHOS
return &instance;
}
+ // æ´æ°ç³»ç»é³éæ¡çå¼
+ bool SoundAndVibrationModel::UpdateSystemVolume(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationModel::UpdateSystemVolume");
+ SystemVolumeView *p_SystemVolumeView = SystemVolumeView::GetInstance();
+ if (p_SystemVolumeView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::GetInstance fail!!");
+ return false;
+ }
+ p_SystemVolumeView->UpdateSystemVolumeSliderValue();
+
+ return true;
+ }
+
+ // æ´æ°éè¯é³éæ¡çå¼
+ bool SoundAndVibrationModel::UpdateCallVolume(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationModel::UpdateCallVolume");
+ CallVolumeView *p_CallVolumeView = CallVolumeView::GetInstance();
+ if (p_CallVolumeView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolumeView::GetInstance fail!!");
+ return false;
+ }
+ p_CallVolumeView->UpdateCallVolumeSliderValue();
+
+ return true;
+ }
+
+ // æ´æ°é卿¨¡å¼éæ©å¨çéå®é¡¹çç´¢å¼
+ bool SoundAndVibrationModel::UpdateVibrationModePickerSelectIndex(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationModel::UpdateVibrationModePickerSelectIndex");
+ VibrationModeView *p_VibrationModeView = VibrationModeView::GetInstance();
+ if (p_VibrationModeView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VibrationModeView::GetInstance fail!!");
+ return false;
+ }
+ p_VibrationModeView->UpdatePickerSelectIndex();
+
+ return true;
+ }
+
+ // æ´æ°é鳿¨¡å¼å¼å
³ç¶æ
+ bool SoundAndVibrationModel::UpdateSilentModeSwitch(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationModel::UpdateSilentModeSwitch");
+ SoundAndVibrationView *p_SoundAndVibrationView = SoundAndVibrationView::GetInstance();
+ if (p_SoundAndVibrationView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::GetInstance fail!!");
+ return false;
+ }
+ p_SoundAndVibrationView->UpdateSilentModeSwitchStatus();
+ return true;
+ }
+
/// @brief 设置âé卿¨¡å¼â强度
/// @param value
void SoundAndVibrationModel::SetVibrationReminderToggleButtonStaus(int value)
@@ -29,7 +91,7 @@ namespace OHOS
ConfigModel::GetInstance()->SetVibrationReminder(value);
}
- //è·åéå¨å¼ºåº¦
+ // è·åéå¨å¼ºåº¦
int SoundAndVibrationModel::GetVibrationReminderToggleButtonStaus()
{
return ConfigModel::GetInstance()->GetVibrationReminder();
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp
index d23838126..9d3c3805d 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-02-19 10:39:11
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-22 18:05:00
+ * @LastEditTime: 2024-06-19 15:40:58
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp
*/
@@ -18,6 +18,7 @@
#include "ConfigModel.h"
#include
#include "soundandvibration/include/SoundAndVibrationVolumeSettingC.h"
+#include "UiConfig.h"
namespace OHOS
{
@@ -27,73 +28,71 @@ namespace OHOS
SoundAndVibrationPresenter::SoundAndVibrationPresenter()
{
-
g_pSoundAndVibrationPresenter = this;
}
SoundAndVibrationPresenter::~SoundAndVibrationPresenter()
{
-
g_pSoundAndVibrationPresenter = nullptr;
}
SoundAndVibrationPresenter *SoundAndVibrationPresenter::GetInstance()
{
-
return g_pSoundAndVibrationPresenter;
}
void SoundAndVibrationPresenter::OnStart()
{
-
Presenter::OnStart();
}
void SoundAndVibrationPresenter::OnPause(void)
{
-
Presenter::OnPause();
}
void SoundAndVibrationPresenter::OnResume(void)
{
-
Presenter::OnResume();
+ if (view_ == nullptr)
+ {
+ return;
+ }
}
void SoundAndVibrationPresenter::OnStop(void)
{
-
Presenter::OnStop();
}
bool SoundAndVibrationPresenter::OnDrag(UIView &view, const DragEvent &event)
{
UNUSED(view);
- UNUSED(event);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RespiratoryTrainingPresenter::OnDrag");
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // æå¨è¿ç¨ä¸å¤ææ¯å¦æ¯æ°´å¹³æ»å¨
+ {
+ SoundAndVibrationPresenter::X_DRAG_FLAG = true;
+ }
return true;
}
bool SoundAndVibrationPresenter::OnDragEnd(UIView &view, const DragEvent &event)
{
+ UNUSED(view);
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationPresenter::OnDragEnd");
- SoundAndVibrationView *p_SoundAndVibrationView = SoundAndVibrationView::GetInstance();
- if (p_SoundAndVibrationView == nullptr)
+ std::string viewId = view.GetViewId();
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && SoundAndVibrationPresenter::X_DRAG_FLAG)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationPresenter::GetInstance() fail!!");
- return false;
- }
-
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
- {
- if (&view == p_SoundAndVibrationView->GetVibrationModeView()->GetVibrationModeScrollView())
+ if (viewId == VIBRATION_MODE_VIEWID) // 妿å¨é卿éåè§å¾
{
+ view_->GetVibrationModeView()->UpdatePickerSelectIndex();
SoundAndVibrationView::GetInstance()->ChangeView(VIBRATIONMODEVIEW, SOUNDANDVIBRATIONVIEW);
}
else
{
- NativeAbility::GetInstance().Back();
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
+ SoundAndVibrationPresenter::X_DRAG_FLAG = false;
}
return true;
@@ -108,7 +107,7 @@ namespace OHOS
// 妿æ¯poweré®,䏿¯äº®å±ç¶æï¼æé®éæ¾å°±è¿åä¸ä¸çº§
if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 0 && uapi_get_screen_state() == 0)
{
- NativeAbility::GetInstance().Back();
+ NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
}
return true;
}
@@ -116,9 +115,9 @@ namespace OHOS
bool SoundAndVibrationPresenter::OnClick(UIView &view, const ClickEvent &event)
{
UNUSED(event);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationPresenter::OnKeyAct");
if (strcmp(view.GetViewId(), SYSTEM_VOLUME_BUTTON) == 0)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SYSTEM_VOLUME_BUTTON");
NativeAbility::GetInstance().EnterSlice(VIEW_SYSTEM_VOLUME);
}
else if (strcmp(view.GetViewId(), CALL_VOLUME_BUTTON) == 0)
@@ -127,15 +126,15 @@ namespace OHOS
}
else if (strcmp(view.GetViewId(), VIBRATION_REMINDER_BUTTON) == 0)
{
- SoundAndVibrationView::GetInstance()->ChangeView(SOUNDANDVIBRATIONVIEW, VIBRATIONMODEVIEW);
+ view_->ChangeView(SOUNDANDVIBRATIONVIEW, VIBRATIONMODEVIEW);
}
- else if (&view == SoundAndVibrationView::GetInstance()->GetVibrationModeView()->GetVibrationModeLabelButton())
+ else if ((view_->GetVibrationModeView() != nullptr) && (&view == view_->GetVibrationModeView()->GetVibrationModeLabelButton()))
{
- int VibrationMode = SoundAndVibrationView::GetInstance()->GetVibrationModeView()->GetVibrationModePicker()->GetSelected();
+ int VibrationMode = view_->GetVibrationModeView()->GetVibrationModePicker()->GetSelected();
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VibrationMode = %d", VibrationMode);
VibationModeSet(VibrationMode);
SoundAndVibrationModel::GetInstance()->SetVibrationReminderToggleButtonStaus(VibrationMode);
- SoundAndVibrationView::GetInstance()->ChangeView(VIBRATIONMODEVIEW, SOUNDANDVIBRATIONVIEW);
+ view_->ChangeView(VIBRATIONMODEVIEW, SOUNDANDVIBRATIONVIEW);
}
return true;
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
index 3d5bd1410..9f0427e18 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-02-19 10:39:14
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-05-06 15:19:39
+ * @LastEditTime: 2024-06-19 17:46:53
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationView.cpp
*/
#include "soundandvibration/include/SoundAndVibrationView.h"
@@ -10,6 +10,7 @@
#include "soundandvibration/include/SoundAndVibrationModel.h"
#include "wearable_log.h"
#include "language/font/ui_resource_string.h"
+#include
/*
æä¼å
级å为
1.ç³»ç»é³é
@@ -38,7 +39,6 @@ namespace OHOS
SoundAndVibrationView::~SoundAndVibrationView()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::~SoundAndVibrationView");
- ClearAll();
g_pSoundAndVibrationView = nullptr;
}
@@ -49,6 +49,13 @@ namespace OHOS
void SoundAndVibrationView::ClearAll()
{
+ if (container_ != nullptr)
+ {
+ container_->RemoveAll();
+ delete container_;
+ container_ = nullptr;
+ }
+
if (SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] != nullptr)
{
SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->RemoveAll();
@@ -90,22 +97,19 @@ namespace OHOS
SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] = new UIScrollView();
if (SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] == nullptr)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::new SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW] fail!");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::new SoundAndVibrationScrollView[%d] fail!", SOUNDANDVIBRATIONVIEW);
return false;
}
SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetScrollBlankSize(35);
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetReboundSize(50);
+ SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetScrollBlankSize(75);
+ SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetReboundSize(35);
SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetDirection(1);
- UIView::OnDragListener *draglistener = static_cast(SoundAndVibrationPresenter::GetInstance());
- if (draglistener == nullptr)
- {
- return false;
- }
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetOnDragListener(draglistener);
+ SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetMaxScrollDistance(1000);
+ SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetThrowDrag(true);
SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetTouchable(true);
SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->SetDraggable(true);
+ container_->Add(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]);
return true;
}
@@ -121,15 +125,14 @@ namespace OHOS
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::Title new fail!");
return false;
}
- Title->SetPosition(93, 52, 280, 40);
+ Title->SetPosition(83, 52, 300, 35);
Title->SetStyle(STYLE_TEXT_FONT, 30);
Title->SetStyle(STYLE_LINE_HEIGHT, 35);
- //Title->SetText("声é³ä¸éå¨");
- Title->SetTextId(STR_SOUND_AND_VIBRATION);
+ Title->SetTextId(STR_SOUND_AND_VIBRATION); // 声é³ä¸éå¨
Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- //Title->SetRollSpeed(40);
Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(Title);
return true;
}
@@ -146,23 +149,21 @@ namespace OHOS
}
labelButton->SetPosition(buttonconfig.x, buttonconfig.y, buttonconfig.w, buttonconfig.h);
labelButton->SetViewId(buttonconfig.ViewId);
- labelButton->SetOnClickListener(static_cast(SoundAndVibrationPresenter::GetInstance()));
+ labelButton->SetOnClickListener(presenter_);
labelButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
if (nextImgVisible)
{
- const char *NextImgSrc = "/user/res/SETTING_NEXT.bin";
- labelButton->SetImageSrc(NextImgSrc, NextImgSrc);
+ labelButton->SetImageSrc(PNG_SETTING_NEXT_IMAGE, PNG_SETTING_NEXT_IMAGE);
labelButton->SetImagePosition(326, 37);
}
- //labelButton->SetText(buttonconfig.Text.c_str());
labelButton->SetTextId(buttonconfig.TextId);
labelButton->SetAlign(TEXT_ALIGNMENT_LEFT);
labelButton->SetLabelPosition(47, 0);
labelButton->SetStyle(STYLE_TEXT_FONT, 30);
labelButton->SetStyle(STYLE_LINE_HEIGHT, 35);
labelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
- labelButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff191919, UIButton::PRESSED);
+ labelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, nextImgVisible ? 0xff000000 : 0xff191919, UIButton::PRESSED);
+
return labelButton;
}
/// @brief 声é³ä¸éå¨è§å¾"æé®"åå§å
@@ -174,18 +175,17 @@ namespace OHOS
{
int y;
const char *viewId;
- //const char *text;
- const int16_t textId;
+ const int16_t textId;
bool clickEffect;
};
ButtonSetup buttonSetups[] = {
{120, SYSTEM_VOLUME_BUTTON, STR_SYSTEM_VOLUME, true},
- {240, CALL_VOLUME_BUTTON, STR_MEDIA_VOLUME, true},
+ {240, CALL_VOLUME_BUTTON, STR_CALL_VOLUME, true},
{360, VIBRATION_REMINDER_BUTTON, STR_VIBRATION_MODE, true},
{480, SILENT_MODE_BUTTON, STR_SILENT_MODE, false}};
- UILabelButtonExt **buttonPointers[] = {&SystemVolumeButton, &CallVolumeButton, &VibrationReminderButton, &SilentModeButton};
+ UILabelButtonExt *buttonPointers[] = {SystemVolumeButton, CallVolumeButton, VibrationReminderButton, SilentModeButton};
for (int i = 0; i < sizeof(buttonSetups) / sizeof(buttonSetups[0]); ++i)
{
@@ -195,15 +195,14 @@ namespace OHOS
.w = 380,
.h = 100,
.ViewId = buttonSetups[i].viewId,
- //.Text = buttonSetups[i].text};
.TextId = buttonSetups[i].textId};
- *buttonPointers[i] = SetUpButton_Ext(buttonconfig, buttonSetups[i].clickEffect);
- if (*buttonPointers[i] == nullptr)
+ buttonPointers[i] = SetUpButton_Ext(buttonconfig, buttonSetups[i].clickEffect);
+ if (buttonPointers[i] == nullptr)
{
- //WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::%s Button new fail!", buttonSetups[i].text);
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::Button[%d] new fail!", i);
return false;
}
+ SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(buttonPointers[i]);
}
return true;
@@ -211,7 +210,7 @@ namespace OHOS
bool SoundAndVibrationView::InitSoundAndVibrationToggleButton(void)
{
- /* ------------------------- SilentModeToggleButton ------------------------- */
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::InitSoundAndVibrationToggleButton");
SilentModeToggleButton = new UIToggleButton();
if (SilentModeToggleButton == nullptr)
{
@@ -222,80 +221,70 @@ namespace OHOS
SilentModeToggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
SilentModeToggleButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
SilentModeToggleButton->SetState(SoundAndVibrationModel::GetInstance()->GetSilentModeToggleButtonStatus());
- const char *ToggleButtonSelect = "/user/res/TOGGLEBUTTON_ON.bin";
- const char *ToggleButtonUnSelect = "/user/res/TOGGLEBUTTON_OFF.bin";
- SilentModeToggleButton->SetImages(ToggleButtonSelect, ToggleButtonUnSelect);
- UICheckBox::OnChangeListener *SilentModeToggleButtonChangeListener = static_cast(SoundAndVibrationPresenter::GetInstance());
- SilentModeToggleButton->SetOnChangeListener(SilentModeToggleButtonChangeListener);
+ SilentModeToggleButton->SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
+ SilentModeToggleButton->SetOnChangeListener(presenter_);
+ SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(SilentModeToggleButton);
+
return true;
}
- void SoundAndVibrationView::InitView(void)
+ void SoundAndVibrationView::CreateSoundAndVibrationView(void)
{
- if (InitSoundAndVibrationScrollView() == false)
- {
- return;
- }
- if (InitSoundAndVibrationViewTitleLabel() == false)
- {
- return;
- }
- if (InitSoundAndVibrationButtonView() == false)
- {
- return;
- }
- if (InitSoundAndVibrationToggleButton() == false)
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::CreateSoundAndVibrationView");
+ if (!InitSoundAndVibrationScrollView() || !InitSoundAndVibrationViewTitleLabel() ||
+ !InitSoundAndVibrationButtonView() || !InitSoundAndVibrationToggleButton())
{
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::CreateSoundAndVibrationView fail!!");
return;
}
}
void SoundAndVibrationView::OnStart()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::OnStart");
View::OnStart();
- InitView();
+ SetContainerView(new UIViewGroup());
+ container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ container_->SetOnDragListener(presenter_);
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+
+ CreateSoundAndVibrationView();
+
RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::SoundAndVibrationPresenter::GetInstance();
RootView::GetInstance()->SetOnKeyActListener(keyactListener);
}
void SoundAndVibrationView::OnSetUpView()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::OnSetUpView");
View::OnSetUpView();
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(Title);
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(SystemVolumeButton);
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(CallVolumeButton);
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(VibrationReminderButton);
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(SilentModeButton);
- SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]->Add(SilentModeToggleButton);
- RootView::GetInstance()->Add(SoundAndVibrationScrollView[SOUNDANDVIBRATIONVIEW]);
Draw();
}
void SoundAndVibrationView::OnTearDownView()
{
-
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::OnTearDownView");
View::OnTearDownView();
return;
}
void SoundAndVibrationView::OnStop()
{
-
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::OnStop");
View::OnStop();
RootView::GetInstance()->ClearOnKeyActListener();
- RootView::GetInstance()->ClearFocus();
- RootView::GetInstance()->RemoveAll();
+ ClearAll();
return;
}
- /* -------------------------------------------------------------------------- */
// 声é³ä¸éå¨çé¢
bool SoundAndVibrationView::ChangeSoundAndVibrationView(int16_t thisView)
{
if (SoundAndVibrationScrollView[thisView] == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::ChangeSoundAndVibrationView");
- RootView::GetInstance()->Add(SoundAndVibrationScrollView[thisView]);
+ container_->Add(SoundAndVibrationScrollView[thisView]);
}
return true;
}
@@ -313,7 +302,7 @@ namespace OHOS
return false;
}
SoundAndVibrationScrollView[thisView] = vibrationModeView->VibrationModeViewInit();
- RootView::GetInstance()->Add(SoundAndVibrationScrollView[thisView]);
+ container_->Add(SoundAndVibrationScrollView[thisView]);
}
return true;
}
@@ -351,7 +340,7 @@ namespace OHOS
{
if (hideView > MAX_SOUNDANDVIBRATIONVIEWID)
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessView:: SystemViewId Overstep ones bounds");
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " Overstep ones bounds");
return;
}
SoundAndVibrationScrollView[hideView]->SetVisible(false);
@@ -363,10 +352,21 @@ namespace OHOS
VibrationModeView *SoundAndVibrationView::GetVibrationModeView(void)
{
- if (vibrationModeView != nullptr)
+ return vibrationModeView;
+ }
+
+ //æ´æ°é鳿¨¡å¼å¼å
³ç¶æ
+ bool SoundAndVibrationView::UpdateSilentModeSwitchStatus(void)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::UpdateSilentModeSwitchStatus");
+ if (SilentModeToggleButton == nullptr)
{
- return vibrationModeView;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationView::SilentModeToggleButton is nullptr!!");
+ return false;
}
- return nullptr;
+ SilentModeToggleButton->SetState(SoundAndVibrationModel::GetInstance()->GetSilentModeToggleButtonStatus());
+ SilentModeToggleButton->Invalidate();
+
+ return true;
}
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingView.cpp
index bc6f1e0a2..eea2125ba 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SoundAndVibrationVolumeSettingView.cpp
@@ -2,7 +2,6 @@
#include "soundandvibration/include/SoundAndVibrationVolumeSettingPresenter.h"
#include "wearable_log.h"
#include "ConfigModel.h"
-#include "common/image_cache_manager.h"
namespace OHOS
{
@@ -38,7 +37,6 @@ namespace OHOS
delete VolumeProcess;
VolumeProcess = nullptr;
- ImageCacheManager::GetInstance().UnloadSingleRes(VOLUMECONTROLVECTORIMAGEPATH);
delete VolumeVetor;
VolumeVetor = nullptr;
@@ -69,6 +67,7 @@ namespace OHOS
UIScrollView *SoundAndVibrationVolumeSettingView::SetUpVolumeProcess(void)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SoundAndVibrationVolumeSettingView::SetUpVolumeProcess");
ScrollView = new UIScrollView();
if (ScrollView == nullptr)
{
@@ -105,13 +104,7 @@ namespace OHOS
return nullptr;
}
VolumeVetor->SetPosition(213, 213, 40, 40);
- ImageInfo *imgInfo = ImageCacheManager::GetInstance().LoadSingleRes(VOLUMECONTROLVECTORIMAGEPATH);
- if (imgInfo == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Load image failed!");
- return nullptr;
- }
- VolumeVetor->SetSrc(imgInfo);
+ VolumeVetor->SetSrc(VOLUMECONTROLVECTORIMAGEPATH);
if (listener == nullptr)
{
@@ -130,6 +123,7 @@ namespace OHOS
ScrollView->Add(VolumeProcess);
ScrollView->Add(VolumeVetor);
initViewStatus = true;
+
return ScrollView;
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp
index fd140561c..434b29266 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-03-30 09:14:38
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-19 14:53:24
+ * @LastEditTime: 2024-06-19 18:58:05
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumePresenter.cpp
* @Description: è¿æ¯é»è®¤è®¾ç½®,请设置`customMade`, æå¼koroFileHeaderæ¥çé
ç½® è¿è¡è®¾ç½®: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@@ -17,6 +17,7 @@
#include "common/key_code.h"
#include "custom_utils.h"
#include
+#include
// ç³»ç»é³é
namespace OHOS
@@ -70,7 +71,11 @@ namespace OHOS
bool SystemVolumePresenter::OnDrag(UIView &view, const DragEvent &event)
{
UNUSED(view);
- UNUSED(event);
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumePresenter::OnDrag");
+ if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // æå¨è¿ç¨ä¸å¤ææ¯å¦æ¯æ°´å¹³æ»å¨
+ {
+ SystemVolumePresenter::X_DRAG_FLAG = true;
+ }
return true;
}
@@ -78,9 +83,10 @@ namespace OHOS
{
UNUSED(view);
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumePresenter::OnDragEnd");
- if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
+ if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && SystemVolumePresenter::X_DRAG_FLAG)
{
NativeAbility::GetInstance().Back();
+ SystemVolumePresenter::X_DRAG_FLAG = false;
}
return true;
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp
index f34c8758e..8b4a5674b 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp
@@ -1,3 +1,10 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-06-12 11:44:04
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-19 18:21:36
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/SystemVolumeView.cpp
+ */
#include "soundandvibration/include/SystemVolumeView.h"
#include "soundandvibration/include/SystemVolumePresenter.h"
#include "wearable_log.h"
@@ -22,7 +29,6 @@ namespace OHOS
SystemVolumeView::~SystemVolumeView()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::~SystemVolumeView");
- ClearAll();
g_pSystemVolumeView = nullptr;
}
@@ -35,6 +41,13 @@ namespace OHOS
{
if (initViewStatus == true)
{
+ if (container_ != nullptr)
+ {
+ container_->RemoveAll();
+ delete container_;
+ container_ = nullptr;
+ }
+
delete p_SoundAndVibrationVolumeSettingView;
p_SoundAndVibrationVolumeSettingView = nullptr;
}
@@ -42,6 +55,7 @@ namespace OHOS
UIScrollView *SystemVolumeView::SystemVolumeViewInit(void)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::SystemVolumeViewInit");
p_SoundAndVibrationVolumeSettingView = new SoundAndVibrationVolumeSettingView(SYSTEM_VOLUME);
if (p_SoundAndVibrationVolumeSettingView == nullptr)
{
@@ -55,56 +69,67 @@ namespace OHOS
return nullptr;
}
- UIView::OnDragListener *volumeDragListener = static_cast(SystemVolumePresenter::GetInstance());
- if (volumeDragListener == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RecordingPresenter GetInstance fail");
- return nullptr;
- }
- SystemVolumeScrollView->SetOnDragListener(volumeDragListener);
- if (SystemVolumeScrollView == nullptr)
- {
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "p_SoundAndVibrationVolumeSettingView->SetUpVolumeProcess fail!!");
- return nullptr;
- }
-
- // p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(Audio::AudioManager::GetInstance().GetVolume(AUDIO_STREAM_MUSIC));
- // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolume = %d", Audio::AudioManager::GetInstance().GetVolume(AUDIO_STREAM_MUSIC));
-
- int systemVolume = ConfigModel::GetInstance()->GetSystemVolume();
- p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(systemVolume);
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolume = %d", systemVolume);
-
- initViewStatus = true;
return SystemVolumeScrollView;
}
void SystemVolumeView::OnStart()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::OnStart");
View::OnStart();
- SystemVolumeViewInit();
- RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::SystemVolumePresenter::GetInstance();
- RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+ SetContainerView(new UIViewGroup());
+ container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+ container_->SetOnDragListener(presenter_);
+
+ if (!initViewStatus)
+ {
+ SystemVolumeViewInit();
+ initViewStatus = true;
+ }
+ UpdateSystemVolumeSliderValue();
+
+ RootView::GetInstance()->SetOnKeyActListener(presenter_);
+ return;
}
void SystemVolumeView::OnSetUpView()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::OnSetUpView");
View::OnSetUpView();
- RootView::GetInstance()->Add(SystemVolumeScrollView);
+ container_->Add(SystemVolumeScrollView);
Draw();
+ return;
}
void SystemVolumeView::OnTearDownView()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::OnTearDownView");
View::OnTearDownView();
return;
}
void SystemVolumeView::OnStop()
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SystemVolumeView::OnStop");
View::OnStop();
RootView::GetInstance()->ClearOnKeyActListener();
- RootView::GetInstance()->RemoveAll();
+ ClearAll();
return;
}
+
+ // æ´æ°ç³»ç»é³éæ¡çå¼
+ bool SystemVolumeView::UpdateSystemVolumeSliderValue(void)
+ {
+ if (p_SoundAndVibrationVolumeSettingView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallVolumeView::p_SoundAndVibrationVolumeSettingView is nullptr!");
+ return false;
+ }
+ int systemVolume = ConfigModel::GetInstance()->GetSystemVolume();
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemVolume = %d", systemVolume);
+ p_SoundAndVibrationVolumeSettingView->GetVolumeProcess()->SetValue(systemVolume);
+
+ return true;
+ }
}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/VibrationModeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/VibrationModeView.cpp
index 107a5c775..a78fb825e 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/VibrationModeView.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/VibrationModeView.cpp
@@ -2,17 +2,20 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-04-22 14:35:22
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-04-30 18:08:26
+ * @LastEditTime: 2024-06-19 15:31:31
* @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/soundandvibration/src/VibrationModeView.cpp
*/
#include "soundandvibration/include/VibrationModeView.h"
#include "soundandvibration/include/SoundAndVibrationPresenter.h"
#include "wearable_log.h"
#include "ConfigModel.h"
-
+#include "language/font/ui_resource_string.h"
+#include
namespace OHOS
{
+ static constexpr uint8_t ROTATEFACTOR = 2;
+
static VibrationModeView *g_pVibrationModeView{nullptr};
VibrationModeView::VibrationModeView()
@@ -47,6 +50,7 @@ namespace OHOS
if (VibrationModePicker != nullptr)
{
+ VibrationModePicker->ClearFocus();
delete VibrationModePicker;
VibrationModePicker = nullptr;
}
@@ -66,6 +70,7 @@ namespace OHOS
{
if (scrollView == nullptr)
{
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VibrationModeView::VibrationModeViewInit");
scrollView = new UIScrollView();
if (scrollView == nullptr)
{
@@ -74,6 +79,7 @@ namespace OHOS
}
scrollView->SetPosition(0, 0, 466, 466);
scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0);
+ scrollView->SetViewId(VIBRATION_MODE_VIEWID);
UIView::OnDragListener *dragListener = static_cast(SoundAndVibrationPresenter::GetInstance());
if (dragListener == nullptr)
{
@@ -91,10 +97,9 @@ namespace OHOS
Title->SetPosition(93, 52, 280, 40);
Title->SetStyle(STYLE_TEXT_FONT, 30);
Title->SetStyle(STYLE_LINE_HEIGHT, 35);
- Title->SetText("é卿¨¡å¼");
+ Title->SetTextId(STR_VIBRATION_MODE); // é卿¨¡å¼
Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- Title->SetRollSpeed(40);
Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
scrollView->Add(Title);
/* -------------------------------------------------------------------------- */
@@ -116,7 +121,7 @@ namespace OHOS
UIView::OnRotateListener *RotateListener = static_cast(SoundAndVibrationPresenter::GetInstance());
VibrationModePicker->SetOnRotateListener(RotateListener);
// å¢å è¡¨å æ§å¶
- VibrationModePicker->SetRotateFactor(2);
+ VibrationModePicker->SetRotateFactor(ROTATEFACTOR);
VibrationModePicker->RequestFocus();
/* -------------------------------------------------------------------------- */
const char *translations[][4] = {
@@ -163,10 +168,8 @@ namespace OHOS
return nullptr;
}
VibrationModeLabelButton->SetPosition(0, 366, 466, 100);
- VibrationModeLabelButton->SetViewId("labelButton1");
- const char *ImgSrc = "/user/res/466x100button.bin";
- VibrationModeLabelButton->SetImageSrc(ImgSrc, ImgSrc);
- VibrationModeLabelButton->SetText("ç¡®å®");
+ VibrationModeLabelButton->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE);
+ VibrationModeLabelButton->SetTextId(STR_OK); // ç¡®å®
VibrationModeLabelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
VibrationModeLabelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
VibrationModeLabelButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
@@ -180,28 +183,31 @@ namespace OHOS
UIScrollView *VibrationModeView::GetVibrationModeScrollView(void)
{
- if (scrollView != nullptr)
- {
- return scrollView;
- }
- return nullptr;
+ return scrollView;
}
UILabelButtonExt *VibrationModeView::GetVibrationModeLabelButton(void)
{
- if (VibrationModeLabelButton != nullptr)
- {
- return VibrationModeLabelButton;
- }
- return nullptr;
+ return VibrationModeLabelButton;
}
UIPicker *VibrationModeView::GetVibrationModePicker(void)
{
- if (VibrationModePicker != nullptr)
+ return VibrationModePicker;
+ }
+
+ // æ´æ°é卿¨¡å¼éæ©å¨çéå®é¡¹çç´¢å¼
+ bool VibrationModeView::UpdatePickerSelectIndex(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VibrationModeView::UpdatePickerSelectIndex");
+ if (VibrationModePicker == nullptr)
{
- return VibrationModePicker;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VibrationModeView::VibrationModePicker is nullptr!");
+ return false;
}
- return nullptr;
+ VibrationModePicker->SetSelected(ConfigModel::GetInstance()->GetVibrationReminder());
+ VibrationModePicker->Invalidate();
+
+ return true;
}
}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h b/code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h
index aa90494b0..a923a9f98 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h
+++ b/code/sdk/application/wearable/fd230app/nativeui/uiservice/include/ui_service.h
@@ -2,7 +2,7 @@
* @Author: luozheng 1732036298@qq.com
* @Date: 2024-06-12 11:44:04
* @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-06-19 10:36:53
+ * @LastEditTime: 2024-06-19 17:49:51
* @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/uiservice/include/ui_service.h
*/
/*
@@ -63,6 +63,10 @@ typedef enum {
UI_UPDATE_SCREEN_DURATION, //æ´æ°äº®å±æ¶é¿
UI_UPDATE_RAISETOBRIGHTNESS,//æ´æ°æ¬è
亮å±
UI_UPDATE_BRIGHTNESS_VALUE, //æ´æ°äº®åº¦å¼
+ UI_UPDATE_SYSTEM_VOLUME, //æ´æ°ç³»ç»é³é
+ UI_UPDATE_CALL_VOLUME, //æ´æ°éè¯é³é
+ UI_UPDATE_VIBRATION_MODE, //æ´æ°é卿¨¡å¼
+ UI_UPDATE_SILENT_MODE, //æ´æ°é鳿¨¡å¼
UI_UPDATE_WEATHER_DATA, //å¤©æ°æ°æ®æ´æ°
MAX_NUM_HANDLER,
diff --git a/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp b/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp
index 79402f363..968407092 100644
--- a/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp
+++ b/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp
@@ -17,6 +17,7 @@
#include
#include
#include "displaybrightness/include/DisplayBrightnessModel.h"
+#include "soundandvibration/include/SoundAndVibrationModel.h"
#include "weather/include/WeatherModel.h"
#include "uiservice/include/ui_service.h"
#include "wearable_log.h"
@@ -96,6 +97,10 @@ static void HandleUpdateScreenDuration(Request *request);
static void HandleUpdateRaiseToBrightness(Request *request);
static void HandleUpdateBrightnessValue(Request *request);
static void HandleUpdateWeatherData(Request *request);
+static void HandleUpdateSystemVolume(Request *request);
+static void HandleUpdateCallVolume(Request *request);
+static void HandleUpdateVibrationMode(Request *request);
+static void HandleUpdateSilentMode(Request *request);
// æ¶æ¯å¤çç¨åºé¡¹æ°ç»(æ¯ä¸ªæ¶æ¯ç±»å对åºä¸ä¸ªå¤ç彿°ï¼å½æ°å以 Handle å¼å¤´)
MsgHandlerEntry msgHandlers[] = {
@@ -116,6 +121,10 @@ MsgHandlerEntry msgHandlers[] = {
{UI_UPDATE_RAISETOBRIGHTNESS, HandleUpdateRaiseToBrightness},
{UI_UPDATE_BRIGHTNESS_VALUE, HandleUpdateBrightnessValue},
{UI_UPDATE_WEATHER_DATA, HandleUpdateWeatherData},
+ {UI_UPDATE_SYSTEM_VOLUME, HandleUpdateSystemVolume},
+ {UI_UPDATE_CALL_VOLUME, HandleUpdateCallVolume},
+ {UI_UPDATE_VIBRATION_MODE, HandleUpdateVibrationMode},
+ {UI_UPDATE_SILENT_MODE, HandleUpdateSilentMode},
};
/* -------------------------------------------------------------------------- */
static void ScreenTurnOn(Request *request)
@@ -456,6 +465,38 @@ static void HandleUpdateWeatherData(Request *request)
GraphicService::GetInstance()->PostGraphicEvent(
std::bind(&OHOS::WeatherModel::UpdateMainWeatherData, &OHOS::WeatherModel::GetInstance()));
}
+
+//å¤çæ´æ°ç³»ç»é³é
+void HandleUpdateSystemVolume(Request *request)
+{
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_UI_SERVICE, "HandleUpdateSystemVolume");
+ GraphicService::GetInstance()->PostGraphicEvent(
+ std::bind(&OHOS::SoundAndVibrationModel::UpdateSystemVolume, OHOS::SoundAndVibrationModel::GetInstance()));
+}
+
+//å¤çæ´æ°éè¯é³é
+void HandleUpdateCallVolume(Request *request)
+{
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_UI_SERVICE, "HandleUpdateCallVolume");
+ GraphicService::GetInstance()->PostGraphicEvent(
+ std::bind(&OHOS::SoundAndVibrationModel::UpdateCallVolume, OHOS::SoundAndVibrationModel::GetInstance()));
+}
+
+//å¤çæ´æ°é卿¨¡å¼
+void HandleUpdateVibrationMode(Request *request)
+{
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_UI_SERVICE, "HandleUpdateVibrationMode");
+ GraphicService::GetInstance()->PostGraphicEvent(
+ std::bind(&OHOS::SoundAndVibrationModel::UpdateVibrationModePickerSelectIndex, OHOS::SoundAndVibrationModel::GetInstance()));
+}
+
+//å¤çæ´æ°é鳿¨¡å¼
+void HandleUpdateSilentMode(Request *request)
+{
+ WEARABLE_LOGI(WEARABLE_LOG_MODULE_UI_SERVICE, "HandleUpdateSilentMode");
+ GraphicService::GetInstance()->PostGraphicEvent(
+ std::bind(&OHOS::SoundAndVibrationModel::UpdateSilentModeSwitch, OHOS::SoundAndVibrationModel::GetInstance()));
+}
/* -------------------------------------------------------------------------- */
#ifdef __cplusplus
}
diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
index 42d46dc9b..f4f20be0e 100644
--- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
+++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
@@ -703,17 +703,19 @@ int get_goal_standupcount(void)
return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STANDUP_TIMES);
}
-void set_vibrationremiander(uint8_t falg)
+void set_vibrationremiander(uint8_t falg)//设置é卿¨¡å¼
{
OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance();
p_ConfigModel->SetVibrationReminder(falg);
+ SendMsgToUIService(UI_UPDATE_VIBRATION_MODE,0,nullptr,0);
return ;
}
-void set_SilentMode(uint8_t falg)
+void set_SilentMode(uint8_t falg)//设置é鳿¨¡å¼
{
OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance();
p_ConfigModel->SetSilentMode(falg);
+ SendMsgToUIService(UI_UPDATE_SILENT_MODE,0,nullptr,0);
return;
}
/*设置èªå¨è·å宿¶æ°æ®å¼å
³*/
@@ -802,6 +804,7 @@ void Set_SystemVolume(int value) //设置系ç»é³é
{
OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance();
p_ConfigModel->SetSystemVolume(value);
+ SendMsgToUIService(UI_UPDATE_SYSTEM_VOLUME,0,nullptr,0);
return;
}
@@ -811,14 +814,15 @@ int Get_SystemVolume(void) //è·åç³»ç»é³é
return p_ConfigModel->GetSystemVolume();
}
-void Set_CallVolume(int value) //设置é声ååªä½é³é
+void Set_CallVolume(int value) //设置éè¯é³é
{
OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance();
p_ConfigModel->SetCallVolume(value);
+ SendMsgToUIService(UI_UPDATE_CALL_VOLUME,0,nullptr,0);
return;
}
-int Get_CallVolume(void) //è·åé声ååªä½é³é
+int Get_CallVolume(void) //è·åéè¯é³é
{
OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance();
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang
index 7dc97fa77e8813929b31f524f7ce7bbf398b185f..8b36d0d4464d3e760958754e6ae4b633aa15ce77 100644
GIT binary patch
delta 39
jcmZp3>vj{ZH2d9|n#X_wZf+D!WM`bPxtM*jG$R85$T$ft
delta 35
fcmeBnYjYEw62$o;HID%W+}J3Z$iBIXeS$Oqn(zoh
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ja.lang
index 29e8216b3743d0b71e74a6aafa8cde8da37b4897..527f904b70d93e629dbf0d5f653d3a5730c9574e 100644
GIT binary patch
delta 39
jcmaEA@ybH9GN{}uE0F;O+}tRd$j|8&sPc8
delta 35
fcmaE5@zg@p!1!2NRw4rmxUo?*k$rO&`+E@ps6Pno
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
index 0769074ff..eb9eee311 100644
--- a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
+++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
@@ -482,7 +482,8 @@ enum UIResourceTextId : uint16_t {
STR_SUN = 469,
STR_RECORDING_LIST = 470,
STR_CRLEMPTY = 471,
- STR_MAX_ID = 472,
+ STR_CALL_VOLUME = 472,
+ STR_MAX_ID = 473,
}; // UIResourceTextId
enum FontLanguageId : uint8_t {
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang
index 22553ae6f778771b71fc0ab8b21e4453b16081b7..7ed341fb0fc1526b7e2dd80057fbd6611fec7b74 100644
GIT binary patch
delta 52
xcmZp1o$4yOWl5t;RR#kJxVcd@k)4T8dUFZ8fHd#RhFLGx&wV+6^UL;r1^{nG5WxTd
delta 35
fcmbR0+TtoYo4>oQDuV$9+}J3Z$iBIXolhD7nQsTV
--
2.17.1