From: luozheng <1732036298@qq.com> Date: Tue, 27 Feb 2024 09:54:23 +0000 (+0800) Subject: 将快速访问Slice改成辅助功能的subview X-Git-Tag: release_V1.2.70_20241020_135402~1298^2~7 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=0c95c60c787eff86e90f757505dcc06a7fbc2404;p=mirrors%2FFD230.git 将快速访问Slice改成辅助功能的subview --- diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index d6b10dc4a..d9eca50d7 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -284,8 +284,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/secondaryfunction/src/FastTrainingAttentionPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/secondaryfunction/src/FastTrainingAttentionView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/secondaryfunction/src/FastTrainingPresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/secondaryfunction/src/FastTrainingView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/secondaryfunction/src/QuickAccessPresenter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/secondaryfunction/src/FastTrainingView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/secondaryfunction/src/QuickAccessView.cpp #指南针 diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h index 9b8eef279..dd0ba2ca1 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h @@ -52,7 +52,6 @@ typedef enum : uint16_t VIEW_MEDIA_VOLUME, // 媒体音量 VIEW_DISPLAY_BRIGHTNESS, // 屏幕与亮度 VIEW_SECONDARY_FUNCTION, // 辅助功能 - VIEW_QUICK_ACCESS, // 快速访问 VIEW_FAST_TRAINING, // 快速训练 VIEW_FAST_TRAINING_ATTENTION, // 快速训练项目选择超出提示 /* ----------------------------------- 录音 ----------------------------------- */ diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h index 24090b028..538454cce 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h @@ -60,7 +60,6 @@ namespace OHOS void InitDialUpdateSlice(void); /* -------------------------------------------------------------------------- */ void InitSecondaryFunction(void); - void InitQuickAccessSlice(void); void InitFastTrainingSlice(void); void InitFastTrainingAttentionSlice(void); diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index 157899250..ad5a1c776 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -92,8 +92,6 @@ #include "secondaryfunction/include/FastTrainingView.h" #include "secondaryfunction/include/FastTrainingAttentionPresenter.h" #include "secondaryfunction/include/FastTrainingAttentionView.h" -#include "secondaryfunction/include/QuickAccessPresenter.h" -#include "secondaryfunction/include/QuickAccessView.h" #include "classicbluetooth/include/ClassicBlueToothPresenter.h" #include "classicbluetooth/include/ClassicBlueToothView.h" @@ -164,7 +162,6 @@ namespace OHOS {VIEW_CLASSIC_BLUETOOTH, &NativeLauncher::InitClassicBluetoothSlice}, // 经典蓝牙slice {VIEW_DISPLAY_BRIGHTNESS, &NativeLauncher::InitDisplayBrightnessSlice}, // 显示与亮度的实例化地址 {VIEW_SECONDARY_FUNCTION, &NativeLauncher::InitSecondaryFunction}, - {VIEW_QUICK_ACCESS, &NativeLauncher::InitQuickAccessSlice}, // 快速访问实例化地址 {VIEW_FAST_TRAINING, &NativeLauncher::InitFastTrainingSlice}, {VIEW_FAST_TRAINING_ATTENTION, &NativeLauncher::InitFastTrainingAttentionSlice}, @@ -584,16 +581,6 @@ namespace OHOS NativeAbility::GetInstance().AddSliceProxy(VIEW_SECONDARY_FUNCTION, secondaryfunction); } - void NativeLauncher::InitQuickAccessSlice(void) // 快速访问 - { - SliceProxy *QuickAccess = new AbilitySliceProxy; - if (QuickAccess == nullptr) - { - return; - } - NativeAbility::GetInstance().AddSliceProxy(VIEW_QUICK_ACCESS, QuickAccess); - } - void NativeLauncher::InitFastTrainingSlice(void) { SliceProxy *fasttraining = new AbilitySliceProxy; diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/QuickAccessPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/QuickAccessPresenter.h deleted file mode 100644 index 100e17357..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/QuickAccessPresenter.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef QUICK_ACCESS_PRESENTER_H -#define QUICK_ACCESS_PRESENTER_H - -#include "Presenter.h" - -#include "QuickAccessView.h" - -namespace OHOS -{ - class QuickAccessView; - - class QuickAccessPresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener - { - public: - QuickAccessPresenter(); - virtual ~QuickAccessPresenter(); - - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; - - static QuickAccessPresenter *GetInstance(); - - private: - //因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView &view, const DragEvent &event) override; - }; -} //namespace OHOS - - - - - - -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/QuickAccessView.h b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/QuickAccessView.h index 4a9dc391c..937315ead 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/QuickAccessView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/QuickAccessView.h @@ -3,48 +3,68 @@ #include "BaseView.h" #include "View.h" - -#include "components/ui_view_group.h" #include "components/ui_scroll_view.h" #include "components/ui_image_view.h" #include "components/ui_label.h" -#include "components/ui_checkbox.h" +#include "components/ui_radio_button.h" +#include "wearable_log.h" namespace OHOS { - static const char *HEART_RATE_DETECTION = "HeartRateDetectionCheckBox"; //心率检测 - static const char *BLOOD_OXYGEN_MONITOR = "BloodOxygenMonitoringCheckBox"; //血氧检测 + static const char *HEART_RATE_DETECTION = "HeartRateDetectionCheckBox"; // 心率检测 + static const char *BLOOD_OXYGEN_MONITOR = "BloodOxygenMonitoringCheckBox"; // 血氧检测 - class QuickAccessPresenter; - class QuickAccessView : public View + class QuickAccessView { - public: + struct ImageConfig + { + int16_t x; + int16_t y; + int16_t w; + int16_t h; + const char *ImageSrc; + }; + struct LabelConfig + { + int16_t left; + int16_t top; + int16_t width; + int16_t height; + int16_t fontSize; // 字体大小 + int16_t lineHeigh; // 行高 + const char *text; // 文本 + uint8_t lineBreakMode; // 断行模式。 + }; + struct RadioButtonConfig + { + int16_t x; + int16_t y; + int16_t w; + int16_t h; + const char *viewId; + const char *select; + const char *unselect; + }; QuickAccessView(); virtual ~QuickAccessView(); static QuickAccessView *GetInstance(void); - - void OnStart() override; - void OnSetUpView() override; - void OnTearDownView() override; - void OnStop() override; - - private: - void InitView(void); - void DeInitView(void); - + UIScrollView *QuickAccessViewInit(void); + void ClearAll(void); + UIRadioButton * GetRadioButton(int i); private: - UIViewGroup *container_ = nullptr; + bool QuickAccessScrollViewInit(void); + bool QuickAccessLabelInit(void); + bool QuickAccessImageViewInit(void); + bool QuickAccessRadioButtonInit(void); + UIImageView *SetUpImageView(ImageConfig &imageconfig); // 设置图片 + UILabel *SetUpLabel(LabelConfig &labelconfig); // 设置标签 + UIRadioButton *SetUpRadioButton(RadioButtonConfig &radiobuttonconfig); // 设置单选框 UIScrollView *QuickAccessScrollView = nullptr; - UIImageView *image1 = nullptr; - UILabel *QuickAccessLabel = nullptr; - UIImageView *image2 = nullptr; - UILabel *label = nullptr; - UIImageView *HeartRateDetectionImage = nullptr; - UICheckBox *HeartRateDetectionCheckBox = nullptr; - UILabel *HeartRateDetectionLabel = nullptr; - UIImageView *BloodOxygenMonitoringImage = nullptr; - UICheckBox *BloodOxygenMonitoringCheckBox = nullptr; - UILabel *BloodOxygenMonitoringLabel = nullptr; + UILabel *QuickAccessLabel[4]{nullptr}; + UIImageView *QuickAccessImageView[2]{nullptr}; + UIRadioButton *QuickAccessRadioButton[2]{nullptr}; + UICheckBox::OnChangeListener *ChangeLister[2]{nullptr}; + bool initViewStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionPresenter.h index 47e3673bc..d4247532a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionPresenter.h @@ -2,14 +2,36 @@ #define SECONDARY_FUNCTION_PRESENTER_H #include "Presenter.h" - #include "SecondaryFunctionView.h" - namespace OHOS { + typedef enum + { + SECONDARYFUNCTIONVIEW = 0, // 辅助功能视图(slice) + QUICKACCESSVIEW, // 快速访问视图(subView) + // FASTTRAININGVIEW, // 快速训练视图(subView) + MAX_SECONDARYFUNCTIONVIEWID, + } SECONDARYFUNCTIONVIEWID; + static const char *SECONDARY_FUNCTION_QUICK_ACCESS_BUTTON = "SECONDARY_FUNCTION_QUICK_ACCESS_BUTTON"; // 快速访问 static const char *SECONDARY_FUNCTION_FAST_TRAINING_BUTTON = "SECONDARY_FUNCTION_FAST_TRAINING_BUTTON"; // 快速训练 + + class QuickAccessRadioButtonChangeLister : public UICheckBox::OnChangeListener + { + public: + QuickAccessRadioButtonChangeLister(UIView *view) + { + m_view = view; + } + ~QuickAccessRadioButtonChangeLister() {} + + bool OnChange(UICheckBox::UICheckBoxState state) override; + + private: + UIView *m_view{nullptr}; + }; + class SecondaryFunctionView; class SecondaryFunctionPresenter : public Presenter, public UIView::OnClickListener, diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionView.h b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionView.h index 7fd4473a5..84678ee76 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionView.h @@ -8,6 +8,7 @@ #include "components/ui_image_view.h" #include "components/ui_button.h" #include "wearable_log.h" +#include "secondaryfunction/include/QuickAccessView.h" namespace OHOS { class SecondaryFunctionPresenter; @@ -37,6 +38,12 @@ namespace OHOS SecondaryFunctionView(); virtual ~SecondaryFunctionView(); static SecondaryFunctionView *GetInstance(void); + bool ChangeSecondaryFunctionView(int16_t thisView); + bool ChangeQuickAccessView(int16_t thisView); + bool ClickFunc(int16_t interface); + void ChangeView(int16_t hideView, int16_t showView); + QuickAccessView *GetQuickAccessView(void); + UIScrollView *GetSecondaryFunctionScrollView(int i); void OnStart() override; void OnSetUpView() override; @@ -52,13 +59,14 @@ namespace OHOS bool SecondaryFunctionScrollImageInit(void); UIImageView *SetUpImageView(ImageConfig &imageconfig); // 设置图片 UILabel *SetUpLabel(LabelConfig &labelconfig); // 设置标签 - UIScrollView *SecondaryFunctionScrollView{nullptr}; + UIScrollView *SecondaryFunctionScrollView[2]{nullptr}; UILabel *SecondaryFunctionScrollTitleLabel{nullptr}; // 标题 UILabel *QuickAccessLabel{nullptr}; // 快速访问 UILabel *FastTrainingLabel{nullptr}; // 快速训练 UIButton *QuickAccessButton{nullptr}; UIButton *FastTrainingButton{nullptr}; UIImageView *Image[2]{nullptr}; + QuickAccessView *p_QuickAccessView{nullptr}; bool initViewStatus{false}; }; } // namespace OHOS diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/QuickAccessPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/QuickAccessPresenter.cpp deleted file mode 100644 index c2b25c16f..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/QuickAccessPresenter.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "AppViewIDs.h" -#include "NativeAbility.h" -#include "graphic_math.h" -#include "string.h" - -#include "secondaryfunction/include/QuickAccessPresenter.h" - -namespace OHOS -{ - - // 当前Presenter属性实例化的内存指针 - static QuickAccessPresenter *g_pQuickAccessPresenter = nullptr; - - QuickAccessPresenter::QuickAccessPresenter() - { - - g_pQuickAccessPresenter = this; - } - - QuickAccessPresenter::~QuickAccessPresenter() - { - - g_pQuickAccessPresenter = nullptr; - } - - QuickAccessPresenter *QuickAccessPresenter::GetInstance() - { - - return g_pQuickAccessPresenter; - } - - void QuickAccessPresenter::OnStart() - { - - Presenter::OnStart(); - } - - void QuickAccessPresenter::OnPause(void) - { - - Presenter::OnPause(); - } - - void QuickAccessPresenter::OnResume(void) - { - - Presenter::OnResume(); - } - - void QuickAccessPresenter::OnStop(void) - { - - Presenter::OnStop(); - } - - bool QuickAccessPresenter::OnDrag(UIView &view, const DragEvent &event) - { - UNUSED(view); - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && - (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY())))) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_SECONDARY_FUNCTION); - return true; - } - return false; - } - - bool QuickAccessPresenter::OnClick(UIView &view, const ClickEvent &event) - { - UNUSED(event); - // 根据控件id查找是哪个控件触发了点击回调 - if (strcmp(view.GetViewId(), HEART_RATE_DETECTION) == 0) - { - - return true; - } - else if(strcmp(view.GetViewId(), BLOOD_OXYGEN_MONITOR) == 0) - { - - return true; - } - return false; - } -} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/QuickAccessView.cpp b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/QuickAccessView.cpp index d2c7e2ffb..9d38d7630 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/QuickAccessView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/QuickAccessView.cpp @@ -1,7 +1,5 @@ -#include "UiConfig.h" - #include "secondaryfunction/include/QuickAccessView.h" -#include "secondaryfunction/include/QuickAccessPresenter.h" +#include "secondaryfunction/include/SecondaryFunctionPresenter.h" namespace OHOS { @@ -9,314 +7,234 @@ namespace OHOS QuickAccessView::QuickAccessView() { - + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QuickAccessView::QuickAccessView"); g_pQuickAccessView = this; } QuickAccessView::~QuickAccessView() { - DeInitView(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QuickAccessView::~QuickAccessView"); + ClearAll(); g_pQuickAccessView = nullptr; } QuickAccessView *QuickAccessView::GetInstance() { - return g_pQuickAccessView; } - void QuickAccessView::InitView(void) + void QuickAccessView::ClearAll(void) { - if (container_ == nullptr) + if (initViewStatus == true) { - container_ = new UIViewGroup(); - container_->SetPosition(0, 0, 466, 466); - container_->SetStyle(STYLE_BACKGROUND_OPA, 0); - UIView::OnDragListener *draglistener = static_cast(QuickAccessPresenter::GetInstance()); - if (draglistener == nullptr) + QuickAccessScrollView->RemoveAll(); + + // 循环删除 UILabel 指针数组 + for (int i = 0; i < 4; i++) { - return; + delete QuickAccessLabel[i]; + QuickAccessLabel[i] = nullptr; } - container_->SetOnDragListener(draglistener); - container_->SetTouchable(true); - container_->SetDraggable(true); - } - /***********************************************************************************************************/ - // Add QuickAccessScrollView to App - if (QuickAccessScrollView == nullptr) - { - QuickAccessScrollView = new UIScrollView(); + + // 循环删除 UIImageView 和 UIRadioButton指针数组 + for (int i = 0; i < 2; i++) + { + delete QuickAccessImageView[i]; + QuickAccessImageView[i] = nullptr; + + delete ChangeLister[i]; + ChangeLister[i] = nullptr; + + delete QuickAccessRadioButton[i]; + QuickAccessRadioButton[i] = nullptr; + } + + delete QuickAccessScrollView; + QuickAccessScrollView = nullptr; } - QuickAccessScrollView->SetPosition(0, 0); - QuickAccessScrollView->Resize(466, 466); - QuickAccessScrollView->SetViewId("QuickAccessScrollView"); - QuickAccessScrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - // Add to rootView - container_->Add(QuickAccessScrollView); - QuickAccessScrollView->SetVisible(true); - /***********************************************************************************************************/ - // Add Label to App - if (QuickAccessLabel == nullptr) + } + + UIRadioButton *QuickAccessView::GetRadioButton(int i) + { + return QuickAccessRadioButton[i]; + } + + // 设置图片 + UIImageView *QuickAccessView::SetUpImageView(ImageConfig &imageconfig) + { + UIImageView *Image = new UIImageView(); + if (Image == nullptr) { - QuickAccessLabel = new UILabel(); + return nullptr; } - QuickAccessLabel->SetPosition(173, 52); - QuickAccessLabel->Resize(120, 35); - QuickAccessLabel->SetViewId("QuickAccessLabel"); - QuickAccessLabel->SetStyle(STYLE_TEXT_FONT, 30); - QuickAccessLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // Set additional property - QuickAccessLabel->SetText("快速访问"); - QuickAccessLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - QuickAccessLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - QuickAccessLabel->SetRollSpeed(6); - QuickAccessLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - // Add to scrollView3 - QuickAccessScrollView->Add(QuickAccessLabel); - QuickAccessLabel->SetVisible(true); - /***********************************************************************************************************/ - // Add Label to App + Image->SetPosition(imageconfig.x, imageconfig.y, imageconfig.w, imageconfig.h); + Image->SetSrc(imageconfig.ImageSrc); + return Image; + } + + // 设置标签 + UILabel *QuickAccessView::SetUpLabel(LabelConfig &labelconfig) + { + UILabel *label = new UILabel(); if (label == nullptr) { - label = new UILabel(); + return nullptr; } - label->SetPosition(86, 126); - label->Resize(286, 60); - label->SetViewId("label"); - label->SetStyle(STYLE_TEXT_FONT, 26); - label->SetStyle(STYLE_LINE_HEIGHT, 30); - // Set additional property - label->SetText("此功能可设置右下方按钮\n快速访问的APP"); - label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - label->SetTextColor(Color::GetColorFromRGBA(0xbb, 0xbb, 0xbb, 0xff)); + label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); // 位置大小 + label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize); // 字体大小 + label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh); // 字体行高 + label->SetText(labelconfig.text); // 内容 + label->SetLineBreakMode(labelconfig.lineBreakMode); // 断行模式。 label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label->SetRollSpeed(6); - label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); - // Add to scrollView3 - QuickAccessScrollView->Add(label); - label->SetVisible(true); - /***********************************************************************************************************/ - // Add ImageView to App - if (HeartRateDetectionImage == nullptr) - { - HeartRateDetectionImage = new UIImageView(); - } - HeartRateDetectionImage->SetPosition(43, 220); // widget's left position and top position - HeartRateDetectionImage->Resize(380, 100); // widget's width and height - HeartRateDetectionImage->SetViewId("HeartRateDetectionImage"); // Set style - HeartRateDetectionImage->SetStyle(STYLE_BORDER_RADIUS, 50); - HeartRateDetectionImage->SetSrc(PNG_SETTING_BACKGROUND_IMAGE); - // Add to scrollView3 - QuickAccessScrollView->Add(HeartRateDetectionImage); - HeartRateDetectionImage->SetVisible(true); - /***********************************************************************************************************/ - // Add Label to App - if (HeartRateDetectionLabel == nullptr) - { - HeartRateDetectionLabel = new UILabel(); - } - HeartRateDetectionLabel->SetPosition(103, 253); - HeartRateDetectionLabel->Resize(120, 35); - HeartRateDetectionLabel->SetViewId("HeartRateDetectionLabel"); - HeartRateDetectionLabel->SetStyle(STYLE_TEXT_FONT, 30); - HeartRateDetectionLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // Set additional property - HeartRateDetectionLabel->SetText("心率监测"); - HeartRateDetectionLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - HeartRateDetectionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - HeartRateDetectionLabel->SetRollSpeed(6); - HeartRateDetectionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - // Add to scrollView3 - QuickAccessScrollView->Add(HeartRateDetectionLabel); - HeartRateDetectionLabel->SetVisible(true); - /***********************************************************************************************************/ - // Add CheckBox to App - if (HeartRateDetectionCheckBox == nullptr) - { - HeartRateDetectionCheckBox = new UICheckBox(); - } - HeartRateDetectionCheckBox->SetPosition(343, 250); - HeartRateDetectionCheckBox->Resize(40, 40); - HeartRateDetectionCheckBox->SetViewId(HEART_RATE_DETECTION); - HeartRateDetectionCheckBox->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); - HeartRateDetectionCheckBox->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - // Set additional property - HeartRateDetectionCheckBox->SetImages(PNG_CHECKBOX_ON_IMAGE, PNG_CHECKBOX_OFF_IMAGE); - // Add the CallBack about events - UIView::OnClickListener *HeartRateDetectionCheckBoxClick = static_cast(QuickAccessPresenter::GetInstance()); - HeartRateDetectionCheckBox->SetOnClickListener(HeartRateDetectionCheckBoxClick); - // Add to scrollView3 - QuickAccessScrollView->Add(HeartRateDetectionCheckBox); - HeartRateDetectionCheckBox->SetVisible(true); - /***********************************************************************************************************/ - // Add ImageView to App - if (BloodOxygenMonitoringImage == nullptr) - { - BloodOxygenMonitoringImage = new UIImageView(); - } - BloodOxygenMonitoringImage->SetPosition(43, 340); - BloodOxygenMonitoringImage->Resize(380, 100); - BloodOxygenMonitoringImage->SetViewId("BloodOxygenMonitoringImage"); - BloodOxygenMonitoringImage->SetStyle(STYLE_BORDER_RADIUS, 50); - // Set additional property - BloodOxygenMonitoringImage->SetSrc(PNG_SETTING_BACKGROUND_IMAGE); - // Add to scrollView3 - QuickAccessScrollView->Add(BloodOxygenMonitoringImage); - BloodOxygenMonitoringImage->SetVisible(true); - /***********************************************************************************************************/ - // Add CheckBox to App - if (BloodOxygenMonitoringCheckBox == nullptr) - { - BloodOxygenMonitoringCheckBox = new UICheckBox(); - } - BloodOxygenMonitoringCheckBox->SetPosition(343, 370); - BloodOxygenMonitoringCheckBox->Resize(50, 50); - BloodOxygenMonitoringCheckBox->SetViewId(BLOOD_OXYGEN_MONITOR); - BloodOxygenMonitoringCheckBox->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); - BloodOxygenMonitoringCheckBox->SetStyle(STYLE_BACKGROUND_OPA, 0xff); - BloodOxygenMonitoringCheckBox->SetImages(PNG_CHECKBOX_ON_IMAGE, PNG_CHECKBOX_OFF_IMAGE); - // Add the CallBack about events - UIView::OnClickListener *BloodOxygenMonitoringCheckBoxClick = static_cast(QuickAccessPresenter::GetInstance()); - BloodOxygenMonitoringCheckBox->SetOnClickListener(BloodOxygenMonitoringCheckBoxClick); - // Add to scrollView3 - QuickAccessScrollView->Add(BloodOxygenMonitoringCheckBox); - BloodOxygenMonitoringCheckBox->SetVisible(true); - /***********************************************************************************************************/ - // Add Label to App - if (BloodOxygenMonitoringLabel == nullptr) - { - BloodOxygenMonitoringLabel = new UILabel(); - } - BloodOxygenMonitoringLabel->SetPosition(103, 373); - BloodOxygenMonitoringLabel->Resize(120, 35); - BloodOxygenMonitoringLabel->SetViewId("BloodOxygenMonitoringLabel"); - BloodOxygenMonitoringLabel->SetStyle(STYLE_TEXT_FONT, 30); - BloodOxygenMonitoringLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // Set additional property - BloodOxygenMonitoringLabel->SetText("血氧监测"); - BloodOxygenMonitoringLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - BloodOxygenMonitoringLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - BloodOxygenMonitoringLabel->SetRollSpeed(6); - BloodOxygenMonitoringLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - // Add to scrollView3 - QuickAccessScrollView->Add(BloodOxygenMonitoringLabel); - BloodOxygenMonitoringLabel->SetVisible(true); - /***********************************************************************************************************/ - // Add ImageView to App - if (image1 == nullptr) - { - image1 = new UIImageView(); - } - image1->SetPosition(183, 23); - image1->Resize(100, 100); - image1->SetViewId("image1"); + label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize); + return label; + } - QuickAccessScrollView->Add(image1); - image1->SetVisible(true); - /***********************************************************************************************************/ - // Add ImageView to App - if (image2 == nullptr) + // 设置单选框 + UIRadioButton *QuickAccessView::SetUpRadioButton(RadioButtonConfig &radiobuttonconfig) + { + UIRadioButton *radiobutton = new UIRadioButton("QuickAccess"); + if (nullptr == radiobutton) { - image2 = new UIImageView(); + return nullptr; } - image2->SetPosition(183, 423); - image2->Resize(100, 100); - image2->SetViewId("image2"); - QuickAccessScrollView->Add(image2); - image2->SetVisible(true); + radiobutton->SetPosition(radiobuttonconfig.x, radiobuttonconfig.y, radiobuttonconfig.w, radiobuttonconfig.h); + radiobutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + radiobutton->SetImages(radiobuttonconfig.select, radiobuttonconfig.unselect); + return radiobutton; } - void QuickAccessView::DeInitView(void) + bool QuickAccessView::QuickAccessScrollViewInit(void) { - if (container_ != nullptr) - { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } - if (QuickAccessScrollView != nullptr) - { - delete QuickAccessScrollView; - QuickAccessScrollView = nullptr; - } - if (image1 != nullptr) - { - delete image1; - image1 = nullptr; - } - if (QuickAccessLabel != nullptr) - { - delete QuickAccessLabel; - QuickAccessLabel = nullptr; - } - if (image2 != nullptr) - { - delete image2; - image2 = nullptr; - } - if (label != nullptr) - { - delete label; - label = nullptr; - } - if (HeartRateDetectionImage != nullptr) - { - delete HeartRateDetectionImage; - HeartRateDetectionImage = nullptr; - } - if (HeartRateDetectionCheckBox != nullptr) - { - delete HeartRateDetectionCheckBox; - HeartRateDetectionCheckBox = nullptr; - } - if (HeartRateDetectionLabel != nullptr) - { - delete HeartRateDetectionLabel; - HeartRateDetectionLabel = nullptr; - } - if (BloodOxygenMonitoringImage != nullptr) - { - delete BloodOxygenMonitoringImage; - BloodOxygenMonitoringImage = nullptr; - } - if (BloodOxygenMonitoringCheckBox != nullptr) + QuickAccessScrollView = new UIScrollView(); + if (QuickAccessScrollView == nullptr) { - delete BloodOxygenMonitoringCheckBox; - BloodOxygenMonitoringCheckBox = nullptr; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QuickAccessView::QuickAccessScrollView new fail!"); + return false; } - if (BloodOxygenMonitoringLabel != nullptr) + QuickAccessScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + QuickAccessScrollView->SetScrollBlankSize(35); + QuickAccessScrollView->SetReboundSize(50); + QuickAccessScrollView->SetDirection(1); + UIView::OnDragListener *draglistener = static_cast(SecondaryFunctionPresenter::GetInstance()); + if (draglistener == nullptr) { - delete BloodOxygenMonitoringLabel; - BloodOxygenMonitoringLabel = nullptr; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QuickAccessView::draglistener can not be nullptr!"); + return false; } + QuickAccessScrollView->SetOnDragListener(draglistener); + QuickAccessScrollView->SetTouchable(true); + QuickAccessScrollView->SetDraggable(true); + return true; } - void QuickAccessView::OnStart() + bool QuickAccessView::QuickAccessLabelInit(void) { - View::OnStart(); - InitView(); - RootView::GetInstance()->Add(container_); + LabelConfig labelInfos[] = { + {173, 52, 120, 35, 30, 35, "快速访问", UILabel::LINE_BREAK_ADAPT}, + {86, 126, 286, 60, 26, 30, "此功能可设置右下方按钮\n快速访问的APP", UILabel::LINE_BREAK_ADAPT}, + {103, 253, 120, 35, 30, 35, "心率监测", UILabel::LINE_BREAK_ADAPT}, + {103, 373, 120, 35, 30, 35, "血氧监测", UILabel::LINE_BREAK_ADAPT}}; + + for (int i = 0; i < 4; i++) + { + LabelConfig labelconfig = { + .left = labelInfos[i].left, + .top = labelInfos[i].top, + .width = labelInfos[i].width, + .height = labelInfos[i].height, + .fontSize = labelInfos[i].fontSize, + .lineHeigh = labelInfos[i].lineHeigh, + .text = labelInfos[i].text, + .lineBreakMode = labelInfos[i].lineBreakMode}; + + QuickAccessLabel[i] = SetUpLabel(labelconfig); + if (nullptr == QuickAccessLabel[i]) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QuickAccessView::QuickAccessLabel[%d] is nullptr!", i); + return false; + } + QuickAccessScrollView->Add(QuickAccessLabel[i]); + } + + return true; } - void QuickAccessView::OnSetUpView() + bool QuickAccessView::QuickAccessImageViewInit(void) { - - View::OnSetUpView(); - Draw(); + ImageConfig imageconfig = { + .x = 43, + .y = 220, + .w = 380, + .h = 100, + .ImageSrc = "/user/res/SETTING_BACKGROUND.bin", + }; + + for (int i = 0; i < 2; i++) + { + imageconfig.y = 220 + (i * 120); + QuickAccessImageView[i] = SetUpImageView(imageconfig); + if (QuickAccessImageView[i] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QuickAccessView::QuickAccessImageView[%d] is nullptr!", i); + return false; + } + QuickAccessScrollView->Add(QuickAccessImageView[i]); + } + return true; } - void QuickAccessView::OnTearDownView() + bool QuickAccessView::QuickAccessRadioButtonInit(void) { - - View::OnTearDownView(); - return; + RadioButtonConfig radiobuttonconfig = { + .x = 300, + .y = 230, + .w = 80, + .h = 80, + .select = "/user/res/CHECKBOX_ON.bin", + .unselect = "/user/res/CHECKBOX_OFF.bin", + }; + + for (int i = 0; i < 2; i++) + { + radiobuttonconfig.y = 230 + (i * 120); + QuickAccessRadioButton[i] = SetUpRadioButton(radiobuttonconfig); + if (QuickAccessRadioButton[i] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QuickAccessView::QuickAccessRadioButton[%d] is nullptr!", i); + return false; + } + ChangeLister[i] = static_cast(new QuickAccessRadioButtonChangeLister(QuickAccessRadioButton[i])); + QuickAccessRadioButton[i]->SetOnChangeListener(ChangeLister[i]); + QuickAccessScrollView->Add(QuickAccessRadioButton[i]); + } + return true; } - void QuickAccessView::OnStop() + UIScrollView *QuickAccessView::QuickAccessViewInit(void) { + if (!QuickAccessScrollViewInit()) + { + return nullptr; + } - View::OnStop(); - RootView::GetInstance()->RemoveAll(); - return; + if (!QuickAccessImageViewInit()) + { + return nullptr; + } + + if (!QuickAccessLabelInit()) + { + return nullptr; + } + + if (!QuickAccessRadioButtonInit()) + { + return nullptr; + } + + initViewStatus = true; + return QuickAccessScrollView; } + } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp index fe06f7d34..5421a884d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp @@ -60,19 +60,48 @@ namespace OHOS bool SecondaryFunctionPresenter::OnDragEnd(UIView &view, const DragEvent &event) { + SecondaryFunctionView *p_SecondaryFunctionView = SecondaryFunctionView::GetInstance(); + if (p_SecondaryFunctionView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView GetInstance fail"); + return false; + } if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { - NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING); + for (int i = 0; i < MAX_SECONDARYFUNCTIONVIEWID; i++) + { + if (p_SecondaryFunctionView->GetSecondaryFunctionScrollView(i) != nullptr && + p_SecondaryFunctionView->GetSecondaryFunctionScrollView(i)->IsVisible() == true) + { + if (i == SECONDARYFUNCTIONVIEW) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING); + } + else + { + p_SecondaryFunctionView->ChangeView(i, SECONDARYFUNCTIONVIEW); + } + break; + } + } + return true; } - return true; + return false; } bool SecondaryFunctionPresenter::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); + SecondaryFunctionView *p_SecondaryFunctionView = SecondaryFunctionView::GetInstance(); + if (p_SecondaryFunctionView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView GetInstance fail"); + return false; + } + if (strcmp(view.GetViewId(), SECONDARY_FUNCTION_QUICK_ACCESS_BUTTON) == 0) { - NativeAbility::GetInstance().ChangeSlice(VIEW_QUICK_ACCESS); + p_SecondaryFunctionView->ChangeView(SECONDARYFUNCTIONVIEW, QUICKACCESSVIEW); } else if (strcmp(view.GetViewId(), SECONDARY_FUNCTION_FAST_TRAINING_BUTTON) == 0) { @@ -80,4 +109,37 @@ namespace OHOS } return true; } + + bool QuickAccessRadioButtonChangeLister::OnChange(UICheckBox::UICheckBoxState state) + { + SecondaryFunctionView *p_SecondaryFunctionView = SecondaryFunctionView::GetInstance(); + if (p_SecondaryFunctionView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView GetInstance fail"); + return false; + } + switch (state) + { + case UICheckBox::SELECTED: + if (p_SecondaryFunctionView->GetQuickAccessView() != nullptr) + { + if (p_SecondaryFunctionView->GetQuickAccessView()->GetRadioButton(0) == (UIView *)m_view) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Switched to heart rate monitoring app"); + return true; + } + else if (p_SecondaryFunctionView->GetQuickAccessView()->GetRadioButton(1) == (UIView *)m_view) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Switched to blood oxygen monitoring app"); + return true; + } + } + break; + case UICheckBox::UNSELECTED: + break; + default: + break; + } + return false; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionView.cpp b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionView.cpp index c09f821c0..e76738bdb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionView.cpp @@ -28,7 +28,7 @@ namespace OHOS { if (initViewStatus == true) { - SecondaryFunctionScrollView->RemoveAll(); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->RemoveAll(); delete SecondaryFunctionScrollTitleLabel; SecondaryFunctionScrollTitleLabel = nullptr; @@ -51,8 +51,11 @@ namespace OHOS Image[i] = nullptr; } - delete SecondaryFunctionScrollView; - SecondaryFunctionScrollView = nullptr; + delete p_QuickAccessView; + p_QuickAccessView = nullptr; + + delete SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]; + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW] = nullptr; } } @@ -89,22 +92,25 @@ namespace OHOS bool SecondaryFunctionView::SecondaryFunctionScrollViewInit(void) { - SecondaryFunctionScrollView = new UIScrollView(); - if (SecondaryFunctionScrollView == nullptr) + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW] = new UIScrollView(); + if (SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW] == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::SecondaryFunctionScrollView new fail!"); return false; } - SecondaryFunctionScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->SetScrollBlankSize(35); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->SetReboundSize(50); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->SetDirection(1); UIView::OnDragListener *draglistener = static_cast(SecondaryFunctionPresenter::GetInstance()); if (draglistener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::draglistener can not be nullptr!"); return false; } - SecondaryFunctionScrollView->SetOnDragListener(draglistener); - SecondaryFunctionScrollView->SetTouchable(true); - SecondaryFunctionScrollView->SetDraggable(true); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->SetOnDragListener(draglistener); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->SetTouchable(true); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->SetDraggable(true); return true; } @@ -145,7 +151,6 @@ namespace OHOS bool SecondaryFunctionView::SecondaryFunctionScrollLabelInit(void) { - // 创建ScreenDurationTitleLabel LabelConfig labelconfig = { .left = 173, .top = 52, @@ -234,6 +239,93 @@ namespace OHOS initViewStatus = true; } + QuickAccessView *SecondaryFunctionView::GetQuickAccessView(void) + { + return p_QuickAccessView; + } + + UIScrollView *SecondaryFunctionView::GetSecondaryFunctionScrollView(int i) + { + return SecondaryFunctionScrollView[i]; + } + + // 切换到辅助功能视图 + bool SecondaryFunctionView::ChangeSecondaryFunctionView(int16_t thisView) + { + if (SecondaryFunctionScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::ChangeSecondaryFunctionView"); + RootView::GetInstance()->Add(SecondaryFunctionScrollView[thisView]); + } + return true; + } + + // 切换到快速访问视图 + bool SecondaryFunctionView::ChangeQuickAccessView(int16_t thisView) + { + if (SecondaryFunctionScrollView[thisView] == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::ChangeQuickAccessView"); + p_QuickAccessView = new QuickAccessView(); + if (p_QuickAccessView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView:: new scrollView[%d] fail", thisView); + return false; + } + SecondaryFunctionScrollView[thisView] = p_QuickAccessView->QuickAccessViewInit(); + RootView::GetInstance()->Add(SecondaryFunctionScrollView[thisView]); + } + return true; + } + + /* -------------------------------------------------------------------------- */ + // 1.SecondaryFunctionViewMapper:结构体定义了一个将视图ID映射到特定成员函数指针的映射表。 + struct SecondaryFunctionViewMapper + { + const int16_t viewId; + bool (SecondaryFunctionView::*func)(int16_t thisView); + }; + + // 2.ViewMapper[] 是一个静态的视图映射数组,将视图ID与SecondaryFunctionView类中的特定成员函数指针进行了绑定。 + static const SecondaryFunctionViewMapper ViewMapper[] = { + {SECONDARYFUNCTIONVIEW, &SecondaryFunctionView::ChangeSecondaryFunctionView}, + {QUICKACCESSVIEW, &SecondaryFunctionView::ChangeQuickAccessView}, + }; + + // 3.根据传入的interface参数执行相应视图ID关联的成员函数。 + bool SecondaryFunctionView::ClickFunc(int16_t interface) + { + int funcSize = sizeof(ViewMapper) / sizeof(ViewMapper[0]); + for (int i = 0; i < funcSize; i++) + { + if (interface == ViewMapper[i].viewId) + { + bool jug = (this->*(ViewMapper[i].func))(interface); + if (jug == false) + { + return false; + } + return true; + } + } + return false; + } + + // 4.切换视图 + void SecondaryFunctionView::ChangeView(int16_t hideView, int16_t showView) + { + if (hideView > MAX_SECONDARYFUNCTIONVIEWID) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView:: SECONDARYFUNCTIONVIEWID Overstep ones bounds"); + return; + } + SecondaryFunctionScrollView[hideView]->SetVisible(false); + ClickFunc(showView); + SecondaryFunctionScrollView[showView]->SetVisible(true); + Draw(); + } + /* -------------------------------------------------------------------------- */ + void SecondaryFunctionView::OnStart() { View::OnStart(); @@ -243,14 +335,14 @@ namespace OHOS void SecondaryFunctionView::OnSetUpView() { View::OnSetUpView(); - SecondaryFunctionScrollView->Add(SecondaryFunctionScrollTitleLabel); - SecondaryFunctionScrollView->Add(QuickAccessButton); - SecondaryFunctionScrollView->Add(FastTrainingButton); - SecondaryFunctionScrollView->Add(QuickAccessLabel); - SecondaryFunctionScrollView->Add(FastTrainingLabel); - SecondaryFunctionScrollView->Add(Image[0]); - SecondaryFunctionScrollView->Add(Image[1]); - RootView::GetInstance()->Add(SecondaryFunctionScrollView); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->Add(SecondaryFunctionScrollTitleLabel); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->Add(QuickAccessButton); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->Add(FastTrainingButton); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->Add(QuickAccessLabel); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->Add(FastTrainingLabel); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->Add(Image[0]); + SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]->Add(Image[1]); + RootView::GetInstance()->Add(SecondaryFunctionScrollView[SECONDARYFUNCTIONVIEW]); Draw(); }