From: luozheng <1732036298@qq.com> Date: Wed, 7 Aug 2024 08:14:01 +0000 (+0800) Subject: 音乐播放器的声音视图优化修改 X-Git-Tag: release_V1.2.70_20241020_135402~693 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=3baa39391e7dba1872a254c6164d1e12b41c4de7;p=mirrors%2FFD230.git 音乐播放器的声音视图优化修改 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h index 1076ee794..bccd376ed 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-05 15:20:02 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-06 16:26:51 + * @LastEditTime: 2024-08-07 15:25:29 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/include/VolumeSettingView.h */ @@ -38,6 +38,7 @@ private: UISlider *progress{nullptr}; UIButton *increaseButton{nullptr}; UIButton *decreaseButton{nullptr}; + UIImageView *VolumeVetor{nullptr}; int ShowVolume(); }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingView.cpp index 89e2da827..44dd657e5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/VolumeSettingView.cpp @@ -15,10 +15,10 @@ static constexpr uint16_t BUTTON_Y = 0; static constexpr uint16_t BUTTON_Y2 = 363; static constexpr uint16_t BUTTON_WIDTH = 90; static constexpr uint16_t BUTTON_HEIGHT = 90; -static constexpr uint16_t SLIDER_X = 207; -static constexpr uint16_t SLIDER_Y = 90; -static constexpr uint16_t SLIDER_WIDTH = 40; -static constexpr uint16_t SLIDER_HEIGHT = 274; +static constexpr uint16_t SLIDER_X = 167; +static constexpr uint16_t SLIDER_Y = 77; +static constexpr uint16_t SLIDER_WIDTH = 130; +static constexpr uint16_t SLIDER_HEIGHT = 310; constexpr uint16_t VOLUME_OK = 0; constexpr int16_t VOLUME_ERROR = (-1); @@ -36,14 +36,23 @@ VolumeSettingView::~VolumeSettingView() delete listener; listener = nullptr; } - delete increaseButton; - increaseButton = nullptr; - - delete decreaseButton; - decreaseButton = nullptr; - - delete progress; - progress = nullptr; + if(increaseButton) { + delete increaseButton; + increaseButton = nullptr; + } + if(decreaseButton) { + delete decreaseButton; + decreaseButton = nullptr; + } + if(VolumeVetor!=nullptr) + { + delete VolumeVetor; + VolumeVetor = nullptr; + } + if(progress!=nullptr){ + delete progress; + progress = nullptr; + } } bool VolumeSettingView::SetUpVolume(void) @@ -65,6 +74,23 @@ bool VolumeSettingView::SetUpVolume(void) progress->SetDirection(UISlider::Direction::DIR_BOTTOM_TO_TOP); progress->SetViewId(VOLUME_PROGRESS); progress->SetRange(VOLUME_MAX, VOLUME_MIN); + progress->SetStyle(STYLE_BORDER_RADIUS, 100); + progress->SetBackgroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + progress->SetForegroundStyle(STYLE_LINE_CAP, CapType::CAP_ROUND); + progress->SetSliderColor(Color::GetColorFromRGBA(0x19, 0x19, 0x19, 0xff), Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff)); + progress->SetForegroundStyle(STYLE_BACKGROUND_OPA, 0xff); + progress->RequestFocus(); + progress->SetRotateFactor(1.0); + + VolumeVetor = new UIImageView(); + if (VolumeVetor == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VolumeVetor new fail"); + return false; + } + VolumeVetor->SetPosition(213, 213, 40, 40); + VolumeVetor->SetSrc("/user/res/VolumeControlVector.bin"); + if (listener == nullptr) { listener = new VolumeSliderEventListener(this); @@ -82,6 +108,7 @@ bool VolumeSettingView::SetUpVolume(void) SetDraggable(true); SetTouchable(true); Add(progress); + Add(VolumeVetor); ShowVolume(); return true; @@ -118,6 +145,7 @@ int VolumeSettingView::ShowVolume(void) increaseButton->SetImageSrc(image, image); increaseButton->SetOnClickListener(listener); Add(increaseButton); + increaseButton->SetVisible(false); if (decreaseButton == nullptr) { decreaseButton = new UIButton(); @@ -131,6 +159,7 @@ int VolumeSettingView::ShowVolume(void) image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_DECREASE_BUTTON, PLAYER_IAMGES); decreaseButton->SetImageSrc(image, image); decreaseButton->SetOnClickListener(listener); + decreaseButton->SetVisible(false); Add(decreaseButton); return VOLUME_OK;