建立训练单独的UI资源管理
authorCaisking <3449750381@qq.com>
Thu, 21 Mar 2024 01:38:09 +0000 (09:38 +0800)
committerCaisking <3449750381@qq.com>
Thu, 21 Mar 2024 01:38:09 +0000 (09:38 +0800)
61 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/main/src/MainViewSample.cpp
code/sdk/application/wearable/fd230app/nativeui/message/src/MessagePresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/Training_UiConfig.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingView.h
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingMorePresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/Jumprope.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/jumprope.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/Mountaineering.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/mountaineering.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/Pingpong.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/pingpong.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/Riding.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/riding.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/Running.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/running.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/Walking.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_36x36/walking.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_60x60/Riding_60.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_60x60/riding_60.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_60x60/Running_60.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_60x60/running_60.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_80x80/Jumprope_80.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_80x80/jumprope_80.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_80x80/Mountaineering_80.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_80x80/mountaineering_80.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_80x80/Pingpong_80.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_80x80/pingpong_80.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_80x80/Riding_80.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/icon_80x80/riding_80.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Arrows.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/arrows.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Back.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/back.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Bubble.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/bubble.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Buttonok.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/buttonok.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Calories.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/calories.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Calories_30.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/calories_30.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Control_point.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/control_point.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Data_point.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/data_point.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Go.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Go_1.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Heartrate.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/heartrate.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Heartrate_1.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/heartrate_1.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Heartrate_2.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/heartrate_2.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Heartrate_30.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/heartrate_30.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Icon.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/icon.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Inco_up.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/inco_up.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Inco_up_40.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/inco_up_40.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Line_1.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Line 1.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Line_2.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Line 2.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Mileage.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/mileage.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Mileage_30.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/mileage_30.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/No.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/no.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Note.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/note.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Path.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/path.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Piont_bubble.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/piont_bubble.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Point_black.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/piont_black.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Point_bule.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/point_bule.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Point_green.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/point_green.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Point_orange.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/point_orange.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Point_yellow.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/point_yellow.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Progress.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/progress.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Sport_continue.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/sport_continue.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Sport_pause.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/sport_pause.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Sport_stop.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/sport_stop.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Sport_strength.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/sport-strength.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Step_30.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/step_30.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Time.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/time.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Warning.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/warning.bin with 100% similarity]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/Yes.bin [moved from code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/Training/modules/yes.bin with 100% similarity]
code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c

index 3123c0a..3047fcd 100644 (file)
@@ -392,6 +392,7 @@ set(SOURCES
     #Training
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingPresenter.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingModel.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingMoreView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingMorePresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingLimitView.cpp
index 27540aa..081dea1 100644 (file)
@@ -356,7 +356,7 @@ namespace OHOS
         mainClockView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
         UIView::OnLongPressListener *buttonLongPress = static_cast<UIView::OnLongPressListener *>(MainPresenterSample::GetInstance());
         mainClockView->SetOnLongPressListener(buttonLongPress);
-        
+
         return mainClockView;
     }
 
@@ -441,6 +441,9 @@ namespace OHOS
         if (mainSwipeGroup != nullptr)
         {
             mainSwipeGroup->SetHorCurrentPage(page);
+            // 刷新
+            OHOS::UISwipeView swipe;
+            mainSwipeGroup->OnSwipe(swipe);
         }
 
         if (presenter_ != nullptr)
index 99ccc7a..3bfcfd9 100644 (file)
@@ -1,3 +1,11 @@
+/*** 
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2024-03-03 16:02:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-03-20 20:02:57
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
 
 #include "message/include/MessageView.h"
 #include "message/include/MessagePresenter.h"
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/Training_UiConfig.h b/code/sdk/application/wearable/fd230app/nativeui/traing/Training_UiConfig.h
new file mode 100644 (file)
index 0000000..6883e6c
--- /dev/null
@@ -0,0 +1,196 @@
+#ifndef TRAINING_UI_CONFIG_H
+#define TRAINING_UI_CONFIG_H
+
+#include <cstdint>
+#include "ohos_types.h"
+#include "graphic_config.h"
+
+namespace OHOS
+{
+
+// 定义按键颜色宏
+#define DEFAULT_BACKGROUND_COLOR 0xff191919
+#define PRESSED_BACKGROUND_COLOR 0xff249115
+#define PRESSED_BORDER_COLOR 0xff0b1928
+
+// Paths for different icons in the Training folder
+#define ICON36 "/user/res/Training/icon_36x36"
+#define ICON60 "/user/res/Training/icon_60x60"
+#define ICON80 "/user/res/Training/icon_80x80"
+#define MODULES "/user/res/Training/modules"
+#define TRAINING_GIF "/user/res/Training/training_GIF"
+
+    // Icons in the icon_36x36 folder
+    static constexpr const char *BALL_IMAGE = ICON36 "/Ball.bin";
+    static constexpr const char *DANCE_IMAGE = ICON36 "/Dance.bin";
+    static constexpr const char *FITNESS_IMAGE = ICON36 "/Fitness.bin";
+    static constexpr const char *ICE_IMAGE = ICON36 "/Ice.bin";
+    static constexpr const char *JUMPROPE_IMAGE = ICON36 "/Jumprope.bin";
+    static constexpr const char *LIMIT_IMAGE = ICON36 "/Limit.bin";
+    static constexpr const char *MOUNTAINEERING_IMAGE = ICON36 "/Mountaineering.bin";
+    static constexpr const char *OTHER_IMAGE = ICON36 "/Other.bin";
+    static constexpr const char *PINGPONG_IMAGE = ICON36 "/Pingpong.bin";
+    static constexpr const char *REST_IMAGE = ICON36 "/Rest.bin";
+    static constexpr const char *RIDING_IMAGE = ICON36 "/Riding.bin";
+    static constexpr const char *RUNNING_IMAGE = ICON36 "/Running.bin";
+    static constexpr const char *SWIMMING_IMAGE = ICON36 "/Swimming.bin";
+    static constexpr const char *WALKING_IMAGE = ICON36 "/Walking.bin";
+
+    // Icons in the icon_60x60 folder
+    static constexpr const char *RIDING_60_IMAGE = ICON60 "/Riding_60.bin";
+    static constexpr const char *RUNNING_60_IMAGE = ICON60 "/Running_60.bin";
+    static constexpr const char *WALKING_60_IMAGE = ICON60 "/Walking_60.bin";
+
+    // Icons in the icon_80x80 folder
+    static constexpr const char *JUMPROPE_80_IMAGE = ICON80 "/Jumprope_80.bin";
+    static constexpr const char *MOUNTAINEERING_80_IMAGE = ICON80 "/Mountaineering_80.bin";
+    static constexpr const char *PINGPONG_80_IMAGE = ICON80 "/Pingpong_80.bin";
+    static constexpr const char *RIDING_80_IMAGE = ICON80 "/Riding_80.bin";
+
+    // Modules icons
+    static constexpr const char *ARROWS_IMAGE = MODULES "/Arrows.bin";
+    static constexpr const char *BACK_IMAGE = MODULES "/Back.bin";
+    static constexpr const char *BOUTTONGROUND_IMAGE = MODULES "/Bouttonground.bin";
+    static constexpr const char *BUTTONGROUND2_IMAGE = MODULES "/Buttonground2.bin";
+    static constexpr const char *BUBBLE_IMAGE = MODULES "/Bubble.bin";
+    static constexpr const char *BUTTONOK_IMAGE = MODULES "/Buttonok.bin";
+    static constexpr const char *CALORIES_IMAGE = MODULES "/Calories.bin";
+    static constexpr const char *CALORIES_30_IMAGE = MODULES "/Calories_30.bin";
+    static constexpr const char *CONTROL_POINT_IMAGE = MODULES "/Control_point.bin";
+    static constexpr const char *DATA_POINT_IMAGE = MODULES "/Data_point.bin";
+    static constexpr const char *GO_1_IMAGE = MODULES "/Go_1.bin";
+    static constexpr const char *GO_2_IMAGE = MODULES "/Go_2.bin";
+    static constexpr const char *GPS_1_IMAGE = MODULES "/GPS_1.bin";
+    static constexpr const char *GPS_2_IMAGE = MODULES "/GPS_2.bin";
+    static constexpr const char *HEARTRATE_IMAGE = MODULES "/Heartrate.bin";
+    static constexpr const char *HEARTRATE_1_IMAGE = MODULES "/Heartrate_1.bin";
+    static constexpr const char *HEARTRATE_2_IMAGE = MODULES "/Heartrate_2.bin";
+    static constexpr const char *HEARTRATE_30_IMAGE = MODULES "/Heartrate_30.bin";
+    static constexpr const char *ICON_IMAGE = MODULES "/Icon.bin";
+    static constexpr const char *INCO_UP_IMAGE = MODULES "/Inco_up.bin";
+    static constexpr const char *INCO_UP_40_IMAGE = MODULES "/Inco_up_40.bin";
+    static constexpr const char *LINE_IMAGE = MODULES "/Line.bin";
+    static constexpr const char *LINE_1_IMAGE = MODULES "/Line_1.bin";
+    static constexpr const char *LINE_2_IMAGE = MODULES "/Line_2.bin";
+    static constexpr const char *MILEAGE_IMAGE = MODULES "/Mileage.bin";
+    static constexpr const char *MILEAGE_30_IMAGE = MODULES "/Mileage_30.bin";
+    static constexpr const char *MORE_IMAGE = MODULES "/More.bin";
+    static constexpr const char *MOREVIEW_IMAGE = MODULES "/MoreView.bin";
+    static constexpr const char *NO_IMAGE = MODULES "/No.bin";
+    static constexpr const char *NOTE_IMAGE = MODULES "/Note.bin";
+    static constexpr const char *PATH_IMAGE = MODULES "/Path.bin";
+    static constexpr const char *PIONT_BLACK_IMAGE = MODULES "/Piont_black.bin";
+    static constexpr const char *PIONT_BUBBLE_IMAGE = MODULES "/Piont_bubble.bin";
+    static constexpr const char *POINT_BLUE_IMAGE = MODULES "/Point_blue.bin";
+    static constexpr const char *POINT_GREEN_IMAGE = MODULES "/Point_green.bin";
+    static constexpr const char *POINT_ORANGE_IMAGE = MODULES "/Point_orange.bin";
+    static constexpr const char *POINT_YELLOW_IMAGE = MODULES "/Point_yellow.bin";
+    static constexpr const char *PROGRESS_IMAGE = MODULES "/Progress.bin";
+    static constexpr const char *SPORT_CONTINUE_IMAGE = MODULES "/Sport_continue.bin";
+    static constexpr const char *SPORT_PAUSE_IMAGE = MODULES "/Sport_pause.bin";
+    static constexpr const char *SPORT_STOP_IMAGE = MODULES "/Sport_stop.bin";
+    static constexpr const char *SPORT_STRENGTH_IMAGE = MODULES "/Sport_strength.bin";
+    static constexpr const char *STEP_30_IMAGE = MODULES "/Step_30.bin";
+    static constexpr const char *TIME_IMAGE = MODULES "/Time.bin";
+    static constexpr const char *WALKING_54_IMAGE = MODULES "/Walking_54.bin";
+    static constexpr const char *WARNING_IMAGE = MODULES "/Warning.bin";
+    static constexpr const char *YES_IMAGE = MODULES "/Yes.bin";
+
+    // Training GIF
+    static constexpr const char *TRAINING_GIF_IMAGE_1 = TRAINING_GIF "/win/1.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_2 = TRAINING_GIF "/win/2.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_3 = TRAINING_GIF "/win/3.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_4 = TRAINING_GIF "/win/4.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_5 = TRAINING_GIF "/win/5.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_6 = TRAINING_GIF "/win/6.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_7 = TRAINING_GIF "/win/7.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_8 = TRAINING_GIF "/win/8.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_9 = TRAINING_GIF "/win/9.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_10 = TRAINING_GIF "/win/10.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_11 = TRAINING_GIF "/win/11.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_12 = TRAINING_GIF "/win/12.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_13 = TRAINING_GIF "/win/13.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_14 = TRAINING_GIF "/win/14.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_15 = TRAINING_GIF "/win/15.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_16 = TRAINING_GIF "/win/16.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_17 = TRAINING_GIF "/win/17.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_18 = TRAINING_GIF "/win/18.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_19 = TRAINING_GIF "/win/19.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_20 = TRAINING_GIF "/win/20.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_21 = TRAINING_GIF "/win/21.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_22 = TRAINING_GIF "/win/22.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_23 = TRAINING_GIF "/win/23.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_24 = TRAINING_GIF "/win/24.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_25 = TRAINING_GIF "/win/25.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_26 = TRAINING_GIF "/win/26.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_27 = TRAINING_GIF "/win/27.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_28 = TRAINING_GIF "/win/28.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_29 = TRAINING_GIF "/win/29.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_30 = TRAINING_GIF "/win/30.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_31 = TRAINING_GIF "/win/31.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_32 = TRAINING_GIF "/win/32.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_33 = TRAINING_GIF "/win/33.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_34 = TRAINING_GIF "/win/34.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_35 = TRAINING_GIF "/win/35.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_36 = TRAINING_GIF "/win/36.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_37 = TRAINING_GIF "/win/37.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_38 = TRAINING_GIF "/win/38.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_39 = TRAINING_GIF "/win/39.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_40 = TRAINING_GIF "/win/40.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_41 = TRAINING_GIF "/win/41.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_42 = TRAINING_GIF "/win/42.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_43 = TRAINING_GIF "/win/43.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_44 = TRAINING_GIF "/win/44.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_45 = TRAINING_GIF "/win/45.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_46 = TRAINING_GIF "/win/46.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_47 = TRAINING_GIF "/win/47.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_48 = TRAINING_GIF "/win/48.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_49 = TRAINING_GIF "/win/49.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_50 = TRAINING_GIF "/win/50.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_51 = TRAINING_GIF "/win/51.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_52 = TRAINING_GIF "/win/52.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_53 = TRAINING_GIF "/win/53.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_54 = TRAINING_GIF "/win/54.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_55 = TRAINING_GIF "/win/55.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_56 = TRAINING_GIF "/win/56.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_57 = TRAINING_GIF "/win/57.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_58 = TRAINING_GIF "/win/58.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_59 = TRAINING_GIF "/win/59.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_60 = TRAINING_GIF "/win/60.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_61 = TRAINING_GIF "/win/61.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_62 = TRAINING_GIF "/win/62.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_63 = TRAINING_GIF "/win/63.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_64 = TRAINING_GIF "/win/64.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_65 = TRAINING_GIF "/win/65.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_66 = TRAINING_GIF "/win/66.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_67 = TRAINING_GIF "/win/67.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_68 = TRAINING_GIF "/win/68.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_69 = TRAINING_GIF "/win/69.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_70 = TRAINING_GIF "/win/70.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_71 = TRAINING_GIF "/win/71.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_72 = TRAINING_GIF "/win/72.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_73 = TRAINING_GIF "/win/73.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_74 = TRAINING_GIF "/win/74.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_75 = TRAINING_GIF "/win/75.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_76 = TRAINING_GIF "/win/76.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_77 = TRAINING_GIF "/win/77.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_78 = TRAINING_GIF "/win/78.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_79 = TRAINING_GIF "/win/79.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_80 = TRAINING_GIF "/win/80.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_81 = TRAINING_GIF "/win/81.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_82 = TRAINING_GIF "/win/82.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_83 = TRAINING_GIF "/win/83.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_84 = TRAINING_GIF "/win/84.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_85 = TRAINING_GIF "/win/85.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_86 = TRAINING_GIF "/win/86.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_87 = TRAINING_GIF "/win/87.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_88 = TRAINING_GIF "/win/88.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_89 = TRAINING_GIF "/win/89.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_90 = TRAINING_GIF "/win/90.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_91 = TRAINING_GIF "/win/91.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_92 = TRAINING_GIF "/win/92.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_93 = TRAINING_GIF "/win/93.bin";
+    static constexpr const char *TRAINING_GIF_IMAGE_94 = TRAINING_GIF "/win/94.bin";
+
+}
+#endif
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h
new file mode 100644 (file)
index 0000000..df259f2
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef Traing_MODEL_H
+#define Traing_MODEL_H
+
+#include "BaseView.h"
+#include "View.h"
+#include "string.h"
+#include <ui_scroll_view.h>
+#include "components/ui_view_group.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_chart.h"
+#include "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "traing/include/TraingModel.h"
+#include "traing/Training_UiConfig.h"
+
+struct QuickTraining
+{
+    char *training1_Text;
+    char *training1_Image;
+    char *training2_Text;
+    char *training2_Image;
+    char *training3_Text;
+    char *training3_Image;
+
+    //QuickTraining() : training1_Text("健走"), training2_Text("骑行"), training3_Text("跑步"), training1_Image(WALKING_60_IMAGE), training2_Image(RUNNING_60_IMAGE), training3_Image(RIDING_60_IMAGE) {} // 初始化默认值
+};
+
+namespace OHOS
+{
+    class TraingModel
+    {
+    public:
+        TraingModel();
+        ~TraingModel();
+        static TraingModel *GetInstance(void);
+        bool InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+        bool InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+        bool InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+        void InitList();
+
+        void SetQuickTraining(QuickTraining *quickTraining);
+        QuickTraining *GetQuickTraining() const;
+
+    private:
+        TraingModel(const TraingModel &) = delete;
+        TraingModel &operator=(const TraingModel &) = delete;
+
+        QuickTraining *quickTraining_;
+    };
+}
+
+#endif
\ No newline at end of file
index 7ab6f6a..a751d0c 100644 (file)
@@ -1,27 +1,15 @@
 #ifndef _Traing_VIEW_H
 #define _Traing_VIEW_H
 
-#include "BaseView.h"
-#include "View.h"
-#include <ui_scroll_view.h>
-#include "components/ui_view_group.h"
-#include "components/ui_label.h"
-#include "components/ui_image_view.h"
-#include "components/ui_button.h"
-#include "components/ui_image_animator.h"
-#include "components/ui_label_button_ext.h"
-#include "components/ui_chart.h"
-#include "wearable_log.h"
-#include "ohos_types.h"
-#include "components/ui_card_page.h"
-
+#include "traing/include/TraingModel.h"
+#include "traing/Training_UiConfig.h"
 #include "TraingPresenter.h"
 namespace OHOS
 {
-#define BUTTON1 "button1"    // 按键1
-#define BUTTON2 "button2"    // 按键2
-#define BUTTON3 "button3"    // 按键3
-#define BUTTONMORE "button4" // 按键 更多
+#define BUTTON1 "button1"       // 按键1
+#define BUTTON2 "button2"       // 按键2
+#define BUTTON3 "button3"       // 按键3
+#define BUTTONMORE "buttonmore" // 按键 更多
 
     class TraingPresenter;
     class TraingView : public View<TraingPresenter>
@@ -36,8 +24,12 @@ namespace OHOS
         void OnSetUpView() override;
         void OnTearDownView() override;
         void OnStop() override;
-        void Init();
-        void DeInit();
+
+        bool AddLabel();
+        bool AddButton();
+        bool AddImageView();
+        void InitView();
+        void DeInitView();
 
         UIView *GetView();
 
@@ -47,17 +39,21 @@ namespace OHOS
         TraingView &operator=(TraingView &&) = delete;
 
         UIViewGroup *container_ = nullptr;
-        UILabel *label1_ = nullptr;
-        UIButton *button3_ = nullptr;
-        UIButton *button4_ = nullptr;
+
+        UIButton *buttonmore_ = nullptr;
         UIButton *button1_ = nullptr;
         UIButton *button2_ = nullptr;
-        UIImageView *image1_ = nullptr;
-        UILabel *label2_ = nullptr;
-        UIImageView *image3_ = nullptr;
-        UILabel *label3_ = nullptr;
-        UIImageView *image5_ = nullptr;
-        UILabel *label4_ = nullptr;
+        UIButton *button3_ = nullptr;
+
+        UILabel *title_label = nullptr;
+        UILabel *btn1_label = nullptr;
+        UILabel *btn2_label = nullptr;
+        UILabel *btn3_label = nullptr;
+        UILabel *btnmore_label = nullptr;
+
+        UIImageView *btn1_image = nullptr;
+        UIImageView *btn2_image = nullptr;
+        UIImageView *btn3_image = nullptr;
     };
 } // namespace OHOS
 #endif // Traing_PRESENTER_H
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp
new file mode 100644 (file)
index 0000000..633fbc2
--- /dev/null
@@ -0,0 +1,144 @@
+#include "traing/include/TraingModel.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+    TraingModel ::TraingModel()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TraingModel::TraingModel()");
+        //quickTraining_ = &QuickTraining(); // 为quickTraining_赋初值
+    }
+    TraingModel ::~TraingModel()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TraingModel::~TraingModel()");
+    }
+    TraingModel *TraingModel::GetInstance(void)
+    {
+        static TraingModel instance;
+        return &instance;
+    }
+    /***
+     * @description:
+     * @param {QuickTraining} *quickTraining
+     * @brief 设置快捷训练
+     */
+    void TraingModel::SetQuickTraining( QuickTraining *quickTraining)
+    {
+        quickTraining_ = quickTraining;
+    }
+    /***
+     * @description:
+     * @return {quickTraining_}
+     * @brief 获取快捷训练
+     */
+    QuickTraining *TraingModel::GetQuickTraining() const
+    {
+        return quickTraining_;
+    }
+    /***
+     * @description: 初始化标签
+     * @param {UILabel} *
+     * @param {int} left
+     * @param {int} top
+     * @param {int} width
+     * @param {int} height
+     * @param {char} *viewId
+     * @param {char} *text
+     * @param {char} *fontName
+     * @param {int} fontSize
+     * @return
+     * @brief 初始化标签
+     */
+    bool TraingModel::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)
+    {
+        // 检查标签指针是否为空
+        if (label == nullptr)
+        {
+            label = new UILabel();
+        }
+        if (label == nullptr)
+        {
+            return false; // 内存分配失败,返回false
+        }
+        // 设置标签的位置和大小
+        label->SetPosition(left, top);
+        label->Resize(width, height);
+        // 设置标签的视图 ID
+        label->SetViewId(viewId);
+        // 设置标签的样式
+        label->SetStyle(STYLE_TEXT_FONT, fontSize);
+        label->SetFont(fontName, fontSize);
+        // 设置标签的文本和其他属性
+        label->SetText(text);
+        label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        label->SetRollSpeed(0);
+        // 设置标签可见
+        label->SetVisible(true);
+
+        return true;
+    }
+
+    /***
+     * @description:
+     * @param {UIButton} *
+     * @param {int} left
+     * @param {int} top
+     * @param {int} width
+     * @param {int} height
+     * @param {char} *viewId
+     * @return
+     * @brief 初始化按钮
+     */
+    bool TraingModel::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+    {
+        // 创建新按钮(如果当前按钮为空)
+        if (button == nullptr)
+        {
+            button = new UIButton();
+        }
+        if (button == nullptr)
+        {
+            return false; // 内存分配失败,返回false
+        }
+        button->SetPosition(left, top);
+        button->Resize(width, height);
+        button->SetViewId(viewId);
+        button->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BACKGROUND_COLOR);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BACKGROUND_COLOR, UIButton::PRESSED);
+        button->SetStyleForState(STYLE_BORDER_COLOR, PRESSED_BORDER_COLOR, UIButton::PRESSED);
+        button->SetVisible(true);
+        return true;
+    }
+
+    /***
+     * @description:
+     * @param {UIImageView} *
+     * @param {int} left
+     * @param {int} top
+     * @param {int} width
+     * @param {int} height
+     * @param {char} *viewId
+     * @param {char} *imagePath
+     * @return {*}
+     * @brief 初始化图片
+     */
+    bool TraingModel::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+    {
+        if (imageView == nullptr)
+        {
+            imageView = new UIImageView();
+        }
+        if (imageView == nullptr)
+        {
+            return false; // 内存分配失败,返回false
+        }
+        imageView->SetPosition(left, top);
+        imageView->Resize(width, height);
+        imageView->SetViewId(viewId);
+        imageView->SetSrc(imagePath);
+        imageView->SetVisible(true);
+        return true;
+    }
+
+}
\ No newline at end of file
index 44119bf..5b6f363 100644 (file)
@@ -61,7 +61,7 @@ namespace OHOS
         if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
             (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
         {\r
-            //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);\r
         }\r
         UNUSED(view);\r
         return true;\r
index 3000686..b8c360d 100644 (file)
 \r
 #include "traing/include/TraingView.h"\r
 \r
-#include "common/image_cache_manager.h"\r
-#include "UiConfig.h"\r
-#include "ui_resource_image.h"\r
-#include <ui_scroll_view.h>\r
-#include "components/ui_button.h"\r
 namespace OHOS\r
 {\r
+    // 按钮设置\r
+    static constexpr uint16_t BUTTON_WIDHT = 230;\r
+    static constexpr uint16_t BUTTON_HEIGHT = 80;\r
+    static constexpr uint16_t BUTTON1_X = 118;\r
+    static constexpr uint16_t BUTTON1_Y = 336;\r
+    static constexpr uint16_t BUTTON2_X = 118;\r
+    static constexpr uint16_t BUTTON2_Y = 336;\r
+    static constexpr uint16_t BUTTON3_X = 118;\r
+    static constexpr uint16_t BUTTON3_Y = 336;\r
+    static constexpr uint16_t BUTTONMORE_X = 118;\r
+    static constexpr uint16_t BUTTONMORE_Y = 336;\r
+\r
+    // 标签设置\r
+    static constexpr uint16_t LABEL_FONT_SIZE = 30;\r
+    static constexpr uint16_t LABEL_X_SIZE = 200;\r
+    static constexpr uint16_t LABEL_Y_SIZE = 60;\r
+    static constexpr uint16_t TITLE_LABEL_X = 83;\r
+    static constexpr uint16_t TITLE_LABEL_Y = 103;\r
+\r
+    static constexpr uint16_t BTN1_LABEL_X = 135;\r
+    static constexpr uint16_t BTN1_LABEL_Y = 210;\r
+    static constexpr uint16_t BTN2_LABEL_X = 286;\r
+    static constexpr uint16_t BTN2_LABEL_Y = 210;\r
+    static constexpr uint16_t BTN3_LABEL_X = 131;\r
+    static constexpr uint16_t BTN3_LABEL_Y = 365;\r
+\r
+    // 图片设置\r
+    static constexpr uint16_t BTN_IMAGE_SIZE = 100;\r
+    static constexpr uint16_t BTN1_IMAGE_X = 126;\r
+    static constexpr uint16_t BTN1_IMAGE_Y = 148;\r
+    static constexpr uint16_t BTN2_IMAGE_X = 276;\r
+    static constexpr uint16_t BTN2_IMAGE_Y = 148;\r
+    static constexpr uint16_t BTNMORE_IMAGE_X = 129;\r
+    static constexpr uint16_t BTNMORE_IMAGE_Y = 298;\r
+\r
     static TraingView *g_pTraingView{nullptr};\r
+    QuickTraining *data = new QuickTraining;\r
 \r
     TraingView::TraingView()\r
     {\r
-\r
+        data = TraingModel::GetInstance()->GetQuickTraining();\r
         g_pTraingView = this;\r
     }\r
 \r
     TraingView::~TraingView()\r
     {\r
-        DeInit();\r
+        DeInitView();\r
         g_pTraingView = nullptr;\r
+        delete data;\r
     }\r
-\r
     TraingView *TraingView::GetInstance()\r
     {\r
-\r
         return g_pTraingView;\r
     }\r
 \r
-    void TraingView::Init()\r
+    /***\r
+     * @description:\r
+     * @return\r
+     * @brief 添加标签\r
+     */\r
+    bool TraingView::AddLabel()\r
+    {\r
+        // 初始化标签\r
+        TraingModel::GetInstance()->InitLabel(title_label, TITLE_LABEL_X, TITLE_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "title_label", "快速训练", DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE);\r
+        const char *dataStr1 = data->training1_Text;\r
+        const char *dataStr2 = data->training2_Text;\r
+        const char *dataStr3 = data->training3_Text;\r
+        TraingModel::GetInstance()->InitLabel(btn1_label, BTN1_LABEL_X, BTN1_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu1_label", dataStr1, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE);\r
+        TraingModel::GetInstance()->InitLabel(btn2_label, BTN2_LABEL_X, BTN2_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu2_label", dataStr2, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE);\r
+        TraingModel::GetInstance()->InitLabel(btn3_label, BTN3_LABEL_X, BTN3_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu3_label", dataStr3, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE);\r
+        return true;\r
+    }\r
+\r
+    bool TraingView::AddButton()\r
+    {\r
+    }\r
+    /***\r
+     * @description:\r
+     * @return\r
+     * @brief 添加图片\r
+     */\r
+    bool TraingView::AddImageView()\r
+    {\r
+        const char *dataStr1 = data->training1_Image;\r
+        const char *dataStr2 = data->training2_Image;\r
+        const char *dataStr3 = data->training3_Image;\r
+        TraingModel::GetInstance()->InitImageView(btn1_image, BTN1_IMAGE_X, BTN1_IMAGE_Y, BTN_IMAGE_SIZE, BTN_IMAGE_SIZE, "btn1_image", dataStr1);\r
+        TraingModel::GetInstance()->InitImageView(btn2_image, BTN2_IMAGE_X, BTN2_IMAGE_Y, BTN_IMAGE_SIZE, BTN_IMAGE_SIZE, "btn2_image", dataStr2);\r
+        TraingModel::GetInstance()->InitImageView(btn3_image, BTN3_LABEL_X, BTN3_LABEL_Y, BTN_IMAGE_SIZE, BTN_IMAGE_SIZE, "btn3_image", dataStr3);\r
+        return true;\r
+    }\r
+    void TraingView::InitView()\r
     {\r
         if (container_ == nullptr)\r
         {\r
@@ -37,27 +103,11 @@ namespace OHOS
             container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
         }\r
 \r
-        // Add Label to App\r
-        if (label1_ == nullptr)\r
-        {\r
-            label1_ = new UILabel();\r
-        }\r
-        label1_->SetPosition(173, 52); // widget's left position and top position\r
-        label1_->Resize(200, 60);      // widget's width and height\r
-        label1_->SetViewId("label1");  // Set style\r
-        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        // 初始化按键\r
 \r
-        // Set additional property\r
-        label1_->SetText("快速训练");\r
-        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_->SetRollSpeed(0);\r
-        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
-        // Add to rootView\r
-        container_->Add(label1_);\r
-        label1_->SetVisible(true);\r
+        // 初始化标签\r
 \r
+#if 0\r
         // Add Button to App\r
         if (button3_ == nullptr)\r
         {\r
@@ -68,26 +118,18 @@ namespace OHOS
         button3_->SetViewId(BUTTONMORE); // Set style\r
         button3_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
         button3_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button3defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Training/More.bin";\r
-#else\r
         const char *button3defaultImgSrc = PNG_TRAING_BOUTTONMORE_IMAGE;\r
-#endif\r
         char *button3triggeredImgSrc = nullptr;\r
         button3_->SetImageSrc(button3defaultImgSrc, button3triggeredImgSrc);\r
         button3_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff33df1c, UIButton::PRESSED);\r
         button3_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
         button3_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
         // Add the CallBack about events\r
         UIView::OnClickListener *button3Click = static_cast<UIView::OnClickListener *>(TraingPresenter::GetInstance());\r
         button3_->SetOnClickListener(button3Click);\r
         // Add to rootView\r
         container_->Add(button3_);\r
         button3_->SetVisible(true);\r
-\r
         // Add Button to App\r
         if (button4_ == nullptr)\r
         {\r
@@ -98,20 +140,13 @@ namespace OHOS
         button4_->SetViewId(BUTTON2);   // Set style\r
         button4_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
         button4_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button4defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Training/Buttonground2.bin";\r
-#else\r
         const char *button4defaultImgSrc = PNG_TRAING_BUTTONGRONG2_IMAGE;\r
-#endif\r
         char *button4triggeredImgSrc = nullptr;\r
         button4_->SetImageSrc(button4defaultImgSrc, button4triggeredImgSrc);\r
         button4_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff33df1c, UIButton::PRESSED);\r
         button4_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
         button4_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
 \r
-        // Add the CallBack about events\r
         UIView::OnClickListener *button4Click = static_cast<UIView::OnClickListener *>(TraingPresenter::GetInstance());\r
         button4_->SetOnClickListener(button4Click);\r
         // Add to rootView\r
@@ -129,12 +164,7 @@ namespace OHOS
         button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
         button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
 \r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Training/Bouttonground.bin";\r
-#else\r
         const char *button1defaultImgSrc = PNG_TRAING_BUTTONGRONG_IMAGE;\r
-#endif\r
         char *button1triggeredImgSrc = nullptr;\r
         button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
         button1_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff33df1c, UIButton::PRESSED);\r
@@ -159,12 +189,7 @@ namespace OHOS
         button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
         button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
 \r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button2defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Training/Bouttonground.bin";\r
-#else\r
         const char *button2defaultImgSrc = PNG_TRAING_BUTTONGRONG_IMAGE;\r
-#endif\r
         char *button2triggeredImgSrc = nullptr;\r
         button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);\r
         button2_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff33df1c, UIButton::PRESSED);\r
@@ -177,135 +202,10 @@ namespace OHOS
         // Add to rootView\r
         container_->Add(button2_);\r
         button2_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image1_ == nullptr)\r
-        {\r
-            image1_ = new UIImageView();\r
-        }\r
-        image1_->SetPosition(276, 148); // widget's left position and top position\r
-        image1_->Resize(100, 100);      // widget's width and height\r
-        image1_->SetViewId("image2");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Training/riding-big2.bin";\r
-#else\r
-        const char *image1imagesPath = PNG_TRAING_RIDINGBIG_IMAGE;\r
-#endif\r
-        image1_->SetSrc(image1imagesPath);\r
-\r
-        // Add to rootView\r
-        container_->Add(image1_);\r
-        image1_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label2_ == nullptr)\r
-        {\r
-            label2_ = new UILabel();\r
-        }\r
-        label2_->SetPosition(286, 210); // widget's left position and top position\r
-        label2_->Resize(200, 60);       // widget's width and height\r
-        label2_->SetViewId("label2");   // Set style\r
-        label2_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
-        // Set additional property\r
-        label2_->SetText("骑行");\r
-        label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label2_->SetRollSpeed(0);\r
-        label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
-        // Add to rootView\r
-        container_->Add(label2_);\r
-        label2_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image3_ == nullptr)\r
-        {\r
-            image3_ = new UIImageView();\r
-        }\r
-        image3_->SetPosition(126, 298); // widget's left position and top position\r
-        image3_->Resize(100, 100);      // widget's width and height\r
-        image3_->SetViewId("image3");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image3imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Training/running-big.bin";\r
-#else\r
-        const char *image3imagesPath = PNG_TRAING_RUNNINGBIG_IMAGE;\r
-#endif\r
-        image3_->SetSrc(image3imagesPath);\r
-\r
-        // Add to rootView\r
-        container_->Add(image3_);\r
-        image3_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label3_ == nullptr)\r
-        {\r
-            label3_ = new UILabel();\r
-        }\r
-        label3_->SetPosition(135, 210); // widget's left position and top position\r
-        label3_->Resize(200, 60);       // widget's width and height\r
-        label3_->SetViewId("label3");   // Set style\r
-        label3_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
-        // Set additional property\r
-        label3_->SetText("健走");\r
-        label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label3_->SetRollSpeed(0);\r
-        label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
-        // Add to rootView\r
-        container_->Add(label3_);\r
-        label3_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image5_ == nullptr)\r
-        {\r
-            image5_ = new UIImageView();\r
-        }\r
-        image5_->SetPosition(126, 148); // widget's left position and top position\r
-        image5_->Resize(100, 100);      // widget's width and height\r
-        image5_->SetViewId("image1");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image5imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Training/walking-big.bin";\r
-#else\r
-        const char *image5imagesPath = PNG_TRAING_WALKINGBIG_IMAGE;\r
 #endif\r
-        image5_->SetSrc(image5imagesPath);\r
-\r
-        // Add to rootView\r
-        container_->Add(image5_);\r
-        image5_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label4_ == nullptr)\r
-        {\r
-            label4_ = new UILabel();\r
-        }\r
-        label4_->SetPosition(131, 365); // widget's left position and top position\r
-        label4_->Resize(200, 60);       // widget's width and height\r
-        label4_->SetViewId("label4");   // Set style\r
-        label4_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
-        // Set additional property\r
-        label4_->SetText("跑步");\r
-        label4_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label4_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label4_->SetRollSpeed(0);\r
-        label4_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
-        // Add to rootView\r
-        container_->Add(label4_);\r
-        label4_->SetVisible(true);\r
     }\r
 \r
-    void TraingView::DeInit()\r
+    void TraingView::DeInitView()\r
     {\r
         if (container_ != nullptr)\r
         {\r
@@ -313,66 +213,11 @@ namespace OHOS
             delete container_;\r
             container_ = nullptr;\r
         }\r
-        if (label1_ != nullptr)\r
-        {\r
-            delete label1_;\r
-            label1_ = nullptr;\r
-        }\r
-        if (button3_ != nullptr)\r
-        {\r
-            delete button3_;\r
-            button3_ = nullptr;\r
-        }\r
-        if (button4_ != nullptr)\r
-        {\r
-            delete button4_;\r
-            button4_ = nullptr;\r
-        }\r
-        if (button1_ != nullptr)\r
-        {\r
-            delete button1_;\r
-            button1_ = nullptr;\r
-        }\r
-        if (button2_ != nullptr)\r
-        {\r
-            delete button2_;\r
-            button2_ = nullptr;\r
-        }\r
-        if (image1_ != nullptr)\r
-        {\r
-            delete image1_;\r
-            image1_ = nullptr;\r
-        }\r
-        if (label2_ != nullptr)\r
-        {\r
-            delete label2_;\r
-            label2_ = nullptr;\r
-        }\r
-        if (image3_ != nullptr)\r
-        {\r
-            delete image3_;\r
-            image3_ = nullptr;\r
-        }\r
-        if (label3_ != nullptr)\r
-        {\r
-            delete label3_;\r
-            label3_ = nullptr;\r
-        }\r
-        if (image5_ != nullptr)\r
-        {\r
-            delete image5_;\r
-            image5_ = nullptr;\r
-        }\r
-        if (label4_ != nullptr)\r
-        {\r
-            delete label4_;\r
-            label4_ = nullptr;\r
-        }\r
     }\r
 \r
     UIView *TraingView::GetView()\r
     {\r
-        Init();\r
+        InitView();\r
         return container_;\r
     }\r
 \r
index 2c92dfb..8c64553 100644 (file)
@@ -48,22 +48,22 @@ static uint32_t cywee_do_test(uint8_t *para, uint32_t paraLen, char *strCommonCm
 
     int ret = ConvertCmdToParam(para, paraLen, argv, &argc);
     if (ret != ERRCODE_SUCC) {
-        PRINT("CYWEETEST ATCMD Convert Command Failed\n");
+        //PRINT("CYWEETEST ATCMD Convert Command Failed\n");
         return ERRCODE_FAIL;
     }
     if (argc < 1) {
-        PRINT("CYWEETEST ATCMD Set Parameter Failed\n");
+        //PRINT("CYWEETEST ATCMD Set Parameter Failed\n");
         return ERRCODE_FAIL;
     }
     char *mode = (char*)argv[0];
     if (strcmp(mode, "start") == 0) {
-        PRINT("cywee start\n");
+        //PRINT("cywee start\n");
         do_cywee_service_check_msg(CYWEE_SERVICE_CMD_START_CHECK);
     } else if (strcmp(mode, "stop") == 0) {
-        PRINT("cywee stop\n");
+        //PRINT("cywee stop\n");
         do_cywee_service_check_msg(CYWEE_SERVICE_CMD_STOP_CHECK);
     } else if (strcmp(mode, "test") == 0) {
-        PRINT("cywee test\n");
+        //PRINT("cywee test\n");
         do_cywee_service_check_msg(CYWEE_SERVICE_CMD_TEST);
     } 
     return ERRCODE_SUCC;