提交
authorCaisking <3449750381@qq.com>
Tue, 12 Dec 2023 06:27:27 +0000 (14:27 +0800)
committerCaisking <3449750381@qq.com>
Tue, 12 Dec 2023 06:27:27 +0000 (14:27 +0800)
148 files changed:
Resource/res/Training/Go_2.bin [new file with mode: 0644]
Resource/res/Training/Line 1.bin [new file with mode: 0644]
Resource/res/Training/Line 2.bin [new file with mode: 0644]
Resource/res/Training/Line 3.bin [new file with mode: 0644]
Resource/res/Training/Line 4.bin [new file with mode: 0644]
Resource/res/Training/Line.bin [new file with mode: 0644]
Resource/res/Training/Walking_54.bin [new file with mode: 0644]
Resource/res/Training/arrows.bin [new file with mode: 0644]
Resource/res/Training/black_piont.bin [new file with mode: 0644]
Resource/res/Training/bubble.bin [new file with mode: 0644]
Resource/res/Training/bubble_piont.bin [new file with mode: 0644]
Resource/res/Training/calories_30.bin [new file with mode: 0644]
Resource/res/Training/control_point.bin [new file with mode: 0644]
Resource/res/Training/data_point.bin [new file with mode: 0644]
Resource/res/Training/heartrate_30.bin [new file with mode: 0644]
Resource/res/Training/inco_up.bin [new file with mode: 0644]
Resource/res/Training/inco_up_40.bin [new file with mode: 0644]
Resource/res/Training/mileage_30.bin [new file with mode: 0644]
Resource/res/Training/no.bin [new file with mode: 0644]
Resource/res/Training/note.bin [new file with mode: 0644]
Resource/res/Training/path.bin [new file with mode: 0644]
Resource/res/Training/progress.bin [new file with mode: 0644]
Resource/res/Training/sport-strength.bin [new file with mode: 0644]
Resource/res/Training/step_30.bin [new file with mode: 0644]
Resource/res/Training/warning.bin [new file with mode: 0644]
Resource/res/Training/yes.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_END.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_FIVE_MINUTE.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_ONE_MINUTE.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_PAUSE.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_PLAY.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_RESET.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_TEN_MINUTE.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_THIRTY_MINUTE.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWM_VECTOR.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWN_ATTENTION.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWN_BUTTON.bin [new file with mode: 0644]
Resource/res/countdown/COUNTDOWN_COLONE.bin [new file with mode: 0644]
Resource/res/stopwatch/STOPWATCH_MARK.bin [new file with mode: 0644]
Resource/res/stopwatch/STOPWATH_RESET1.bin [new file with mode: 0644]
Resource/res/stopwatch/STOPWATH_RESET2.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_BACKGROUND.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_CLEAR-SUNNY.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_DUSTSTORM.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_FOGGY.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_HAZE.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_HUMIDITY.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_OVERCAST.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_RAIN.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_SNOW.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_SUNNY-CLOUNDY.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_SUNNY.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_UVI.bin [new file with mode: 0644]
Resource/res/weather/WEATHER_WINDSPEED.bin [new file with mode: 0644]
Resource/res/weather/weather_clear-cloudy.bin [new file with mode: 0644]
Resource/res/weather/weather_sunny-cloudy.bin [new file with mode: 0644]
Resource/res/weather/weather_thundershower.bin [new file with mode: 0644]
Resource/res/weather/weather_unknown.bin [new file with mode: 0644]
build/.cmake/api/v1/query/client-vscode/query.json [new file with mode: 0644]
build/CMakeCache.txt [new file with mode: 0644]
build/CMakeFiles/cmake.check_cache [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownModel.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeConfigPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeConfigView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeNotNullPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeNotNullView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/MainCountDownPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/MainCountDownView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/StartCountDownPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/include/StartCountDownView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownModel.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeConfigPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeConfigView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeNotNullPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeNotNullView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/MainCountDownPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/MainCountDownView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/StartCountDownPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/countdown/src/StartCountDownView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/MainStopWatchPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/MainStopWatchView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchModel.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordCycleToLimitPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordCycleToLimitView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordTimeToLimitPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordTimeToLimitView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/MainStopWatchPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchModel.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordCycleToLimitPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordCycleToLimitView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordTimeToLimitPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordTimeToLimitView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingCardPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingCardView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingControlPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingControlView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDataPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDataView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDetailPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDetailView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEnddataPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEnddataView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEndnotePresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEndnoteView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSlackPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSlackView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSnotePresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSnoteView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingSetCaluliPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingCardPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingCardView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingControlPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingControlView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDataPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDataView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDetailPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDetailView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEnddataPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEnddataView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEndnotePresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEndnoteView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSnotePresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSnoteView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingSetCaluliPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingSetCaluliView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/include/FutureWeatherPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/include/FutureWeatherView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/include/GetWeatherDataErrorPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/include/GetWeatherDataErrorView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/include/MainWeatherPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/include/MainWeatherView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/include/WeatherReportPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/include/WeatherReportView.h [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/src/FutureWeatherPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/src/FutureWeatherView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/src/GetWeatherDataErrorPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/src/GetWeatherDataErrorView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/src/MainWeatherPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/src/MainWeatherView.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherReportPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherReportView.cpp [new file with mode: 0644]

diff --git a/Resource/res/Training/Go_2.bin b/Resource/res/Training/Go_2.bin
new file mode 100644 (file)
index 0000000..ec87acf
Binary files /dev/null and b/Resource/res/Training/Go_2.bin differ
diff --git a/Resource/res/Training/Line 1.bin b/Resource/res/Training/Line 1.bin
new file mode 100644 (file)
index 0000000..f04c971
Binary files /dev/null and b/Resource/res/Training/Line 1.bin differ
diff --git a/Resource/res/Training/Line 2.bin b/Resource/res/Training/Line 2.bin
new file mode 100644 (file)
index 0000000..635cb2c
Binary files /dev/null and b/Resource/res/Training/Line 2.bin differ
diff --git a/Resource/res/Training/Line 3.bin b/Resource/res/Training/Line 3.bin
new file mode 100644 (file)
index 0000000..f435d9c
Binary files /dev/null and b/Resource/res/Training/Line 3.bin differ
diff --git a/Resource/res/Training/Line 4.bin b/Resource/res/Training/Line 4.bin
new file mode 100644 (file)
index 0000000..b56c169
Binary files /dev/null and b/Resource/res/Training/Line 4.bin differ
diff --git a/Resource/res/Training/Line.bin b/Resource/res/Training/Line.bin
new file mode 100644 (file)
index 0000000..9ba40f7
Binary files /dev/null and b/Resource/res/Training/Line.bin differ
diff --git a/Resource/res/Training/Walking_54.bin b/Resource/res/Training/Walking_54.bin
new file mode 100644 (file)
index 0000000..0c97705
Binary files /dev/null and b/Resource/res/Training/Walking_54.bin differ
diff --git a/Resource/res/Training/arrows.bin b/Resource/res/Training/arrows.bin
new file mode 100644 (file)
index 0000000..797a64a
Binary files /dev/null and b/Resource/res/Training/arrows.bin differ
diff --git a/Resource/res/Training/black_piont.bin b/Resource/res/Training/black_piont.bin
new file mode 100644 (file)
index 0000000..a9bc0b8
Binary files /dev/null and b/Resource/res/Training/black_piont.bin differ
diff --git a/Resource/res/Training/bubble.bin b/Resource/res/Training/bubble.bin
new file mode 100644 (file)
index 0000000..268046d
Binary files /dev/null and b/Resource/res/Training/bubble.bin differ
diff --git a/Resource/res/Training/bubble_piont.bin b/Resource/res/Training/bubble_piont.bin
new file mode 100644 (file)
index 0000000..818a9ab
Binary files /dev/null and b/Resource/res/Training/bubble_piont.bin differ
diff --git a/Resource/res/Training/calories_30.bin b/Resource/res/Training/calories_30.bin
new file mode 100644 (file)
index 0000000..8674a59
Binary files /dev/null and b/Resource/res/Training/calories_30.bin differ
diff --git a/Resource/res/Training/control_point.bin b/Resource/res/Training/control_point.bin
new file mode 100644 (file)
index 0000000..199c0f1
Binary files /dev/null and b/Resource/res/Training/control_point.bin differ
diff --git a/Resource/res/Training/data_point.bin b/Resource/res/Training/data_point.bin
new file mode 100644 (file)
index 0000000..0cd66a1
Binary files /dev/null and b/Resource/res/Training/data_point.bin differ
diff --git a/Resource/res/Training/heartrate_30.bin b/Resource/res/Training/heartrate_30.bin
new file mode 100644 (file)
index 0000000..1697c6b
Binary files /dev/null and b/Resource/res/Training/heartrate_30.bin differ
diff --git a/Resource/res/Training/inco_up.bin b/Resource/res/Training/inco_up.bin
new file mode 100644 (file)
index 0000000..d81048b
Binary files /dev/null and b/Resource/res/Training/inco_up.bin differ
diff --git a/Resource/res/Training/inco_up_40.bin b/Resource/res/Training/inco_up_40.bin
new file mode 100644 (file)
index 0000000..96f8969
Binary files /dev/null and b/Resource/res/Training/inco_up_40.bin differ
diff --git a/Resource/res/Training/mileage_30.bin b/Resource/res/Training/mileage_30.bin
new file mode 100644 (file)
index 0000000..76237bd
Binary files /dev/null and b/Resource/res/Training/mileage_30.bin differ
diff --git a/Resource/res/Training/no.bin b/Resource/res/Training/no.bin
new file mode 100644 (file)
index 0000000..fb89e49
Binary files /dev/null and b/Resource/res/Training/no.bin differ
diff --git a/Resource/res/Training/note.bin b/Resource/res/Training/note.bin
new file mode 100644 (file)
index 0000000..48ab51d
Binary files /dev/null and b/Resource/res/Training/note.bin differ
diff --git a/Resource/res/Training/path.bin b/Resource/res/Training/path.bin
new file mode 100644 (file)
index 0000000..ab6c2a8
Binary files /dev/null and b/Resource/res/Training/path.bin differ
diff --git a/Resource/res/Training/progress.bin b/Resource/res/Training/progress.bin
new file mode 100644 (file)
index 0000000..2d456e0
Binary files /dev/null and b/Resource/res/Training/progress.bin differ
diff --git a/Resource/res/Training/sport-strength.bin b/Resource/res/Training/sport-strength.bin
new file mode 100644 (file)
index 0000000..2f682a0
Binary files /dev/null and b/Resource/res/Training/sport-strength.bin differ
diff --git a/Resource/res/Training/step_30.bin b/Resource/res/Training/step_30.bin
new file mode 100644 (file)
index 0000000..98998f9
Binary files /dev/null and b/Resource/res/Training/step_30.bin differ
diff --git a/Resource/res/Training/warning.bin b/Resource/res/Training/warning.bin
new file mode 100644 (file)
index 0000000..7301e28
Binary files /dev/null and b/Resource/res/Training/warning.bin differ
diff --git a/Resource/res/Training/yes.bin b/Resource/res/Training/yes.bin
new file mode 100644 (file)
index 0000000..2e14630
Binary files /dev/null and b/Resource/res/Training/yes.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_END.bin b/Resource/res/countdown/COUNTDOWM_END.bin
new file mode 100644 (file)
index 0000000..85ed573
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_END.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_FIVE_MINUTE.bin b/Resource/res/countdown/COUNTDOWM_FIVE_MINUTE.bin
new file mode 100644 (file)
index 0000000..7dd2cf8
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_FIVE_MINUTE.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_ONE_MINUTE.bin b/Resource/res/countdown/COUNTDOWM_ONE_MINUTE.bin
new file mode 100644 (file)
index 0000000..d0efbc5
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_ONE_MINUTE.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_PAUSE.bin b/Resource/res/countdown/COUNTDOWM_PAUSE.bin
new file mode 100644 (file)
index 0000000..87c1874
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_PAUSE.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_PLAY.bin b/Resource/res/countdown/COUNTDOWM_PLAY.bin
new file mode 100644 (file)
index 0000000..97b64f8
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_PLAY.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_RESET.bin b/Resource/res/countdown/COUNTDOWM_RESET.bin
new file mode 100644 (file)
index 0000000..2d3105e
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_RESET.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_TEN_MINUTE.bin b/Resource/res/countdown/COUNTDOWM_TEN_MINUTE.bin
new file mode 100644 (file)
index 0000000..7a2e102
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_TEN_MINUTE.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_THIRTY_MINUTE.bin b/Resource/res/countdown/COUNTDOWM_THIRTY_MINUTE.bin
new file mode 100644 (file)
index 0000000..ba69e92
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_THIRTY_MINUTE.bin differ
diff --git a/Resource/res/countdown/COUNTDOWM_VECTOR.bin b/Resource/res/countdown/COUNTDOWM_VECTOR.bin
new file mode 100644 (file)
index 0000000..40be9d1
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWM_VECTOR.bin differ
diff --git a/Resource/res/countdown/COUNTDOWN_ATTENTION.bin b/Resource/res/countdown/COUNTDOWN_ATTENTION.bin
new file mode 100644 (file)
index 0000000..b8120b8
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWN_ATTENTION.bin differ
diff --git a/Resource/res/countdown/COUNTDOWN_BUTTON.bin b/Resource/res/countdown/COUNTDOWN_BUTTON.bin
new file mode 100644 (file)
index 0000000..5f89b63
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWN_BUTTON.bin differ
diff --git a/Resource/res/countdown/COUNTDOWN_COLONE.bin b/Resource/res/countdown/COUNTDOWN_COLONE.bin
new file mode 100644 (file)
index 0000000..f3d90d9
Binary files /dev/null and b/Resource/res/countdown/COUNTDOWN_COLONE.bin differ
diff --git a/Resource/res/stopwatch/STOPWATCH_MARK.bin b/Resource/res/stopwatch/STOPWATCH_MARK.bin
new file mode 100644 (file)
index 0000000..482ef15
Binary files /dev/null and b/Resource/res/stopwatch/STOPWATCH_MARK.bin differ
diff --git a/Resource/res/stopwatch/STOPWATH_RESET1.bin b/Resource/res/stopwatch/STOPWATH_RESET1.bin
new file mode 100644 (file)
index 0000000..66a43d7
Binary files /dev/null and b/Resource/res/stopwatch/STOPWATH_RESET1.bin differ
diff --git a/Resource/res/stopwatch/STOPWATH_RESET2.bin b/Resource/res/stopwatch/STOPWATH_RESET2.bin
new file mode 100644 (file)
index 0000000..2730fd9
Binary files /dev/null and b/Resource/res/stopwatch/STOPWATH_RESET2.bin differ
diff --git a/Resource/res/weather/WEATHER_BACKGROUND.bin b/Resource/res/weather/WEATHER_BACKGROUND.bin
new file mode 100644 (file)
index 0000000..143df27
Binary files /dev/null and b/Resource/res/weather/WEATHER_BACKGROUND.bin differ
diff --git a/Resource/res/weather/WEATHER_CLEAR-SUNNY.bin b/Resource/res/weather/WEATHER_CLEAR-SUNNY.bin
new file mode 100644 (file)
index 0000000..150f902
Binary files /dev/null and b/Resource/res/weather/WEATHER_CLEAR-SUNNY.bin differ
diff --git a/Resource/res/weather/WEATHER_DUSTSTORM.bin b/Resource/res/weather/WEATHER_DUSTSTORM.bin
new file mode 100644 (file)
index 0000000..f1a9c60
Binary files /dev/null and b/Resource/res/weather/WEATHER_DUSTSTORM.bin differ
diff --git a/Resource/res/weather/WEATHER_FOGGY.bin b/Resource/res/weather/WEATHER_FOGGY.bin
new file mode 100644 (file)
index 0000000..b16fc33
Binary files /dev/null and b/Resource/res/weather/WEATHER_FOGGY.bin differ
diff --git a/Resource/res/weather/WEATHER_HAZE.bin b/Resource/res/weather/WEATHER_HAZE.bin
new file mode 100644 (file)
index 0000000..a77f3a7
Binary files /dev/null and b/Resource/res/weather/WEATHER_HAZE.bin differ
diff --git a/Resource/res/weather/WEATHER_HUMIDITY.bin b/Resource/res/weather/WEATHER_HUMIDITY.bin
new file mode 100644 (file)
index 0000000..678ff93
Binary files /dev/null and b/Resource/res/weather/WEATHER_HUMIDITY.bin differ
diff --git a/Resource/res/weather/WEATHER_OVERCAST.bin b/Resource/res/weather/WEATHER_OVERCAST.bin
new file mode 100644 (file)
index 0000000..e888f9c
Binary files /dev/null and b/Resource/res/weather/WEATHER_OVERCAST.bin differ
diff --git a/Resource/res/weather/WEATHER_RAIN.bin b/Resource/res/weather/WEATHER_RAIN.bin
new file mode 100644 (file)
index 0000000..ede8375
Binary files /dev/null and b/Resource/res/weather/WEATHER_RAIN.bin differ
diff --git a/Resource/res/weather/WEATHER_SNOW.bin b/Resource/res/weather/WEATHER_SNOW.bin
new file mode 100644 (file)
index 0000000..27d521e
Binary files /dev/null and b/Resource/res/weather/WEATHER_SNOW.bin differ
diff --git a/Resource/res/weather/WEATHER_SUNNY-CLOUNDY.bin b/Resource/res/weather/WEATHER_SUNNY-CLOUNDY.bin
new file mode 100644 (file)
index 0000000..4460e92
Binary files /dev/null and b/Resource/res/weather/WEATHER_SUNNY-CLOUNDY.bin differ
diff --git a/Resource/res/weather/WEATHER_SUNNY.bin b/Resource/res/weather/WEATHER_SUNNY.bin
new file mode 100644 (file)
index 0000000..75c9542
Binary files /dev/null and b/Resource/res/weather/WEATHER_SUNNY.bin differ
diff --git a/Resource/res/weather/WEATHER_UVI.bin b/Resource/res/weather/WEATHER_UVI.bin
new file mode 100644 (file)
index 0000000..9a1e8ce
Binary files /dev/null and b/Resource/res/weather/WEATHER_UVI.bin differ
diff --git a/Resource/res/weather/WEATHER_WINDSPEED.bin b/Resource/res/weather/WEATHER_WINDSPEED.bin
new file mode 100644 (file)
index 0000000..1b02cde
Binary files /dev/null and b/Resource/res/weather/WEATHER_WINDSPEED.bin differ
diff --git a/Resource/res/weather/weather_clear-cloudy.bin b/Resource/res/weather/weather_clear-cloudy.bin
new file mode 100644 (file)
index 0000000..96d1653
Binary files /dev/null and b/Resource/res/weather/weather_clear-cloudy.bin differ
diff --git a/Resource/res/weather/weather_sunny-cloudy.bin b/Resource/res/weather/weather_sunny-cloudy.bin
new file mode 100644 (file)
index 0000000..b3eae3b
Binary files /dev/null and b/Resource/res/weather/weather_sunny-cloudy.bin differ
diff --git a/Resource/res/weather/weather_thundershower.bin b/Resource/res/weather/weather_thundershower.bin
new file mode 100644 (file)
index 0000000..148c18b
Binary files /dev/null and b/Resource/res/weather/weather_thundershower.bin differ
diff --git a/Resource/res/weather/weather_unknown.bin b/Resource/res/weather/weather_unknown.bin
new file mode 100644 (file)
index 0000000..50b0ff8
Binary files /dev/null and b/Resource/res/weather/weather_unknown.bin differ
diff --git a/build/.cmake/api/v1/query/client-vscode/query.json b/build/.cmake/api/v1/query/client-vscode/query.json
new file mode 100644 (file)
index 0000000..82bb964
--- /dev/null
@@ -0,0 +1 @@
+{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]}
\ No newline at end of file
diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt
new file mode 100644 (file)
index 0000000..675df3f
--- /dev/null
@@ -0,0 +1,65 @@
+# This is the CMakeCache file.\r
+# For build in directory: /home/luozheng/FD230/build\r
+# It was generated by CMake: /usr/bin/cmake\r
+# You can edit this file to change values found and used by cmake.\r
+# If you do not want to change any of the values, simply exit the editor.\r
+# If you do want to change a value, simply edit, save, and exit the editor.\r
+# The syntax for the file is as follows:\r
+# KEY:TYPE=VALUE\r
+# KEY is the name of a variable in the cache.\r
+# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.\r
+# VALUE is the current value for the KEY.\r
+\r
+########################\r
+# EXTERNAL cache entries\r
+########################\r
+\r
+//No help, variable specified on the command line.\r
+CMAKE_BUILD_TYPE:STRING=Debug\r
+\r
+//No help, variable specified on the command line.\r
+CMAKE_CXX_COMPILER:FILEPATH=/mnt/d/tool/mingw64/bin/g++.exe\r
+\r
+//No help, variable specified on the command line.\r
+CMAKE_C_COMPILER:FILEPATH=/mnt/d/tool/mingw64/bin/gcc.exe\r
+\r
+//No help, variable specified on the command line.\r
+CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE\r
+\r
+\r
+########################\r
+# INTERNAL cache entries\r
+########################\r
+\r
+//This is the directory where this CMakeCache.txt was created\r
+CMAKE_CACHEFILE_DIR:INTERNAL=/home/luozheng/FD230/build\r
+//Major version of cmake used to create the current loaded cache\r
+CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3\r
+//Minor version of cmake used to create the current loaded cache\r
+CMAKE_CACHE_MINOR_VERSION:INTERNAL=16\r
+//Patch version of cmake used to create the current loaded cache\r
+CMAKE_CACHE_PATCH_VERSION:INTERNAL=3\r
+//Path to CMake executable.\r
+CMAKE_COMMAND:INTERNAL=/usr/bin/cmake\r
+//Path to cpack program executable.\r
+CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack\r
+//Path to ctest program executable.\r
+CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest\r
+//Name of external makefile project generator.\r
+CMAKE_EXTRA_GENERATOR:INTERNAL=\r
+//Name of generator.\r
+CMAKE_GENERATOR:INTERNAL=Ninja\r
+//Generator instance identifier.\r
+CMAKE_GENERATOR_INSTANCE:INTERNAL=\r
+//Name of generator platform.\r
+CMAKE_GENERATOR_PLATFORM:INTERNAL=\r
+//Name of generator toolset.\r
+CMAKE_GENERATOR_TOOLSET:INTERNAL=\r
+//Source directory with the top level CMakeLists.txt file for this\r
+// project\r
+CMAKE_HOME_DIRECTORY:INTERNAL=/home/luozheng/FD230/code/sdk\r
+//number of local generators\r
+CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1\r
+//Path to CMake installation.\r
+CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.16\r
+\r
diff --git a/build/CMakeFiles/cmake.check_cache b/build/CMakeFiles/cmake.check_cache
new file mode 100644 (file)
index 0000000..56c437b
--- /dev/null
@@ -0,0 +1 @@
+# This file is generated by cmake for dependency checking of the CMakeCache.txt file\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownModel.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownModel.h
new file mode 100644 (file)
index 0000000..59161b8
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef COUNTDOWN_MODEL_H\r
+#define COUNTDOWN_MODEL_H\r
+\r
+#include <iostream>\r
+#include <memory>\r
+\r
+namespace OHOS\r
+{\r
+    class CountDownModel\r
+    {\r
+    public:\r
+        static std::shared_ptr<CountDownModel> GetInstance(); // shared_ptr:当没有引用指向这个实例时会自动释放内存\r
+        ~CountDownModel() {}\r
+        void SetCountDownTime(const std::string &countdowntime); // 设置倒计时时间\r
+        std::string GetCountDownTime(void);                      // 获取倒计时时间\r
+        void SetRingTime(const std::string &ringtime);           // 设置响铃时间\r
+        std::string GetRingTime(void);                           // 获取响铃时间\r
+\r
+    private:\r
+        CountDownModel() {}\r
+        std::string RingTime{"00:00:00"};  // 响铃时间\r
+        std::string CountTime{"00:00:00"}; // 倒计时时间\r
+    };\r
+}\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeConfigPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeConfigPresenter.h
new file mode 100644 (file)
index 0000000..fdecd4f
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef COUNTDOWN_TIME_CONFIG_PRESENTER_H\r
+#define COUNTDOWN_TIME_CONFIG_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "CountDownTimeConfigView.h"\r
+#include "components/ui_time_picker.h"\r
+#include "components/ui_label.h"\r
+/*倒计时时间配置*/\r
+namespace OHOS\r
+{\r
+    class CountDownTimeConfigView;\r
+\r
+    class CountDownTimeConfigPresenter : public Presenter<CountDownTimeConfigView>,\r
+                                         public UIView::OnClickListener,\r
+                                         public UIView::OnDragListener,\r
+                                         UITimePicker::SelectedListener\r
+    {\r
+    public:\r
+        CountDownTimeConfigPresenter();\r
+        virtual ~CountDownTimeConfigPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static CountDownTimeConfigPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+        void OnTimePickerStoped(UITimePicker &picker) override;\r
+        \r
+        static std::string countdowntime;\r
+        static std::string ringtime;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeConfigView.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeConfigView.h
new file mode 100644 (file)
index 0000000..67e47cb
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef COUNTDOWN_TIME_CONFIG_VIEW_H\r
+#define COUNTDOWN_TIME_CONFIG_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_time_picker.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+/*倒计时时间配置*/\r
+namespace OHOS\r
+{\r
+    static const char *ColoneImagesPath = "/user/res/countdown/COUNTDOWN_COLONE.bin";                // 冒号图片\r
+    static const char *start_countdown_button_imagePath = "/user/res/countdown/COUNTDOWM_PAUSE.bin"; // 开始倒计时按钮图片\r
+    static const char *start_countdown_button_viewid = "start_countdown";                            // 开始倒计时按钮视图id\r
+    class CountDownTimeConfigPresenter;\r
+    class CountDownTimeConfigView : public View<CountDownTimeConfigPresenter>\r
+    {\r
+    public:\r
+        CountDownTimeConfigView();\r
+        virtual ~CountDownTimeConfigView();\r
+        static CountDownTimeConfigView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+        \r
+    private:\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UITimePicker *timePicker = nullptr;\r
+        UIImageView *image1 = nullptr;\r
+        UIImageView *image2 = nullptr;\r
+        UIButton *start_countdown_button = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // CountDownTimeConfig_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeNotNullPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeNotNullPresenter.h
new file mode 100644 (file)
index 0000000..c49fc69
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef COUNTDOWN_TIME_NOT_NULL_PRESENTER_H\r
+#define COUNTDOWN_TIME_NOT_NULL_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "CountDownTimeNotNullView.h"\r
+\r
+/*倒计时时间不能为0*/\r
+namespace OHOS\r
+{\r
+    class CountDownTimeNotNullView;\r
+\r
+    class CountDownTimeNotNullPresenter : public Presenter<CountDownTimeNotNullView>,\r
+                                          public UIView::OnClickListener,\r
+                                          public UIView::OnDragListener\r
+    {\r
+    public:\r
+        CountDownTimeNotNullPresenter();\r
+        virtual ~CountDownTimeNotNullPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static CountDownTimeNotNullPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeNotNullView.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/CountDownTimeNotNullView.h
new file mode 100644 (file)
index 0000000..bbfbf50
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef COUNTDOWN_TIME_NOT_NULL_VIEW_H\r
+#define COUNTDOWN_TIME_NOT_NULL_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+\r
+/*倒计时时间不能为0*/\r
+namespace OHOS\r
+{\r
+    static const char *RETURN_NUTTON_VIEWID = "ReturnButton"; // 点击该按钮后回到倒计时设置界面\r
+    static const char *imagepath1 = "/user/res/countdown/COUNTDOWN_ATTENTION.bin";\r
+    static const char *imagepath2 = "/user/res/countdown/COUNTDOWN_BUTTON.bin";\r
+    class CountDownTimeNotNullPresenter;\r
+    class CountDownTimeNotNullView : public View<CountDownTimeNotNullPresenter>\r
+    {\r
+\r
+    public:\r
+        CountDownTimeNotNullView();\r
+        virtual ~CountDownTimeNotNullView();\r
+        static CountDownTimeNotNullView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UIImageView *image1_ = nullptr;\r
+        UILabel *label2_ = nullptr;\r
+        UIButton *button1_ = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/MainCountDownPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/MainCountDownPresenter.h
new file mode 100644 (file)
index 0000000..d81b459
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef MAIN_COUNTDOWN_PRESENTER_H\r
+#define MAIN_COUNTDOWN_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "MainCountDownView.h"\r
+\r
+/*倒计时的主界面*/\r
+namespace OHOS\r
+{\r
+    class MainCountDownView;\r
+\r
+    class MainCountDownPresenter : public Presenter<MainCountDownView>,\r
+                                   public UIView::OnClickListener,\r
+                                   public UIView::OnDragListener\r
+    {\r
+    public:\r
+        MainCountDownPresenter();\r
+        virtual ~MainCountDownPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static MainCountDownPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // MainCountDown_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/MainCountDownView.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/MainCountDownView.h
new file mode 100644 (file)
index 0000000..aa2914a
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef MAIN_COUNTDOWN_VIEW_H\r
+#define MAIN_COUNTDOWN_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_label_button.h"\r
+#include "components/ui_button.h"\r
+/*倒计时的主界面*/\r
+namespace OHOS\r
+{\r
+#define CountDownImageSrc "/user/res/countdown/"\r
+\r
+    // 图片路径\r
+    static const char *COUNTDOWN_ONE_MINUTE_IMAGE = CountDownImageSrc "COUNTDOWM_ONE_MINUTE.bin";       // 1分钟 image\r
+    static const char *COUNTDOWN_FIVE_MINUTE_IMAGE = CountDownImageSrc "COUNTDOWM_FIVE_MINUTE.bin";     // 5分钟 image\r
+    static const char *COUNTDOWN_TEN_MINUTE_IMAGE = CountDownImageSrc "COUNTDOWM_TEN_MINUTE.bin";       // 10分钟 image\r
+    static const char *COUNTDOWN_THIRTY_MINUTE_IMAGE = CountDownImageSrc "COUNTDOWM_THIRTY_MINUTE.bin"; // 30分钟 image\r
+\r
+    // 视图ID\r
+    static const char *COUNTDOWN_LABELBUTTON_VIEWID = "COUNTDOWN_LABELBUTTON";                   // 自定义时间ID\r
+    static const char *COUNTDOWN_ONE_MINUTE_BUTTON_VIEWID = "COUNTDOWN_ONE_MINUTE_BUTTON";       // 1分钟 \r
+    static const char *COUNTDOWN_FIVE_MINUTE_BUTTON_VIEWID = "COUNTDOWN_FIVE_MINUTE_BUTTON";     // 5分钟\r
+    static const char *COUNTDOWN_TEN_MINUTE_BUTTON_VIEWID = "COUNTDOWN_TEN_MINUTE_BUTTON";       // 10分钟\r
+    static const char *COUNTDOWN_THIRTY_MINUTE_BUTTON_VIEWID = "COUNTDOWN_THIRTY_MINUTE_BUTTON"; // 30 分钟\r
+}\r
+namespace OHOS\r
+{\r
+    class MainCountDownPresenter;\r
+    class MainCountDownView : public View<MainCountDownPresenter>\r
+    {\r
+\r
+    public:\r
+        MainCountDownView();\r
+        virtual ~MainCountDownView();\r
+        static MainCountDownView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UILabelButton *COUNTDOWN_LABELBUTTON = nullptr;\r
+        UIButton *COUNTDOWN_TEN_MINUTE_BUTTON = nullptr;\r
+        UIButton *COUNTDOWN_FIVE_MINUTE_BUTTON = nullptr;\r
+        UIButton *COUNTDOWN_THIRTY_MINUTE_BUTTON = nullptr;\r
+        UIButton *COUNTDOWN_ONE_MINUTE_BUTTON = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // MainCountDown_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/StartCountDownPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/StartCountDownPresenter.h
new file mode 100644 (file)
index 0000000..6890757
--- /dev/null
@@ -0,0 +1,42 @@
+#ifndef START_COUNTDOWN_PRESENTER_H\r
+#define START_COUNTDOWN_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "StartCountDownView.h"\r
+#include "components/ui_checkbox.h"\r
+#include "components/ui_toggle_button.h"\r
+\r
+/*开始倒计时*/\r
+namespace OHOS\r
+{\r
+    class StartCountDownView;\r
+    class StartCountDownPresenter : public Presenter<StartCountDownView>,\r
+                                    public UIView::OnClickListener,\r
+                                    public UIView::OnDragListener,\r
+                                    public UICheckBox::OnChangeListener\r
+    {\r
+    public:\r
+        StartCountDownPresenter();\r
+        virtual ~StartCountDownPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static StartCountDownPresenter *GetInstance();\r
+        void SetToggleButton(UIToggleButton *togglebutton)\r
+        {\r
+            m_togglebutton = togglebutton;\r
+        }\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+        bool OnChange(UICheckBox::UICheckBoxState state) override;\r
+        UIToggleButton *m_togglebutton{nullptr};\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/StartCountDownView.h b/code/sdk/application/wearable/nativeapp/nativeui/countdown/include/StartCountDownView.h
new file mode 100644 (file)
index 0000000..559ac71
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef START_COUNTDOWN_VIEW_H\r
+#define START_COUNTDOWN_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_toggle_button.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_checkbox.h"\r
+\r
+/*开始倒计时*/\r
+namespace OHOS\r
+{\r
+    static const char *EndButton_ImagePath = "/user/res/countdown/COUNTDOWM_END.bin";         // 结束返回按钮图片\r
+    static const char *CountDown_Play_ImagePath = "/user/res/countdown/COUNTDOWM_PLAY.bin";   // 开始倒计时image\r
+    static const char *CountDown_PAUSE_ImagePath = "/user/res/countdown/COUNTDOWM_PAUSE.bin"; // 暂停倒计时image\r
+    static const char *VectorImagesPath = "/user/res/countdown/COUNTDOWM_VECTOR.bin";               \r
+    static const char *PlayOrPauseToggleButton_ViewID = "PlayOrPauseToggleButton";            // 暂停和开始toggleButton视图id\r
+    static const char *EndButton_ViewID = "endbutton";                                        // 结束返回按钮视图id\r
+    class StartCountDownPresenter;\r
+    class StartCountDownView : public View<StartCountDownPresenter>\r
+    {\r
+\r
+    public:\r
+        StartCountDownView();\r
+        virtual ~StartCountDownView();\r
+        static StartCountDownView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UILabel *showCountDownTimelabel = nullptr;\r
+        UILabel *label3_ = nullptr;\r
+        UIImageView *image = nullptr;\r
+        UIToggleButton *play_or_pause_toggleButton = nullptr;\r
+        UIButton *endbutton = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownModel.cpp
new file mode 100644 (file)
index 0000000..f5e7588
--- /dev/null
@@ -0,0 +1,75 @@
+#include "countdown/include/CountDownModel.h"\r
+#include <sstream>\r
+#include <sstream>\r
+#include <iomanip>\r
+namespace OHOS\r
+{\r
+    /* -------------------------------------------------------------------------- */\r
+    struct Time\r
+    {\r
+        int hour;\r
+        int minute;\r
+        int second;\r
+    };\r
+    // 解析时间字符串并返回 Time 结构体\r
+    Time ParseTimeString(const std::string &timeString)\r
+    {\r
+        Time time;\r
+\r
+        std::stringstream ss(timeString);\r
+        char delimiter;\r
+\r
+        ss >> time.hour >> delimiter >> time.minute >> delimiter >> time.second;\r
+\r
+        return time;\r
+    }\r
+    // 格式化时间:确保它是 “hh:mm:ss” 格式\r
+    std::string FormatTime(int hours, int minutes, int seconds)\r
+    {\r
+        std::ostringstream oss;\r
+        oss << std::setw(2) << std::setfill('0') << hours << ":"\r
+            << std::setw(2) << std::setfill('0') << minutes << ":"\r
+            << std::setw(2) << std::setfill('0') << seconds;\r
+\r
+        return oss.str();\r
+    }\r
+    /* -------------------------------------------------------------------------- */\r
+    // 定义了 GetInstance() 方法来获取 CountDownModel 的实例,确保只有一个全局实例存在。\r
+    std::shared_ptr<CountDownModel> CountDownModel::GetInstance()\r
+    {\r
+        static std::shared_ptr<CountDownModel> instance(new CountDownModel());\r
+        return instance;\r
+    }\r
+\r
+    // 设置倒计时时间\r
+    void CountDownModel::SetCountDownTime(const std::string &countdowntime)\r
+    {\r
+        CountTime = countdowntime;\r
+    }\r
+\r
+    // 获取倒计时时间\r
+    std::string CountDownModel::GetCountDownTime(void)\r
+    {\r
+        return CountTime;\r
+    }\r
+\r
+    // 设置响铃时间\r
+    void CountDownModel::SetRingTime(const std::string &ringtime)\r
+    {\r
+        Time time = ParseTimeString(ringtime);\r
+        if (time.hour == 0) // 如果倒计时时间小于一小时就只显示分钟和秒\r
+        {\r
+            std::string rt = ringtime.substr(3, 5); //"00:05:00":从第3个位置开始截图5个字符 ,substr不会修改原来的字符串\r
+            RingTime = rt;\r
+            return;\r
+        }\r
+        RingTime = ringtime;\r
+    }\r
+\r
+    // 获取响铃时间\r
+    std::string CountDownModel::GetRingTime(void)\r
+    {\r
+        return RingTime;\r
+    }\r
+\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeConfigPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeConfigPresenter.cpp
new file mode 100644 (file)
index 0000000..9a14b3c
--- /dev/null
@@ -0,0 +1,94 @@
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+#include "countdown/include/CountDownTimeConfigPresenter.h"
+#include "countdown/include/CountDownModel.h"
+/*倒计时时间配置*/
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static CountDownTimeConfigPresenter *g_pCountDownTimeConfigPresenter = nullptr;
+    std::string CountDownTimeConfigPresenter::countdowntime{"00:00:00"};
+    std::string CountDownTimeConfigPresenter::ringtime{nullptr};
+    CountDownTimeConfigPresenter::CountDownTimeConfigPresenter()
+    {
+
+        g_pCountDownTimeConfigPresenter = this;
+    }
+
+    CountDownTimeConfigPresenter::~CountDownTimeConfigPresenter()
+    {
+
+        g_pCountDownTimeConfigPresenter = nullptr;
+    }
+
+    CountDownTimeConfigPresenter *CountDownTimeConfigPresenter::GetInstance()
+    {
+
+        return g_pCountDownTimeConfigPresenter;
+    }
+
+    void CountDownTimeConfigPresenter::OnStart()
+    {
+
+        Presenter<CountDownTimeConfigView>::OnStart();
+    }
+
+    void CountDownTimeConfigPresenter::OnPause(void)
+    {
+
+        Presenter<CountDownTimeConfigView>::OnPause();
+    }
+
+    void CountDownTimeConfigPresenter::OnResume(void)
+    {
+
+        Presenter<CountDownTimeConfigView>::OnResume();
+    }
+
+    void CountDownTimeConfigPresenter::OnStop(void)
+    {
+
+        Presenter<CountDownTimeConfigView>::OnStop();
+    }
+
+    bool CountDownTimeConfigPresenter::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_MAIN_COUNTDOWN);
+        }
+        return true;
+    }
+
+    bool CountDownTimeConfigPresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+
+        // 根据控件id查找是哪个控件触发了点击回调
+        if (strcmp(view.GetViewId(), start_countdown_button_viewid) == 0)
+        {
+            if (strcmp(CountDownModel::GetInstance()->GetCountDownTime().c_str(), "00:00:00") == 0)
+            {
+                NativeAbility::GetInstance().ChangeSlice(VIEW_COUNTDOWN_TIME_NOT_NULL);
+                return true;
+            }
+            else
+            {
+                NativeAbility::GetInstance().ChangeSlice(VIEW_START_COUNTDOWN);
+                return true;
+            }
+            return false;
+        }
+        return false;
+    }
+
+    void CountDownTimeConfigPresenter::OnTimePickerStoped(UITimePicker &picker)
+    {
+        countdowntime = picker.GetSelectValue(); //倒计时时间
+        ringtime = countdowntime; //响铃时间
+        CountDownModel::GetInstance()->SetCountDownTime(countdowntime); // 设置倒计时时间
+        CountDownModel::GetInstance()->SetRingTime(ringtime);           // 设置响铃时间
+    }
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeConfigView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeConfigView.cpp
new file mode 100644 (file)
index 0000000..336034f
--- /dev/null
@@ -0,0 +1,226 @@
+#include "countdown/include/CountDownTimeConfigView.h"
+#include "countdown/include/CountDownTimeConfigPresenter.h"
+#include "countdown/include/CountDownModel.h"
+#include "UiConfig.h"
+
+/*倒计时时间配置*/
+namespace OHOS
+{
+
+    static CountDownTimeConfigView *g_pCountDownTimeConfigView{nullptr};
+
+    CountDownTimeConfigView::CountDownTimeConfigView()
+    {
+
+        g_pCountDownTimeConfigView = this;
+    }
+
+    CountDownTimeConfigView::~CountDownTimeConfigView()
+    {
+        if (viewInitStatus == true)
+        {
+            DeInitView();
+        }
+        g_pCountDownTimeConfigView = nullptr;
+    }
+
+    CountDownTimeConfigView *CountDownTimeConfigView::GetInstance()
+    {
+
+        return g_pCountDownTimeConfigView;
+    }
+
+    void CountDownTimeConfigView::InitView()
+    {
+        if (scrollView1_ == nullptr)
+        {
+            scrollView1_ = new UIScrollView();
+        }
+        scrollView1_->SetPosition(0, 0);
+        scrollView1_->Resize(466, 466);
+        scrollView1_->SetViewId("scrollView1");
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        scrollView1_->SetHorizontalScrollState(false);
+        scrollView1_->SetVerticalScrollState(false);
+        container_->Add(scrollView1_);
+        scrollView1_->SetVisible(true);
+        /* -------------------------------------------------------------------------- */
+        // Add Label to App
+        if (label1_ == nullptr)
+        {
+            label1_ = new UILabel();
+        }
+        label1_->SetPosition(189, 52);
+        label1_->Resize(90, 35);
+        label1_->SetViewId("label");
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);
+        // Set additional property
+        label1_->SetText("倒计时");
+        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        label1_->SetRollSpeed(0);
+        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+        scrollView1_->Add(label1_);
+        label1_->SetVisible(true);
+        /* -------------------------------------------------------------------------- */
+        // Add TimePicker to App
+        if (timePicker == nullptr)
+        {
+            timePicker = new UITimePicker();
+        }
+        timePicker->SetPosition(74, 121);
+        timePicker->Resize(320, 180);
+        timePicker->SetViewId("timePicker1");
+        timePicker->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+        timePicker->SetStyle(STYLE_BORDER_RADIUS, 51);
+        // Set additional property
+        timePicker->SetItemHeight(60);                                                                                              // 设置时间选择器中每个项目的高度。
+        timePicker->EnableSecond(true);                                                                                             // 设置在时间选择器中启用秒。
+        timePicker->SetSelected(CountDownModel::GetInstance()->GetCountDownTime().c_str());                                         // 设置时间选择器中当前选择的时间。
+        timePicker->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff), Color::GetColorFromRGBA(0xff, 0xa8, 0x00, 0xff)); // 设置时间选择器中的文本颜色。
+        timePicker->SetLoopState(UITimePicker::PickerType::PICKER_HOUR, true);                                                      // 设置是否开启循环 :时
+        timePicker->SetLoopState(UITimePicker::PickerType::PICKER_MIN, true);                                                       // 设置是否开启循环:分
+        timePicker->SetLoopState(UITimePicker::PickerType::PICKER_SEC, true);                                                       // 设置是否开启循环:秒
+        timePicker->SetHighlightFont(DEFAULT_VECTOR_FONT_FILENAME, 60);                                                             // 设置突出显示文本的字体名称和大小。
+        timePicker->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, 30);                                                            // 设置背景文本的字体名称和大小。
+        UITimePicker::SelectedListener *selectTimeListener =
+            (UITimePicker::SelectedListener *)OHOS::CountDownTimeConfigPresenter::GetInstance();
+        timePicker->RegisterSelectedListener(selectTimeListener);
+        //  Add to scrollView1
+        scrollView1_->Add(timePicker);
+        timePicker->SetVisible(true);
+        /* -------------------------------------------------------------------------- */
+        if (image1 == nullptr)
+        {
+            image1 = new UIImageView();
+        }
+        image1->SetPosition(175, 200);
+        image1->Resize(18, 79);
+        image1->SetViewId("image1");
+        image1->SetSrc(ColoneImagesPath);
+        // Add to scrollView1
+        scrollView1_->Add(image1);
+        image1->SetVisible(true);
+        /* -------------------------------------------------------------------------- */
+        // Add ImageView to App
+        if (image2 == nullptr)
+        {
+            image2 = new UIImageView();
+        }
+        image2->SetPosition(280, 200);
+        image2->Resize(18, 79);
+        image2->SetViewId("image2");
+        image2->SetSrc(ColoneImagesPath);
+        scrollView1_->Add(image2);
+        image2->SetVisible(true);
+        /* -------------------------------------------------------------------------- */
+        // Add Button to App
+        if (start_countdown_button == nullptr)
+        {
+            start_countdown_button = new UIButton();
+        }
+        start_countdown_button->SetPosition(183, 321);
+        start_countdown_button->Resize(100, 100);
+        start_countdown_button->SetViewId(start_countdown_button_viewid);
+        start_countdown_button->SetStyle(STYLE_BORDER_RADIUS, 52);
+        start_countdown_button->SetImageSrc(start_countdown_button_imagePath, nullptr);
+        start_countdown_button->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);
+        start_countdown_button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+        start_countdown_button->SetStyleForState(STYLE_BORDER_RADIUS, 52, UIButton::PRESSED);
+
+        // Add the CallBack about events
+        UIView::OnClickListener *start_countdown_button_Click = static_cast<UIView::OnClickListener *>(CountDownTimeConfigPresenter::GetInstance());
+        start_countdown_button->SetOnClickListener(start_countdown_button_Click);
+        // Add to scrollView1
+        scrollView1_->Add(start_countdown_button);
+        start_countdown_button->SetVisible(true);
+    }
+
+    void CountDownTimeConfigView::DeInitView()
+    {
+        if (label1_ != nullptr)
+        {
+            delete label1_;
+            label1_ = nullptr;
+        }
+        if (timePicker != nullptr)
+        {
+            delete timePicker;
+            timePicker = nullptr;
+        }
+        if (image1 != nullptr)
+        {
+            delete image1;
+            image1 = nullptr;
+        }
+        if (image2 != nullptr)
+        {
+            delete image2;
+            image2 = nullptr;
+        }
+        if (start_countdown_button != nullptr)
+        {
+            delete start_countdown_button;
+            start_countdown_button = nullptr;
+        }
+        if (scrollView1_ != nullptr)
+        {
+            delete scrollView1_;
+            scrollView1_ = nullptr;
+        }
+        if (container_ != nullptr)
+        {
+            container_->RemoveAll();
+            delete container_;
+            container_ = nullptr;
+        }
+    }
+    void CountDownTimeConfigView::PreLoad(void)
+    {
+        if (!viewInitStatus)
+        {
+            InitView();
+            viewInitStatus = true;
+        }
+    }
+
+    void CountDownTimeConfigView::OnStart()
+    {
+        // container_容器属性 new
+        container_ = new UIViewGroup();
+        if (container_ == nullptr)
+        {
+            return;
+        }
+        // container_容器属性 扩展
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+        UIView::OnDragListener *DragListener = static_cast<UIView::OnDragListener*>(CountDownTimeConfigPresenter::GetInstance());
+        container_->SetOnDragListener(DragListener);
+        PreLoad();
+        RootView::GetInstance()->Add(container_);
+    }
+
+    void CountDownTimeConfigView::OnSetUpView()
+    {
+        View<CountDownTimeConfigPresenter>::OnSetUpView();
+        Draw();
+    }
+
+    void CountDownTimeConfigView::OnTearDownView()
+    {
+
+        View<CountDownTimeConfigPresenter>::OnTearDownView();
+        return;
+    }
+
+    void CountDownTimeConfigView::OnStop()
+    {
+
+        View<CountDownTimeConfigPresenter>::OnStop();
+        RootView::GetInstance()->RemoveAll();
+        return;
+    }
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeNotNullPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeNotNullPresenter.cpp
new file mode 100644 (file)
index 0000000..008a9f4
--- /dev/null
@@ -0,0 +1,71 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "countdown/include/CountDownTimeNotNullPresenter.h"\r
+\r
+/*倒计时时间不能为0*/\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static CountDownTimeNotNullPresenter *g_pCountDownTimeNotNullPresenter = nullptr;\r
+\r
+    CountDownTimeNotNullPresenter::CountDownTimeNotNullPresenter()\r
+    {\r
+\r
+        g_pCountDownTimeNotNullPresenter = this;\r
+    }\r
+\r
+    CountDownTimeNotNullPresenter::~CountDownTimeNotNullPresenter()\r
+    {\r
+\r
+        g_pCountDownTimeNotNullPresenter = nullptr;\r
+    }\r
+\r
+    CountDownTimeNotNullPresenter *CountDownTimeNotNullPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pCountDownTimeNotNullPresenter;\r
+    }\r
+\r
+    void CountDownTimeNotNullPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<CountDownTimeNotNullView>::OnStart();\r
+    }\r
+\r
+    void CountDownTimeNotNullPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<CountDownTimeNotNullView>::OnPause();\r
+    }\r
+\r
+    void CountDownTimeNotNullPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<CountDownTimeNotNullView>::OnResume();\r
+    }\r
+\r
+    void CountDownTimeNotNullPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<CountDownTimeNotNullView>::OnStop();\r
+    }\r
+\r
+    bool CountDownTimeNotNullPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+        UNUSED(view);\r
+        UNUSED(event);\r
+        return true;\r
+    }\r
+\r
+    bool CountDownTimeNotNullPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (strcmp(view.GetViewId(), RETURN_NUTTON_VIEWID) == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_COUNTDOWN_TIME_CONFIG);\r
+        }\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeNotNullView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/CountDownTimeNotNullView.cpp
new file mode 100644 (file)
index 0000000..b687cf1
--- /dev/null
@@ -0,0 +1,198 @@
+#include "countdown/include/CountDownTimeNotNullView.h"\r
+#include "countdown/include/CountDownTimeNotNullPresenter.h"\r
+#include "UiConfig.h"\r
+\r
+/*倒计时时间不能为0*/\r
+namespace OHOS\r
+{\r
+\r
+    static CountDownTimeNotNullView *g_pCountDownTimeNotNullView{nullptr};\r
+\r
+    CountDownTimeNotNullView::CountDownTimeNotNullView()\r
+    {\r
+\r
+        g_pCountDownTimeNotNullView = this;\r
+    }\r
+\r
+    CountDownTimeNotNullView::~CountDownTimeNotNullView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pCountDownTimeNotNullView = nullptr;\r
+    }\r
+\r
+    CountDownTimeNotNullView *CountDownTimeNotNullView::GetInstance()\r
+    {\r
+\r
+        return g_pCountDownTimeNotNullView;\r
+    }\r
+\r
+    void CountDownTimeNotNullView::InitView()\r
+    {\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);        \r
+        scrollView1_->Resize(466, 466);         \r
+        scrollView1_->SetViewId("scrollView1"); \r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Label to App\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(188, 52); \r
+        label1_->Resize(90, 35);       \r
+        label1_->SetViewId("label1");  \r
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\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
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add ImageView to App\r
+        if (image1_ == nullptr)\r
+        {\r
+            image1_ = new UIImageView();\r
+        }\r
+        image1_->SetPosition(193, 121); \r
+        image1_->Resize(80, 80);        \r
+        image1_->SetViewId("image1");   \r
+        image1_->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        image1_->SetSrc(imagepath1);\r
+        // Add to scrollView1\r
+        scrollView1_->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(98, 253); \r
+        label2_->Resize(270, 35);      \r
+        label2_->SetViewId("label2");  \r
+        label2_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label2_->SetStyle(STYLE_LINE_HEIGHT, 35);\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, 30);\r
+        scrollView1_->Add(label2_);\r
+        label2_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (button1_ == nullptr)\r
+        {\r
+            button1_ = new UIButton();\r
+        }\r
+        button1_->SetPosition(0, 366);  \r
+        button1_->Resize(466, 100);     \r
+        button1_->SetViewId(RETURN_NUTTON_VIEWID); \r
+        button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
+        button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+        button1_->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        button1_->SetImageSrc(imagepath2, nullptr);\r
+        button1_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffbfbfb, UIButton::PRESSED);\r
+        button1_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
+        button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        button1_->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(CountDownTimeNotNullPresenter::GetInstance());\r
+        button1_->SetOnClickListener(button1Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(button1_);\r
+        button1_->SetVisible(true);\r
+    }\r
+\r
+    void CountDownTimeNotNullView::DeInitView()\r
+    {\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = 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 (button1_ != nullptr)\r
+        {\r
+            delete button1_;\r
+            button1_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+    void CountDownTimeNotNullView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void CountDownTimeNotNullView::OnStart()\r
+    {\r
+        // container_容器属性 new\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        // container_容器属性 扩展\r
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+        container_->SetTouchable(true);\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void CountDownTimeNotNullView::OnSetUpView()\r
+    {\r
+\r
+        View<CountDownTimeNotNullPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void CountDownTimeNotNullView::OnTearDownView()\r
+    {\r
+\r
+        View<CountDownTimeNotNullPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void CountDownTimeNotNullView::OnStop()\r
+    {\r
+\r
+        View<CountDownTimeNotNullPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/MainCountDownPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/MainCountDownPresenter.cpp
new file mode 100644 (file)
index 0000000..c853b43
--- /dev/null
@@ -0,0 +1,114 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "countdown/include/MainCountDownPresenter.h"\r
+#include "countdown/include/CountDownModel.h"\r
+/*倒计时的主界面*/\r
+\r
+namespace OHOS\r
+{\r
+    using namespace std;\r
+    string OneMinuteTime = "00:01:00";    // 1分钟\r
+    string FiveMinuteTime = "00:05:00";   // 5分钟\r
+    string TenMinuteTime = "00:10:00";    // 10分钟\r
+    string ThirtyMinuteTime = "00:30:00"; // 30分钟\r
+}\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static MainCountDownPresenter *g_pMainCountDownPresenter = nullptr;\r
+\r
+    MainCountDownPresenter::MainCountDownPresenter()\r
+    {\r
+\r
+        g_pMainCountDownPresenter = this;\r
+    }\r
+\r
+    MainCountDownPresenter::~MainCountDownPresenter()\r
+    {\r
+\r
+        g_pMainCountDownPresenter = nullptr;\r
+    }\r
+\r
+    MainCountDownPresenter *MainCountDownPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pMainCountDownPresenter;\r
+    }\r
+\r
+    void MainCountDownPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<MainCountDownView>::OnStart();\r
+    }\r
+\r
+    void MainCountDownPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<MainCountDownView>::OnPause();\r
+    }\r
+\r
+    void MainCountDownPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<MainCountDownView>::OnResume();\r
+    }\r
+\r
+    void MainCountDownPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<MainCountDownView>::OnStop();\r
+    }\r
+\r
+    bool MainCountDownPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
+        }\r
+        return true;\r
+    }\r
+\r
+    bool MainCountDownPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (strcmp(view.GetViewId(), COUNTDOWN_LABELBUTTON_VIEWID) == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_COUNTDOWN_TIME_CONFIG);\r
+            return true;\r
+        }\r
+        else if (strcmp(view.GetViewId(), COUNTDOWN_ONE_MINUTE_BUTTON_VIEWID) == 0)\r
+        {\r
+            CountDownModel::GetInstance()->SetCountDownTime(OneMinuteTime);\r
+            CountDownModel::GetInstance()->SetRingTime(OneMinuteTime);\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_START_COUNTDOWN);\r
+            return true;\r
+        }\r
+        else if (strcmp(view.GetViewId(), COUNTDOWN_FIVE_MINUTE_BUTTON_VIEWID) == 0)\r
+        {\r
+            CountDownModel::GetInstance()->SetCountDownTime(FiveMinuteTime);\r
+            CountDownModel::GetInstance()->SetRingTime(FiveMinuteTime);\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_START_COUNTDOWN);\r
+            return true;\r
+        }\r
+        else if (strcmp(view.GetViewId(), COUNTDOWN_TEN_MINUTE_BUTTON_VIEWID) == 0)\r
+        {\r
+            CountDownModel::GetInstance()->SetCountDownTime(TenMinuteTime);\r
+            CountDownModel::GetInstance()->SetRingTime(TenMinuteTime);\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_START_COUNTDOWN);\r
+            return true;\r
+        }\r
+        else if (strcmp(view.GetViewId(), COUNTDOWN_THIRTY_MINUTE_BUTTON_VIEWID) == 0)\r
+        {\r
+            CountDownModel::GetInstance()->SetCountDownTime(ThirtyMinuteTime);\r
+            CountDownModel::GetInstance()->SetRingTime(ThirtyMinuteTime);\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_START_COUNTDOWN);\r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/MainCountDownView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/MainCountDownView.cpp
new file mode 100644 (file)
index 0000000..73c3eb4
--- /dev/null
@@ -0,0 +1,277 @@
+#include "countdown/include/MainCountDownView.h"\r
+#include "countdown/include/MainCountDownPresenter.h"\r
+\r
+/*倒计时的主界面*/\r
+namespace OHOS\r
+{\r
+#define VISIBLE_XBAR(visible)\r
+\r
+    static MainCountDownView *g_pMainCountDownView{nullptr};\r
+\r
+    MainCountDownView::MainCountDownView()\r
+    {\r
+        g_pMainCountDownView = this;\r
+    }\r
+\r
+    MainCountDownView::~MainCountDownView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pMainCountDownView = nullptr;\r
+    }\r
+\r
+    MainCountDownView *MainCountDownView::GetInstance()\r
+    {\r
+\r
+        return g_pMainCountDownView;\r
+    }\r
+\r
+    void MainCountDownView::InitView()\r
+    {\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);\r
+        scrollView1_->Resize(466, 466);\r
+        scrollView1_->SetViewId("scrollView1");\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        scrollView1_->SetReboundSize(100);             // 设置回弹大小\r
+        scrollView1_->SetHorizontalScrollState(false); // 设置横向不可以滚动\r
+        scrollView1_->SetScrollBlankSize(50);          // 设置高位50可滑动空白区域\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Label to App\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(189, 55);\r
+        label1_->Resize(90, 35);\r
+        label1_->SetViewId("label1");\r
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\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
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (COUNTDOWN_LABELBUTTON == nullptr)\r
+        {\r
+            COUNTDOWN_LABELBUTTON = new UILabelButton();\r
+        }\r
+        COUNTDOWN_LABELBUTTON->SetPosition(43, 130);\r
+        COUNTDOWN_LABELBUTTON->Resize(380, 100);\r
+        COUNTDOWN_LABELBUTTON->SetViewId(COUNTDOWN_LABELBUTTON_VIEWID);\r
+        COUNTDOWN_LABELBUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        COUNTDOWN_LABELBUTTON->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        // Set additional property\r
+        COUNTDOWN_LABELBUTTON->SetText("自定义时间");\r
+        COUNTDOWN_LABELBUTTON->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+        COUNTDOWN_LABELBUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+        COUNTDOWN_LABELBUTTON->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        COUNTDOWN_LABELBUTTON->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED);\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *labelButton1Click = static_cast<UIView::OnClickListener *>(MainCountDownPresenter::GetInstance());\r
+        COUNTDOWN_LABELBUTTON->SetOnClickListener(labelButton1Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(COUNTDOWN_LABELBUTTON);\r
+        COUNTDOWN_LABELBUTTON->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (COUNTDOWN_ONE_MINUTE_BUTTON == nullptr)\r
+        {\r
+            COUNTDOWN_ONE_MINUTE_BUTTON = new UIButton();\r
+        }\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetPosition(43, 254);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->Resize(180, 180);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetViewId(COUNTDOWN_ONE_MINUTE_BUTTON_VIEWID);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetImageSrc(COUNTDOWN_ONE_MINUTE_IMAGE, nullptr);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button3Click = static_cast<UIView::OnClickListener *>(MainCountDownPresenter::GetInstance());\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetOnClickListener(button3Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(COUNTDOWN_ONE_MINUTE_BUTTON);\r
+        COUNTDOWN_ONE_MINUTE_BUTTON->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (COUNTDOWN_FIVE_MINUTE_BUTTON == nullptr)\r
+        {\r
+            COUNTDOWN_FIVE_MINUTE_BUTTON = new UIButton();\r
+        }\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetPosition(243, 254);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->Resize(180, 180);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetViewId(COUNTDOWN_FIVE_MINUTE_BUTTON_VIEWID);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetImageSrc(COUNTDOWN_FIVE_MINUTE_IMAGE, nullptr);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button5Click = static_cast<UIView::OnClickListener *>(MainCountDownPresenter::GetInstance());\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetOnClickListener(button5Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(COUNTDOWN_FIVE_MINUTE_BUTTON);\r
+        COUNTDOWN_FIVE_MINUTE_BUTTON->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (COUNTDOWN_TEN_MINUTE_BUTTON == nullptr)\r
+        {\r
+            COUNTDOWN_TEN_MINUTE_BUTTON = new UIButton();\r
+        }\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetPosition(43, 454);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->Resize(180, 180);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetViewId(COUNTDOWN_TEN_MINUTE_BUTTON_VIEWID);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetImageSrc(COUNTDOWN_TEN_MINUTE_IMAGE, nullptr);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button7Click = static_cast<UIView::OnClickListener *>(MainCountDownPresenter::GetInstance());\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetOnClickListener(button7Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(COUNTDOWN_TEN_MINUTE_BUTTON);\r
+        COUNTDOWN_TEN_MINUTE_BUTTON->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (COUNTDOWN_THIRTY_MINUTE_BUTTON == nullptr)\r
+        {\r
+            COUNTDOWN_THIRTY_MINUTE_BUTTON = new UIButton();\r
+        }\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetPosition(243, 454);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->Resize(180, 180);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetViewId(COUNTDOWN_THIRTY_MINUTE_BUTTON_VIEWID);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetImageSrc(COUNTDOWN_THIRTY_MINUTE_IMAGE, nullptr);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(MainCountDownPresenter::GetInstance());\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetOnClickListener(button1Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(COUNTDOWN_THIRTY_MINUTE_BUTTON);\r
+        COUNTDOWN_THIRTY_MINUTE_BUTTON->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+    }\r
+\r
+    void MainCountDownView::DeInitView()\r
+    {\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (COUNTDOWN_LABELBUTTON != nullptr)\r
+        {\r
+            delete COUNTDOWN_LABELBUTTON;\r
+            COUNTDOWN_LABELBUTTON = nullptr;\r
+        }\r
+        if (COUNTDOWN_TEN_MINUTE_BUTTON != nullptr)\r
+        {\r
+            delete COUNTDOWN_TEN_MINUTE_BUTTON;\r
+            COUNTDOWN_TEN_MINUTE_BUTTON = nullptr;\r
+        }\r
+        if (COUNTDOWN_FIVE_MINUTE_BUTTON != nullptr)\r
+        {\r
+            delete COUNTDOWN_FIVE_MINUTE_BUTTON;\r
+            COUNTDOWN_FIVE_MINUTE_BUTTON = nullptr;\r
+        }\r
+        if (COUNTDOWN_THIRTY_MINUTE_BUTTON != nullptr)\r
+        {\r
+            delete COUNTDOWN_THIRTY_MINUTE_BUTTON;\r
+            COUNTDOWN_THIRTY_MINUTE_BUTTON = nullptr;\r
+        }\r
+        if (COUNTDOWN_ONE_MINUTE_BUTTON != nullptr)\r
+        {\r
+            delete COUNTDOWN_ONE_MINUTE_BUTTON;\r
+            COUNTDOWN_ONE_MINUTE_BUTTON = nullptr;\r
+        }\r
+        if (draglistener != nullptr)\r
+        {\r
+            delete draglistener;\r
+            draglistener = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+    void MainCountDownView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void MainCountDownView::OnStart()\r
+    {\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetPosition(0, 0);\r
+        container_->SetWidth(Screen::GetInstance().GetWidth());\r
+        container_->SetHeight(Screen::GetInstance().GetHeight());\r
+        draglistener = static_cast<UIView::OnDragListener *>(MainCountDownPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetOnDragListener(draglistener);\r
+        container_->SetTouchable(true);\r
+        container_->SetDraggable(true);\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void MainCountDownView::OnSetUpView()\r
+    {\r
+\r
+        View<MainCountDownPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void MainCountDownView::OnTearDownView()\r
+    {\r
+\r
+        View<MainCountDownPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void MainCountDownView::OnStop()\r
+    {\r
+\r
+        View<MainCountDownPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/StartCountDownPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/StartCountDownPresenter.cpp
new file mode 100644 (file)
index 0000000..f4aa475
--- /dev/null
@@ -0,0 +1,84 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "countdown/include/StartCountDownPresenter.h"\r
+#include "countdown/include/CountDownModel.h"\r
+/*开始倒计时*/\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static StartCountDownPresenter *g_pStartCountDownPresenter = nullptr;\r
+\r
+    StartCountDownPresenter::StartCountDownPresenter()\r
+    {\r
+\r
+        g_pStartCountDownPresenter = this;\r
+    }\r
+\r
+    StartCountDownPresenter::~StartCountDownPresenter()\r
+    {\r
+\r
+        g_pStartCountDownPresenter = nullptr;\r
+    }\r
+\r
+    StartCountDownPresenter *StartCountDownPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pStartCountDownPresenter;\r
+    }\r
+\r
+    void StartCountDownPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<StartCountDownView>::OnStart();\r
+    }\r
+\r
+    void StartCountDownPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<StartCountDownView>::OnPause();\r
+    }\r
+\r
+    void StartCountDownPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<StartCountDownView>::OnResume();\r
+    }\r
+\r
+    void StartCountDownPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<StartCountDownView>::OnStop();\r
+    }\r
+\r
+    bool StartCountDownPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+        UNUSED(view);\r
+        UNUSED(event);\r
+        return true;\r
+    }\r
+\r
+    bool StartCountDownPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (strcmp(view.GetViewId(), EndButton_ViewID) == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_COUNTDOWN); //退出时把倒计时时间设置为0\r
+            CountDownModel::GetInstance()->SetCountDownTime("00:00:00");\r
+            CountDownModel::GetInstance()->SetRingTime("");\r
+        }\r
+        return true;\r
+    }\r
+    bool StartCountDownPresenter::OnChange(UICheckBox::UICheckBoxState state)\r
+    {\r
+        if(state == UICheckBox::UICheckBoxState::SELECTED)\r
+        {\r
+            printf("start countdown...\n"); //开启定时器\r
+        }\r
+        else \r
+        {\r
+            printf("countdown pause...\n");//结束定时器\r
+        }\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/StartCountDownView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/countdown/src/StartCountDownView.cpp
new file mode 100644 (file)
index 0000000..475f94b
--- /dev/null
@@ -0,0 +1,252 @@
+#include "countdown/include/StartCountDownView.h"\r
+#include "countdown/include/StartCountDownPresenter.h"\r
+#include "countdown/include/CountDownModel.h"\r
+#include "UiConfig.h"\r
+\r
+/*开始倒计时*/\r
+namespace OHOS\r
+{\r
+\r
+    static StartCountDownView *g_pStartCountDownView{nullptr};\r
+\r
+    StartCountDownView::StartCountDownView()\r
+    {\r
+\r
+        g_pStartCountDownView = this;\r
+    }\r
+\r
+    StartCountDownView::~StartCountDownView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pStartCountDownView = nullptr;\r
+    }\r
+\r
+    StartCountDownView *StartCountDownView::GetInstance()\r
+    {\r
+\r
+        return g_pStartCountDownView;\r
+    }\r
+\r
+    void StartCountDownView::InitView()\r
+    {\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);\r
+        scrollView1_->Resize(466, 466);\r
+        scrollView1_->SetViewId("scrollView1");\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Label to App\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(189, 52);\r
+        label1_->Resize(90, 35);\r
+        label1_->SetViewId("label1");\r
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\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
+        // Add to scrollView1\r
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Label to App\r
+        if (showCountDownTimelabel == nullptr)\r
+        {\r
+            showCountDownTimelabel = new UILabel();\r
+        }\r
+        showCountDownTimelabel->SetPosition(63, 138);\r
+        showCountDownTimelabel->Resize(200, 60);\r
+        showCountDownTimelabel->SetViewId("showCountDownTimelabel");//用来显示倒计时时间\r
+        showCountDownTimelabel->SetStyle(STYLE_TEXT_FONT, 80);\r
+        showCountDownTimelabel->SetStyle(STYLE_LINE_HEIGHT, 94);\r
+        // Set additional property\r
+        showCountDownTimelabel->SetText(CountDownModel::GetInstance()->GetCountDownTime().c_str());\r
+        showCountDownTimelabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        showCountDownTimelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        showCountDownTimelabel->SetRollSpeed(0);\r
+        showCountDownTimelabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 80);\r
+        \r
+        // Add to scrollView1\r
+        scrollView1_->Add(showCountDownTimelabel);\r
+        showCountDownTimelabel->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add ImageView to App\r
+        if (image == nullptr)\r
+        {\r
+            image = new UIImageView();\r
+        }\r
+        image->SetPosition(174, 247);\r
+        image->Resize(28, 28);\r
+        image->SetViewId("image");\r
+        image->SetSrc(VectorImagesPath);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image);\r
+        image->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Label to App\r
+        if (label3_ == nullptr)\r
+        {\r
+            label3_ = new UILabel();\r
+        }\r
+        label3_->SetPosition(209, 241);\r
+        label3_->Resize(81, 41);\r
+        label3_->SetViewId("label3");\r
+        label3_->SetStyle(STYLE_TEXT_FONT, 35);\r
+        label3_->SetStyle(STYLE_LINE_HEIGHT, 41);\r
+\r
+        // Set additional property\r
+        label3_->SetText(CountDownModel::GetInstance()->GetRingTime().c_str());\r
+        label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label3_->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff));\r
+        label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label3_->SetRollSpeed(0);\r
+        label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 35);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label3_);\r
+        label3_->SetVisible(true);\r
+\r
+        // Add ToggleButton to App\r
+        if (play_or_pause_toggleButton == nullptr)\r
+        {\r
+            play_or_pause_toggleButton = new UIToggleButton();\r
+        }\r
+        play_or_pause_toggleButton->SetPosition(248, 321);\r
+        play_or_pause_toggleButton->Resize(100, 100);\r
+        play_or_pause_toggleButton->SetViewId(PlayOrPauseToggleButton_ViewID);\r
+        play_or_pause_toggleButton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+        play_or_pause_toggleButton->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        play_or_pause_toggleButton->SetImages(CountDown_Play_ImagePath, CountDown_PAUSE_ImagePath);\r
+        UICheckBox::OnChangeListener *ToggleButtonChange = static_cast<UICheckBox::OnChangeListener *>(StartCountDownPresenter::GetInstance());\r
+        StartCountDownPresenter::GetInstance()->SetToggleButton(play_or_pause_toggleButton);\r
+        play_or_pause_toggleButton->SetOnChangeListener(ToggleButtonChange);\r
+        scrollView1_->Add(play_or_pause_toggleButton);\r
+        play_or_pause_toggleButton->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (endbutton == nullptr)\r
+        {\r
+            endbutton = new UIButton();\r
+        }\r
+        endbutton->SetPosition(118, 321);\r
+        endbutton->Resize(100, 100);\r
+        endbutton->SetViewId(EndButton_ViewID);\r
+        endbutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
+        endbutton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+        endbutton->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        endbutton->SetImageSrc(EndButton_ImagePath, nullptr);\r
+        endbutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffa800, UIButton::PRESSED);\r
+        endbutton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        endbutton->SetStyleForState(STYLE_BORDER_RADIUS, 100, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *buttonClick = static_cast<UIView::OnClickListener *>(StartCountDownPresenter::GetInstance());\r
+        endbutton->SetOnClickListener(buttonClick);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(endbutton);\r
+        endbutton->SetVisible(true);\r
+    }\r
+\r
+    void StartCountDownView::DeInitView()\r
+    {\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (showCountDownTimelabel != nullptr)\r
+        {\r
+            delete showCountDownTimelabel;\r
+            showCountDownTimelabel = nullptr;\r
+        }\r
+        if (image != nullptr)\r
+        {\r
+            delete image;\r
+            image = nullptr;\r
+        }\r
+        if (label3_ != nullptr)\r
+        {\r
+            delete label3_;\r
+            label3_ = nullptr;\r
+        }\r
+        if (play_or_pause_toggleButton != nullptr)\r
+        {\r
+            delete play_or_pause_toggleButton;\r
+            play_or_pause_toggleButton = nullptr;\r
+        }\r
+        if (endbutton != nullptr)\r
+        {\r
+            delete endbutton;\r
+            endbutton = nullptr;\r
+        }\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+    }\r
+    void StartCountDownView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void StartCountDownView::OnStart()\r
+    {\r
+        // container_容器属性 new\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        // container_容器属性 扩展\r
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+        container_->SetTouchable(true);\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void StartCountDownView::OnSetUpView()\r
+    {\r
+\r
+        View<StartCountDownPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void StartCountDownView::OnTearDownView()\r
+    {\r
+\r
+        View<StartCountDownPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void StartCountDownView::OnStop()\r
+    {\r
+\r
+        View<StartCountDownPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/MainStopWatchPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/MainStopWatchPresenter.h
new file mode 100644 (file)
index 0000000..bdfbb26
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef MAIN_STOPWATCH_PRESENTER_H\r
+#define MAIN_STOPWATCH_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "MainStopWatchView.h"\r
+#include "components/ui_checkbox.h"\r
+/*秒表主视图*/\r
+namespace OHOS\r
+{\r
+    class MainStopWatchView;\r
+    class MainStopWatchPresenter : public Presenter<MainStopWatchView>,\r
+                                   public UIView::OnClickListener,\r
+                                   public UIView::OnDragListener\r
+    {\r
+    public:\r
+        MainStopWatchPresenter();\r
+        virtual ~MainStopWatchPresenter();\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+        static MainStopWatchPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/MainStopWatchView.h b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/MainStopWatchView.h
new file mode 100644 (file)
index 0000000..2d6176c
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef MAIN_STOPWATCH_VIEW_H\r
+#define MAIN_STOPWATCH_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_checkbox.h"\r
+#include "components/ui_button.h"\r
+/*秒表主视图*/\r
+namespace OHOS\r
+{\r
+\r
+    static const char *checkBox1selectedImg = "/user/res/countdown/COUNTDOWM_PLAY.bin";         // 播放\r
+    static const char *checkBox1unSelectedImg = "/user/res/countdown/COUNTDOWM_PAUSE.bin";      // 暂停\r
+    static const char *ResetOrMarkButtonImg_Reset1 = "/user/res/stopwatch/STOPWATH_RESET1.bin"; // 重置_灰色 图片\r
+    static const char *ResetOrMarkButtonImg_Reset2 = "/user/res/stopwatch/STOPWATH_RESET2.bin"; // 重置_白色 图片\r
+    static const char *ResetOrMarkButtonImg_Mark = "/user/res/stopwatch/STOPWATCH_MARK.bin";    // 标记 图片\r
+    static const char *PlayOrPausecheckBoxVIEWID = "PlayOrPausecheckBox";                       // 播放或暂停复选框视图ID\r
+    static const char *ResetOrMarkButton_RESET1_VIEWID = "ResetOrMarkButtonReset1";             // ResetOrMarkButtonReset1\r
+    static const char *ResetOrMarkButton_RESET2_VIEWID = "ResetOrMarkButtonReset2";             // ResetOrMarkButtonReset2\r
+    static const char *ResetOrMarkButton_MARK_VIEWID = "ResetOrMarkButtonMark";                 // ResetOrMarkButtonMark\r
+    class MainStopWatchPresenter;\r
+    class MainStopWatchView : public View<MainStopWatchPresenter>\r
+    {\r
+\r
+    public:\r
+        MainStopWatchView();\r
+        virtual ~MainStopWatchView();\r
+        static MainStopWatchView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UILabel *showTimelabel = nullptr;          // 用来显示计时时间\r
+        UICheckBox *PlayOrPausecheckBox = nullptr; // 播放或暂停复选框\r
+        UIButton *ResetOrMarkbutton = nullptr;     // 重置或标记按钮\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        UICheckBox::OnChangeListener *PlayOrPausecheckBoxChangeListener{nullptr};\r
+        UIView::OnClickListener *ResetOrMarkbuttonClick{nullptr};\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchModel.h b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchModel.h
new file mode 100644 (file)
index 0000000..66baa6d
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef STOP_WATCH_MODEL_H\r
+#define STOP_WATCH_MODEL_H\r
+\r
+#include <iostream>\r
+#include <string>\r
+#include <memory>\r
+\r
+namespace OHOS\r
+{\r
+    class StopWatchModel\r
+    {\r
+    public:\r
+        static std::shared_ptr<StopWatchModel> GetInstance(); // shared_ptr:当没有引用指向这个实例时会自动释放内存\r
+        ~StopWatchModel() {}\r
+        char *DisplayMotionDuration();\r
+\r
+    private:\r
+        // 将构造函数、拷贝构造函数和赋值操作符私有化\r
+        StopWatchModel() = default;\r
+        StopWatchModel(const StopWatchModel &) = delete;\r
+        StopWatchModel &operator=(const StopWatchModel &) = delete;\r
+\r
+    private:\r
+        static int oneDaySec;    // 一天的秒数\r
+        static int oneHourSec;   // 一个小时的秒数\r
+        static int oneMinuteSec; // 一分钟秒数\r
+    };\r
+\r
+}\r
+\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordCycleToLimitPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordCycleToLimitPresenter.h
new file mode 100644 (file)
index 0000000..0d548cd
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef STOPWATCH_RECORD_CYCLE_TO_LIMIT_PRESENTER_H\r
+#define STOPWATCH_RECORD_CYCLE_TO_LIMIT_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "StopWatchRecordCycleToLimitView.h"\r
+\r
+/*弹窗视图:到达最高圈数99时弹出*/\r
+namespace OHOS\r
+{\r
+    class StopWatchRecordCycleToLimitView;\r
+\r
+    class StopWatchRecordCycleToLimitPresenter : public Presenter<StopWatchRecordCycleToLimitView>,\r
+                                                 public UIView::OnClickListener,\r
+                                                 public UIView::OnDragListener\r
+    {\r
+    public:\r
+        StopWatchRecordCycleToLimitPresenter();\r
+        virtual ~StopWatchRecordCycleToLimitPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static StopWatchRecordCycleToLimitPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordCycleToLimitView.h b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordCycleToLimitView.h
new file mode 100644 (file)
index 0000000..f69f361
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef STOPWATCH_RECORD_CYCLE_TO_LIMIT_VIEW_H\r
+#define STOPWATCH_RECORD_CYCLE_TO_LIMIT_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+/*弹窗视图:到达最高圈数99时弹出*/\r
+namespace OHOS\r
+{\r
+    class StopWatchRecordCycleToLimitPresenter;\r
+    class StopWatchRecordCycleToLimitView : public View<StopWatchRecordCycleToLimitPresenter>\r
+    {\r
+\r
+    public:\r
+        StopWatchRecordCycleToLimitView();\r
+        virtual ~StopWatchRecordCycleToLimitView();\r
+        static StopWatchRecordCycleToLimitView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UIImageView *image1_ = nullptr;\r
+        UILabel *label3_ = nullptr;\r
+        UIButton *button1_ = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordTimeToLimitPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordTimeToLimitPresenter.h
new file mode 100644 (file)
index 0000000..6a158dd
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef STOPWATCH_RECORD_TIME_TO_LIMIT_PRESENTER_H\r
+#define STOPWATCH_RECORD_TIME_TO_LIMIT_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "StopWatchRecordTimeToLimitView.h"\r
+/*弹窗视图:到达最高时间99:59.99时弹出*/\r
+namespace OHOS\r
+{\r
+    class StopWatchRecordTimeToLimitView;\r
+    class StopWatchRecordTimeToLimitPresenter : public Presenter<StopWatchRecordTimeToLimitView>,\r
+                                                public UIView::OnClickListener,\r
+                                                public UIView::OnDragListener\r
+    {\r
+    public:\r
+        StopWatchRecordTimeToLimitPresenter();\r
+        virtual ~StopWatchRecordTimeToLimitPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static StopWatchRecordTimeToLimitPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordTimeToLimitView.h b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/include/StopWatchRecordTimeToLimitView.h
new file mode 100644 (file)
index 0000000..9667176
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef STOPWATCH_RECORD_TIME_TO_LIMIT_VIEW_H\r
+#define STOPWATCH_RECORD_TIME_TO_LIMIT_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+/*弹窗视图:到达最高时间99:59.99时弹出*/\r
+namespace OHOS\r
+{\r
+    class StopWatchRecordTimeToLimitPresenter;\r
+    class StopWatchRecordTimeToLimitView : public View<StopWatchRecordTimeToLimitPresenter>\r
+    {\r
+\r
+    public:\r
+        StopWatchRecordTimeToLimitView();\r
+        virtual ~StopWatchRecordTimeToLimitView();\r
+        static StopWatchRecordTimeToLimitView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UIImageView *image1_ = nullptr;\r
+        UILabel *label3_ = nullptr;\r
+        UIButton *button1_ = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/MainStopWatchPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/MainStopWatchPresenter.cpp
new file mode 100644 (file)
index 0000000..8cd78aa
--- /dev/null
@@ -0,0 +1,70 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "stopwatch/include/MainStopWatchPresenter.h"\r
+/*秒表主视图*/\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static MainStopWatchPresenter *g_pMainStopWatchPresenter = nullptr;\r
+\r
+    MainStopWatchPresenter::MainStopWatchPresenter()\r
+    {\r
+\r
+        g_pMainStopWatchPresenter = this;\r
+    }\r
+\r
+    MainStopWatchPresenter::~MainStopWatchPresenter()\r
+    {\r
+\r
+        g_pMainStopWatchPresenter = nullptr;\r
+    }\r
+\r
+    MainStopWatchPresenter *MainStopWatchPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pMainStopWatchPresenter;\r
+    }\r
+\r
+    void MainStopWatchPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<MainStopWatchView>::OnStart();\r
+    }\r
+\r
+    void MainStopWatchPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<MainStopWatchView>::OnPause();\r
+    }\r
+\r
+    void MainStopWatchPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<MainStopWatchView>::OnResume();\r
+    }\r
+\r
+    void MainStopWatchPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<MainStopWatchView>::OnStop();\r
+    }\r
+\r
+    bool MainStopWatchPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
+        }\r
+        return true;\r
+    }\r
+\r
+    bool MainStopWatchPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        UNUSED(view);\r
+        UNUSED(event);\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/MainStopWatchView.cpp
new file mode 100644 (file)
index 0000000..29c080b
--- /dev/null
@@ -0,0 +1,289 @@
+#include "stopwatch/include/MainStopWatchView.h"\r
+#include "stopwatch/include/MainStopWatchPresenter.h"\r
+#include "UiConfig.h"\r
+#include "NativeAbility.h"\r
+#include "AppViewIDs.h"\r
+/*秒表主视图*/\r
+namespace OHOS\r
+{\r
+    /*点击该复选框会播放或暂停计时*/\r
+    class PlayOrPausecheckBoxOnChangeListener : public UICheckBox::OnChangeListener\r
+    {\r
+    public:\r
+        PlayOrPausecheckBoxOnChangeListener(UICheckBox *checkbox, UIButton *button)\r
+        {\r
+            m_checkbox = checkbox;\r
+            m_button = button;\r
+        }\r
+        bool OnChange(UICheckBox::UICheckBoxState state) override\r
+        {\r
+            if (state == UICheckBox::UICheckBoxState::SELECTED)\r
+            {\r
+                m_button->SetViewId(ResetOrMarkButton_MARK_VIEWID);\r
+                m_button->SetImageSrc(ResetOrMarkButtonImg_Mark, nullptr);\r
+                m_button->Invalidate(); // 图片重新赋值要刷新该区域\r
+            }\r
+            else\r
+            {\r
+                m_button->SetViewId(ResetOrMarkButton_RESET2_VIEWID);\r
+                m_button->SetImageSrc(ResetOrMarkButtonImg_Reset2, nullptr);\r
+                m_button->Invalidate();\r
+            }\r
+            return true;\r
+        }\r
+\r
+    private:\r
+        UICheckBox *m_checkbox{nullptr};\r
+        UIButton *m_button{nullptr};\r
+    };\r
+    int flag = 0;\r
+    /*标记或重置时间按钮监听*/\r
+    class ResetOrMarkbuttonOnClickListener : public UIView::OnClickListener\r
+    {\r
+    public:\r
+        ResetOrMarkbuttonOnClickListener(UIButton *button)\r
+        {\r
+            m_button = button;\r
+        }\r
+\r
+        bool OnClick(UIView &view, const ClickEvent &event) override\r
+        {\r
+            if (strcmp(view.GetViewId(), ResetOrMarkButton_MARK_VIEWID) == 0)\r
+            {\r
+                printf("mark!\n");\r
+                if (flag == 0)\r
+                {\r
+                    flag = 1;\r
+                    NativeAbility::GetInstance().ChangeSlice(VIEW_STOPWATCH_RECORD_CYCLE_TO_LIMIT);\r
+                }\r
+                else\r
+                {\r
+                    flag = 0;\r
+                    NativeAbility::GetInstance().ChangeSlice(VIEW_STOPWATCH_RECORD_TIME_TO_LIMIT);\r
+                }\r
+            }\r
+            else if (strcmp(view.GetViewId(), ResetOrMarkButton_RESET2_VIEWID) == 0)\r
+            {\r
+                printf("Reset2!\n");\r
+                m_button->SetViewId(ResetOrMarkButton_RESET1_VIEWID);\r
+                m_button->SetImageSrc(ResetOrMarkButtonImg_Reset1, ResetOrMarkButtonImg_Reset1);\r
+                m_button->Invalidate();\r
+            }\r
+            return true;\r
+        }\r
+        UIButton *m_button{nullptr};\r
+    };\r
+}\r
+namespace OHOS\r
+{\r
+\r
+    static MainStopWatchView *g_pMainStopWatchView{nullptr};\r
+\r
+    MainStopWatchView::MainStopWatchView()\r
+    {\r
+\r
+        g_pMainStopWatchView = this;\r
+    }\r
+\r
+    MainStopWatchView::~MainStopWatchView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pMainStopWatchView = nullptr;\r
+    }\r
+\r
+    MainStopWatchView *MainStopWatchView::GetInstance()\r
+    {\r
+\r
+        return g_pMainStopWatchView;\r
+    }\r
+\r
+    void MainStopWatchView::InitView()\r
+    {\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);\r
+        scrollView1_->Resize(466, 466);\r
+        scrollView1_->SetViewId("scrollView1");\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(203, 52);\r
+        label1_->Resize(60, 35);\r
+        label1_->SetViewId("label1");\r
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\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
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (showTimelabel == nullptr)\r
+        {\r
+            showTimelabel = new UILabel();\r
+        }\r
+        showTimelabel->SetPosition(63, 160);\r
+        showTimelabel->Resize(200, 60);\r
+        showTimelabel->SetViewId("showTimelabel");\r
+        showTimelabel->SetStyle(STYLE_TEXT_FONT, 80);\r
+        showTimelabel->SetStyle(STYLE_LINE_HEIGHT, 94);\r
+        showTimelabel->SetText("00:00.00");\r
+        showTimelabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        showTimelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        showTimelabel->SetRollSpeed(0);\r
+        showTimelabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 80);\r
+        scrollView1_->Add(showTimelabel);\r
+        showTimelabel->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add CheckBox to App\r
+        if (PlayOrPausecheckBox == nullptr)\r
+        {\r
+            PlayOrPausecheckBox = new UICheckBox();\r
+        }\r
+        PlayOrPausecheckBox->SetPosition(118, 321);\r
+        PlayOrPausecheckBox->Resize(100, 100);\r
+        PlayOrPausecheckBox->SetViewId(PlayOrPausecheckBoxVIEWID);\r
+        PlayOrPausecheckBox->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
+        PlayOrPausecheckBox->SetStyle(STYLE_BORDER_RADIUS, 51);\r
+        PlayOrPausecheckBox->SetImages(checkBox1selectedImg, checkBox1unSelectedImg);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(PlayOrPausecheckBox);\r
+        PlayOrPausecheckBox->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (ResetOrMarkbutton == nullptr)\r
+        {\r
+            ResetOrMarkbutton = new UIButton();\r
+        }\r
+        ResetOrMarkbutton->SetPosition(248, 321);\r
+        ResetOrMarkbutton->Resize(100, 100);\r
+        ResetOrMarkbutton->SetViewId(ResetOrMarkButton_RESET1_VIEWID);\r
+        ResetOrMarkbutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
+        ResetOrMarkbutton->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+        ResetOrMarkbutton->SetImageSrc(ResetOrMarkButtonImg_Reset1, nullptr);\r
+        ResetOrMarkbutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffbfbfb, UIButton::PRESSED);\r
+        ResetOrMarkbutton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
+        ResetOrMarkbutton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        scrollView1_->Add(ResetOrMarkbutton);\r
+        ResetOrMarkbutton->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add the CallBack about events\r
+        PlayOrPausecheckBoxChangeListener = static_cast<UICheckBox::OnChangeListener *>(new PlayOrPausecheckBoxOnChangeListener(PlayOrPausecheckBox, ResetOrMarkbutton));\r
+        PlayOrPausecheckBox->SetOnChangeListener(PlayOrPausecheckBoxChangeListener);\r
+        ResetOrMarkbuttonClick = static_cast<UIView::OnClickListener *>(new ResetOrMarkbuttonOnClickListener(ResetOrMarkbutton));\r
+        ResetOrMarkbutton->SetOnClickListener(ResetOrMarkbuttonClick);\r
+    }\r
+\r
+    void MainStopWatchView::DeInitView()\r
+    {\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (showTimelabel != nullptr)\r
+        {\r
+            delete showTimelabel;\r
+            showTimelabel = nullptr;\r
+        }\r
+        if (PlayOrPausecheckBox != nullptr)\r
+        {\r
+            delete PlayOrPausecheckBox;\r
+            PlayOrPausecheckBox = nullptr;\r
+        }\r
+        if (ResetOrMarkbutton != nullptr)\r
+        {\r
+            delete ResetOrMarkbutton;\r
+            ResetOrMarkbutton = nullptr;\r
+        }\r
+        if (draglistener != nullptr)\r
+        {\r
+            delete draglistener;\r
+            draglistener = nullptr;\r
+        }\r
+        if (PlayOrPausecheckBoxChangeListener != nullptr)\r
+        {\r
+            delete PlayOrPausecheckBoxChangeListener;\r
+            PlayOrPausecheckBoxChangeListener = nullptr;\r
+        }\r
+        if (ResetOrMarkbuttonClick != nullptr)\r
+        {\r
+            delete ResetOrMarkbuttonClick;\r
+            ResetOrMarkbuttonClick = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+    void MainStopWatchView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void MainStopWatchView::OnStart()\r
+    {\r
+        // container_容器属性 new\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        // container_容器属性 扩展\r
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+        draglistener = static_cast<UIView::OnDragListener *>(MainStopWatchPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetOnDragListener(draglistener);\r
+        container_->SetTouchable(true);\r
+        container_->SetDraggable(true);\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void MainStopWatchView::OnSetUpView()\r
+    {\r
+\r
+        View<MainStopWatchPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void MainStopWatchView::OnTearDownView()\r
+    {\r
+\r
+        View<MainStopWatchPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void MainStopWatchView::OnStop()\r
+    {\r
+\r
+        View<MainStopWatchPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchModel.cpp
new file mode 100644 (file)
index 0000000..bb4f2be
--- /dev/null
@@ -0,0 +1,21 @@
+#include "stopwatch/include/StopWatchModel.h"\r
+#include "cmsis_os2.h"\r
+#include "cmsis_os.h"\r
+\r
+namespace OHOS\r
+{\r
+    int StopWatchModel::oneDaySec = 86400; // 一天的秒数\r
+    int StopWatchModel::oneHourSec = 3600; // 一个小时的秒数\r
+    int StopWatchModel::oneMinuteSec = 60; // 一分钟秒数\r
+\r
+    std::shared_ptr<StopWatchModel> StopWatchModel::GetInstance() // shared_ptr:当没有引用指向这个实例时会自动释放内存\r
+    {\r
+        static std::shared_ptr<StopWatchModel> instance(new StopWatchModel());\r
+        return instance;\r
+    }\r
+\r
+    /* 时间显示 */\r
+    char *StopWatchModel::DisplayMotionDuration()\r
+    {\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordCycleToLimitPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordCycleToLimitPresenter.cpp
new file mode 100644 (file)
index 0000000..730c2c9
--- /dev/null
@@ -0,0 +1,70 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "stopwatch/include/StopWatchRecordCycleToLimitPresenter.h"\r
+\r
+/*弹窗视图:到达最高圈数99时弹出*/\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static StopWatchRecordCycleToLimitPresenter *g_pStopWatchRecordCycleToLimitPresenter = nullptr;\r
+\r
+    StopWatchRecordCycleToLimitPresenter::StopWatchRecordCycleToLimitPresenter()\r
+    {\r
+\r
+        g_pStopWatchRecordCycleToLimitPresenter = this;\r
+    }\r
+\r
+    StopWatchRecordCycleToLimitPresenter::~StopWatchRecordCycleToLimitPresenter()\r
+    {\r
+\r
+        g_pStopWatchRecordCycleToLimitPresenter = nullptr;\r
+    }\r
+\r
+    StopWatchRecordCycleToLimitPresenter *StopWatchRecordCycleToLimitPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pStopWatchRecordCycleToLimitPresenter;\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<StopWatchRecordCycleToLimitView>::OnStart();\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<StopWatchRecordCycleToLimitView>::OnPause();\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<StopWatchRecordCycleToLimitView>::OnResume();\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<StopWatchRecordCycleToLimitView>::OnStop();\r
+    }\r
+\r
+    bool StopWatchRecordCycleToLimitPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+        UNUSED(view);\r
+        UNUSED(event);\r
+        return true;\r
+    }\r
+\r
+    bool StopWatchRecordCycleToLimitPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (strcmp(view.GetViewId(), "ReturnButton") == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_STOPWATCH);\r
+        }\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordCycleToLimitView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordCycleToLimitView.cpp
new file mode 100644 (file)
index 0000000..9862deb
--- /dev/null
@@ -0,0 +1,195 @@
+#include "stopwatch/include/StopWatchRecordCycleToLimitView.h"\r
+#include "stopwatch/include/StopWatchRecordCycleToLimitPresenter.h"\r
+#include "UiConfig.h"\r
+/*弹窗视图:到达最高圈数99时弹出*/\r
+namespace OHOS\r
+{\r
+\r
+    static StopWatchRecordCycleToLimitView *g_pStopWatchRecordCycleToLimitView{nullptr};\r
+\r
+    StopWatchRecordCycleToLimitView::StopWatchRecordCycleToLimitView()\r
+    {\r
+\r
+        g_pStopWatchRecordCycleToLimitView = this;\r
+    }\r
+\r
+    StopWatchRecordCycleToLimitView::~StopWatchRecordCycleToLimitView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pStopWatchRecordCycleToLimitView = nullptr;\r
+    }\r
+\r
+    StopWatchRecordCycleToLimitView *StopWatchRecordCycleToLimitView::GetInstance()\r
+    {\r
+\r
+        return g_pStopWatchRecordCycleToLimitView;\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitView::InitView()\r
+    {\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);        \r
+        scrollView1_->Resize(466, 466);         \r
+        scrollView1_->SetViewId("scrollView1"); \r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(203, 52); \r
+        label1_->Resize(60, 35);       \r
+        label1_->SetViewId("label1");  \r
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\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
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (image1_ == nullptr)\r
+        {\r
+            image1_ = new UIImageView();\r
+        }\r
+        image1_->SetPosition(193, 121); \r
+        image1_->Resize(100, 100);      \r
+        image1_->SetViewId("image1");   \r
+        image1_->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        char *image1imagesPath = "/user/res/countdown/COUNTDOWN_ATTENTION.bin";\r
+        image1_->SetSrc(image1imagesPath);\r
+        scrollView1_->Add(image1_);\r
+        image1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Label to App\r
+        if (label3_ == nullptr)\r
+        {\r
+            label3_ = new UILabel();\r
+        }\r
+        label3_->SetPosition(83, 253); \r
+        label3_->Resize(300, 35);      \r
+        label3_->SetViewId("label3");  \r
+        label3_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label3_->SetStyle(STYLE_LINE_HEIGHT, 35);\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, 30);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label3_);\r
+        label3_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (button1_ == nullptr)\r
+        {\r
+            button1_ = new UIButton();\r
+        }\r
+        button1_->SetPosition(0, 366);  \r
+        button1_->Resize(466, 100);     \r
+        button1_->SetViewId("ReturnButton"); \r
+        button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
+        button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+        char *button1defaultImgSrc = "/user/res/countdown/COUNTDOWN_BUTTON.bin";\r
+        button1_->SetImageSrc(button1defaultImgSrc, nullptr);\r
+        button1_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffbfbfb, UIButton::PRESSED);\r
+        button1_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
+        button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(StopWatchRecordCycleToLimitPresenter::GetInstance());\r
+        button1_->SetOnClickListener(button1Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(button1_);\r
+        button1_->SetVisible(true);\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitView::DeInitView()\r
+    {\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (image1_ != nullptr)\r
+        {\r
+            delete image1_;\r
+            image1_ = nullptr;\r
+        }\r
+        if (label3_ != nullptr)\r
+        {\r
+            delete label3_;\r
+            label3_ = nullptr;\r
+        }\r
+        if (button1_ != nullptr)\r
+        {\r
+            delete button1_;\r
+            button1_ = nullptr;\r
+        }\r
+    }\r
+    void StopWatchRecordCycleToLimitView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void StopWatchRecordCycleToLimitView::OnStart()\r
+    {\r
+        // container_容器属性 new\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        // container_容器属性 扩展\r
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+        container_->SetTouchable(true);\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitView::OnSetUpView()\r
+    {\r
+\r
+        View<StopWatchRecordCycleToLimitPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitView::OnTearDownView()\r
+    {\r
+\r
+        View<StopWatchRecordCycleToLimitPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void StopWatchRecordCycleToLimitView::OnStop()\r
+    {\r
+\r
+        View<StopWatchRecordCycleToLimitPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordTimeToLimitPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordTimeToLimitPresenter.cpp
new file mode 100644 (file)
index 0000000..d58558f
--- /dev/null
@@ -0,0 +1,70 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "stopwatch/include/StopWatchRecordTimeToLimitPresenter.h"\r
+\r
+/*弹窗视图:到达最高时间99:59.99时弹出*/\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static StopWatchRecordTimeToLimitPresenter *g_pStopWatchRecordTimeToLimitPresenter = nullptr;\r
+\r
+    StopWatchRecordTimeToLimitPresenter::StopWatchRecordTimeToLimitPresenter()\r
+    {\r
+\r
+        g_pStopWatchRecordTimeToLimitPresenter = this;\r
+    }\r
+\r
+    StopWatchRecordTimeToLimitPresenter::~StopWatchRecordTimeToLimitPresenter()\r
+    {\r
+\r
+        g_pStopWatchRecordTimeToLimitPresenter = nullptr;\r
+    }\r
+\r
+    StopWatchRecordTimeToLimitPresenter *StopWatchRecordTimeToLimitPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pStopWatchRecordTimeToLimitPresenter;\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<StopWatchRecordTimeToLimitView>::OnStart();\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<StopWatchRecordTimeToLimitView>::OnPause();\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<StopWatchRecordTimeToLimitView>::OnResume();\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<StopWatchRecordTimeToLimitView>::OnStop();\r
+    }\r
+\r
+    bool StopWatchRecordTimeToLimitPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+        UNUSED(view);\r
+        UNUSED(event);\r
+        return true;\r
+    }\r
+\r
+    bool StopWatchRecordTimeToLimitPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (strcmp(view.GetViewId(), "ReturnButton") == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_STOPWATCH);\r
+        }\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordTimeToLimitView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/stopwatch/src/StopWatchRecordTimeToLimitView.cpp
new file mode 100644 (file)
index 0000000..2fb5b96
--- /dev/null
@@ -0,0 +1,165 @@
+#include "stopwatch/include/StopWatchRecordTimeToLimitView.h"\r
+#include "stopwatch/include/StopWatchRecordTimeToLimitPresenter.h"\r
+\r
+#include "UiConfig.h"\r
+\r
+/*弹窗视图:到达最高时间99:59.99时弹出*/\r
+namespace OHOS\r
+{\r
+\r
+    static StopWatchRecordTimeToLimitView *g_pStopWatchRecordTimeToLimitView{nullptr};\r
+\r
+    StopWatchRecordTimeToLimitView::StopWatchRecordTimeToLimitView()\r
+    {\r
+\r
+        g_pStopWatchRecordTimeToLimitView = this;\r
+    }\r
+\r
+    StopWatchRecordTimeToLimitView::~StopWatchRecordTimeToLimitView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pStopWatchRecordTimeToLimitView = nullptr;\r
+    }\r
+\r
+    StopWatchRecordTimeToLimitView *StopWatchRecordTimeToLimitView::GetInstance()\r
+    {\r
+\r
+        return g_pStopWatchRecordTimeToLimitView;\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitView::InitView()\r
+    {\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);\r
+        scrollView1_->Resize(466, 466);\r
+        scrollView1_->SetViewId("scrollView1");\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(203, 52);\r
+        label1_->Resize(60, 35);\r
+        label1_->SetViewId("label1");\r
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\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
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (image1_ == nullptr)\r
+        {\r
+            image1_ = new UIImageView();\r
+        }\r
+        image1_->SetPosition(193, 121);\r
+        image1_->Resize(100, 100);\r
+        image1_->SetViewId("image1");\r
+        image1_->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        char *image1imagesPath = "/user/res/countdown/COUNTDOWN_ATTENTION.bin";\r
+        image1_->SetSrc(image1imagesPath);\r
+        scrollView1_->Add(image1_);\r
+        image1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Label to App\r
+        if (label3_ == nullptr)\r
+        {\r
+            label3_ = new UILabel();\r
+        }\r
+        label3_->SetPosition(53, 235);\r
+        label3_->Resize(300, 35);\r
+        label3_->SetViewId("label3");\r
+        label3_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label3_->SetStyle(STYLE_LINE_HEIGHT, 35);\r
+        label3_->SetText("当前已达到了最长时间\n表秒自动暂停,请重新开始");\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, 30);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label3_);\r
+        label3_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add Button to App\r
+        if (button1_ == nullptr)\r
+        {\r
+            button1_ = new UIButton();\r
+        }\r
+        button1_->SetPosition(0, 366);\r
+        button1_->Resize(466, 100);\r
+        button1_->SetViewId("ReturnButton");\r
+        button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);\r
+        button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+        char *button1defaultImgSrc = "/user/res/countdown/COUNTDOWN_BUTTON.bin";\r
+        button1_->SetImageSrc(button1defaultImgSrc, nullptr);\r
+        button1_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffbfbfb, UIButton::PRESSED);\r
+        button1_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
+        button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+        // Add the CallBack about events\r
+        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(StopWatchRecordTimeToLimitPresenter::GetInstance());\r
+        button1_->SetOnClickListener(button1Click);\r
+        // Add to scrollView1\r
+        scrollView1_->Add(button1_);\r
+        button1_->SetVisible(true);\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitView::DeInitView()\r
+    {\r
+    }\r
+    void StopWatchRecordTimeToLimitView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void StopWatchRecordTimeToLimitView::OnStart()\r
+    {\r
+        // container_容器属性 new\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        // container_容器属性 扩展\r
+        container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+        container_->SetTouchable(true);\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitView::OnSetUpView()\r
+    {\r
+\r
+        View<StopWatchRecordTimeToLimitPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitView::OnTearDownView()\r
+    {\r
+\r
+        View<StopWatchRecordTimeToLimitPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void StopWatchRecordTimeToLimitView::OnStop()\r
+    {\r
+\r
+        View<StopWatchRecordTimeToLimitPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingCardPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingCardPresenter.h
new file mode 100644 (file)
index 0000000..d011868
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _TraingCard_PRESENTER_H\r
+#define _TraingCard_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "TraingCardView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class TraingCardView;\r
+\r
+    class TraingCardPresenter : public Presenter<TraingCardView>,\r
+                                 public UIView::OnClickListener,\r
+                                 public UIView::OnDragListener\r
+    {\r
+    public:\r
+        TraingCardPresenter();\r
+        virtual ~TraingCardPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+        static TraingCardPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingCardView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingCardView.h
new file mode 100644 (file)
index 0000000..bdf142e
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef _TraingCard_VIEW_H\r
+#define _TraingCard_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include <ui_scroll_view.h>\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_image_animator.h"\r
+#include "components/ui_label_button_ext.h"\r
+#include "components/ui_chart.h"\r
+#include "components/ui_list.h"\r
+#include "components/icon_adapter.h"\r
+#include "wearable_log.h"\r
+#include "ohos_types.h"\r
+#include "components/ui_card_page.h"\r
+#include "components/ui_swipe_view.h"\r
+\r
+#include "TraingCardPresenter.h"\r
+namespace OHOS\r
+{\r
+    class TraingCardPresenter;\r
+    class TraingCardView : public View<TraingCardPresenter>\r
+    {\r
+\r
+    public:\r
+        TraingCardView();\r
+        virtual ~TraingCardView();\r
+        static TraingCardView *GetInstance(void);\r
+        \r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+        void InitView();\r
+        void DeInit();\r
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);\r
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);\r
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);\r
+        void InitList();\r
+        void PreLoad(void);\r
+\r
+        // 通过函数改变\r
+        void SetLabel();\r
+        void SetButton();\r
+\r
+    private:\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        TraingCardView(TraingCardView &&) = delete;\r
+        TraingCardView &operator=(TraingCardView &&) = delete;\r
+\r
+        UISwipeView *swipe_ = nullptr;\r
+\r
+        UILabel *label1_ = nullptr;\r
+        UILabel *label2_ = nullptr;\r
+        UILabel *label3_ = nullptr;\r
+\r
+        bool viewiInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // TraingCard_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingControlPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingControlPresenter.h
new file mode 100644 (file)
index 0000000..c1ebbfd
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _TraingControl_PRESENTER_H\r
+#define _TraingControl_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "TraingControlView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class TraingControlView;\r
+\r
+    class TraingControlPresenter : public Presenter<TraingControlView>,\r
+                                 public UIView::OnClickListener,\r
+                                 public UIView::OnDragListener\r
+    {\r
+    public:\r
+        TraingControlPresenter();\r
+        virtual ~TraingControlPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+        std::string test = "暂停";\r
+        static TraingControlPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingControlView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingControlView.h
new file mode 100644 (file)
index 0000000..e96e781
--- /dev/null
@@ -0,0 +1,76 @@
+#ifndef _TraingControl_VIEW_H\r
+#define _TraingControl_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include <ui_scroll_view.h>\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_image_animator.h"\r
+#include "components/ui_label_button_ext.h"\r
+#include "components/ui_chart.h"\r
+#include "components/ui_list.h"\r
+#include "components/icon_adapter.h"\r
+#include "wearable_log.h"\r
+#include "ohos_types.h"\r
+#include "components/ui_card_page.h"\r
+\r
+#include "TraingControlPresenter.h"\r
+namespace OHOS\r
+{\r
+#define BUTTONSTOP  "button1"\r
+#define BUTTONPAUSE "button2"\r
+#define BUTTONCONTINUE "button3"\r
+\r
+#define BUTTON_PAUSE_IMG_SRC "/user/res/Training/sport-pause.bin"\r
+#define BUTTON_STOP_IMG_SRC "/user/res/Training/sport-stop.bin"\r
+#define BUTTON_CONTINUE_IMG_SRC "/user/res/Training/sport-continue.bin"\r
+\r
+    class TraingControlPresenter;\r
+    class TraingControlView : public View<TraingControlPresenter>\r
+    {\r
+\r
+    public:\r
+        TraingControlView();\r
+        virtual ~TraingControlView();\r
+        static TraingControlView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+        void InitView();\r
+        void DeInit();\r
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);\r
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);\r
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);\r
+        void InitList();\r
+        void PreLoad(void);\r
+\r
+        //通过函数改变\r
+        void SetLabel();\r
+        void SetButton();\r
+\r
+    private:\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        TraingControlView(TraingControlView &&) = delete;\r
+        TraingControlView &operator=(TraingControlView &&) = delete;\r
+\r
+        UIViewGroup *container_ = nullptr;\r
+\r
+        UILabel *label1_ = nullptr;\r
+        UILabel *label2_ = nullptr;\r
+        UILabel *label3_ = nullptr;\r
+        UILabel *label4_ = nullptr;\r
+\r
+        UIImageView *image1_ = nullptr;\r
+\r
+        UIButton *button1_ = nullptr;\r
+        UIButton *button2_ = nullptr;\r
+\r
+        bool viewiInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // TraingControl_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDataPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDataPresenter.h
new file mode 100644 (file)
index 0000000..256325e
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _TraingData_PRESENTER_H\r
+#define _TraingData_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "TraingDataView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class TraingDataView;\r
+\r
+    class TraingDataPresenter : public Presenter<TraingDataView>,\r
+                                public UIView::OnClickListener,\r
+                                public UIView::OnDragListener\r
+    {\r
+    public:\r
+        TraingDataPresenter();\r
+        virtual ~TraingDataPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+        static TraingDataPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDataView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDataView.h
new file mode 100644 (file)
index 0000000..c782f94
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef _TraingData_VIEW_H\r
+#define _TraingData_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include <ui_scroll_view.h>\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_image_animator.h"\r
+#include "components/ui_label_button_ext.h"\r
+#include "components/ui_chart.h"\r
+#include "components/ui_list.h"\r
+#include "components/icon_adapter.h"\r
+#include "wearable_log.h"\r
+#include "ohos_types.h"\r
+#include "components/ui_card_page.h"\r
+\r
+#include "TraingDataPresenter.h"\r
+namespace OHOS\r
+{\r
+#define BUTTONNOTE "button1"\r
+\r
+\r
+    class TraingDataPresenter;\r
+    class TraingDataView : public View<TraingDataPresenter>\r
+    {\r
+\r
+    public:\r
+        TraingDataView();\r
+        virtual ~TraingDataView();\r
+        static TraingDataView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+        void InitView();\r
+        void DeInit();\r
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);\r
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);\r
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);\r
+        void InitList();\r
+        void PreLoad(void);\r
+\r
+        // 通过函数改变\r
+        void SetLabel();\r
+        void SetButton();\r
+\r
+    private:\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        TraingDataView(TraingDataView &&) = delete;\r
+        TraingDataView &operator=(TraingDataView &&) = delete;\r
+\r
+        UIViewGroup *container_ = nullptr;\r
+\r
+        UILabel *label1_ = nullptr;\r
+        UILabel *label2_ = nullptr;\r
+        UILabel *label3_ = nullptr;\r
+        UILabel *label4_ = nullptr;\r
+        UILabel *label5_ = nullptr;\r
+\r
+        UIImageView *image1_ = nullptr;\r
+        UIImageView *image2_ = nullptr;\r
+        UIImageView *image3_ = nullptr;\r
+        UIImageView *image4_ = nullptr;\r
+        UIImageView *image5_ = nullptr;\r
+        UIImageView *image6_ = nullptr;\r
+\r
+        UIButton *button1_ = nullptr;\r
+        bool viewiInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // TraingData_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDetailPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDetailPresenter.h
new file mode 100644 (file)
index 0000000..351c7e3
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _TraingDetail_PRESENTER_H\r
+#define _TraingDetail_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "TraingDetailView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class TraingDetailView;\r
+\r
+    class TraingDetailPresenter : public Presenter<TraingDetailView>,\r
+                                public UIView::OnClickListener,\r
+                                public UIView::OnDragListener\r
+    {\r
+    public:\r
+        TraingDetailPresenter();\r
+        virtual ~TraingDetailPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+        static TraingDetailPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDetailView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingDetailView.h
new file mode 100644 (file)
index 0000000..735c997
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef _TraingDetail_VIEW_H\r
+#define _TraingDetail_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include <ui_scroll_view.h>\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+#include "components/ui_image_animator.h"\r
+#include "components/ui_label_button_ext.h"\r
+#include "components/ui_chart.h"\r
+#include "components/ui_list.h"\r
+#include "components/icon_adapter.h"\r
+#include "wearable_log.h"\r
+#include "ohos_types.h"\r
+#include "components/ui_card_page.h"\r
+\r
+#include "TraingDetailPresenter.h"\r
+namespace OHOS\r
+{\r
+    class TraingDetailPresenter;\r
+    class TraingDetailView : public View<TraingDetailPresenter>\r
+    {\r
+\r
+    public:\r
+        TraingDetailView();\r
+        virtual ~TraingDetailView();\r
+        static TraingDetailView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+        void InitView();\r
+        void DeInit();\r
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);\r
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);\r
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);\r
+        void InitList();\r
+        void PreLoad(void);\r
+\r
+        // 通过函数改变\r
+        void SetLabel();\r
+        void SetButton();\r
+\r
+    private:\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        TraingDetailView(TraingDetailView &&) = delete;\r
+        TraingDetailView &operator=(TraingDetailView &&) = delete;\r
+\r
+        UIViewGroup *container_ = nullptr;\r
+\r
+        UILabel *label1_ = nullptr;\r
+        UILabel *label2_ = nullptr;\r
+        UILabel *label3_ = nullptr;\r
+        UILabel *label4_ = nullptr;\r
+        UILabel *label5_ = nullptr;\r
+        UILabel *label6_ = nullptr;\r
+        UILabel *label7_ = nullptr;\r
+        UILabel *label8_ = nullptr;\r
+\r
+        UIImageView *image1_ = nullptr;\r
+        UIImageView *image2_ = nullptr;\r
+        UIImageView *image3_ = nullptr;\r
+        UIImageView *image4_ = nullptr;\r
+        UIImageView *image5_ = nullptr;\r
+        UIImageView *image6_ = nullptr;\r
+        UIImageView *image7_ = nullptr;\r
+\r
+        bool viewiInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // TraingDetail_PRESENTER_H\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEnddataPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEnddataPresenter.h
new file mode 100644 (file)
index 0000000..c7877fb
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _TraingEnddata_PRESENTER_H
+#define _TraingEnddata_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingEnddataView.h"
+
+namespace OHOS
+{
+    class TraingEnddataView;
+
+    class TraingEnddataPresenter : public Presenter<TraingEnddataView>,
+                                public UIView::OnClickListener,
+                                public UIView::OnDragListener
+    {
+    public:
+        TraingEnddataPresenter();
+        virtual ~TraingEnddataPresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+        static TraingEnddataPresenter *GetInstance();
+
+    private:
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+    };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEnddataView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEnddataView.h
new file mode 100644 (file)
index 0000000..56c9294
--- /dev/null
@@ -0,0 +1,95 @@
+#ifndef _TraingEnddata_VIEW_H
+#define _TraingEnddata_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 "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingEnddataPresenter.h"
+namespace OHOS
+{
+#define BUTTONBACK "button1"
+
+    class TraingEnddataPresenter;
+    class TraingEnddataView : public View<TraingEnddataPresenter>
+    {
+
+    public:
+        TraingEnddataView();
+        virtual ~TraingEnddataView();
+        static TraingEnddataView *GetInstance(void);
+
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+        void InitView();
+        void DeInit();
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+        void InitList();
+        void PreLoad(void);
+
+        // 通过函数改变
+        void SetLabel();
+        void SetButton();
+
+    private:
+        UIView::OnDragListener *draglistener{nullptr};
+        TraingEnddataView(TraingEnddataView &&) = delete;
+        TraingEnddataView &operator=(TraingEnddataView &&) = delete;
+
+        UIViewGroup *container_ = nullptr;
+        UIScrollView *scrollView1_ = nullptr;
+
+        UILabel *label1_ = nullptr;
+        UILabel *label2_ = nullptr;
+        UILabel *label3_ = nullptr;
+        UILabel *label4_ = nullptr;
+        UILabel *label5_ = nullptr;
+        UILabel *label6_ = nullptr;
+        UILabel *label7_ = nullptr;
+        UILabel *label8_ = nullptr;
+        UILabel *label9_ = nullptr;
+        UILabel *label10_ = nullptr;
+        UILabel *label11_ = nullptr;
+        UILabel *label12_ = nullptr;
+        UILabel *label13_ = nullptr;
+        UILabel *label14_ = nullptr;
+        UILabel *label15_ = nullptr;
+        UILabel *label16_ = nullptr;
+        UILabel *label17_ = nullptr;
+        UILabel *label18_ = nullptr;
+        UILabel *label19_ = nullptr;
+
+        UIButton *button1_ = nullptr;
+
+        UIImageView *image1_ = nullptr;
+        UIImageView *image2_ = nullptr;
+        UIImageView *image3_ = nullptr;
+        UIImageView *image4_ = nullptr;
+        UIImageView *image5_ = nullptr;
+        UIImageView *image6_ = nullptr;
+        UIImageView *image7_ = nullptr;
+        UIImageView *image8_ = nullptr;
+        UIImageView *image9_ = nullptr;
+        UIImageView *image10_ = nullptr;
+        UIImageView *image11_ = nullptr;
+
+        bool viewiInitStatus{false};
+    };
+} // namespace OHOS
+#endif // TraingEnddata_PRESENTER_H
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEndnotePresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEndnotePresenter.h
new file mode 100644 (file)
index 0000000..428b3d0
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef _TraingEndnote_PRESENTER_H
+#define _TraingEndnote_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingEndnoteView.h"
+
+namespace OHOS
+{
+    class TraingEndnoteView;
+
+    class TraingEndnotePresenter : public Presenter<TraingEndnoteView>,
+                                public UIView::OnClickListener,
+                                public UIView::OnDragListener
+    {
+    public:
+        TraingEndnotePresenter();
+        virtual ~TraingEndnotePresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+        static TraingEndnotePresenter *GetInstance();
+
+    private:
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+    };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEndnoteView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingEndnoteView.h
new file mode 100644 (file)
index 0000000..243b521
--- /dev/null
@@ -0,0 +1,66 @@
+#ifndef _TraingEndnote_VIEW_H
+#define _TraingEndnote_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 "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingEndnotePresenter.h"
+namespace OHOS
+{
+#define BUTTONNO "button1"
+#define BUTTONYES "button2"
+
+    class TraingEndnotePresenter;
+    class TraingEndnoteView : public View<TraingEndnotePresenter>
+    {
+
+    public:
+        TraingEndnoteView();
+        virtual ~TraingEndnoteView();
+        static TraingEndnoteView *GetInstance(void);
+
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+        void InitView();
+        void DeInit();
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+        void InitList();
+        void PreLoad(void);
+
+        // 通过函数改变
+        void SetLabel();
+        void SetButton();
+
+    private:
+        UIView::OnDragListener *draglistener{nullptr};
+        TraingEndnoteView(TraingEndnoteView &&) = delete;
+        TraingEndnoteView &operator=(TraingEndnoteView &&) = delete;
+
+        UIViewGroup *container_ = nullptr;
+
+        UILabel *label1_ = nullptr;
+        UILabel *label2_ = nullptr;
+
+        UIButton *button1_ = nullptr;
+        UIButton *button2_ = nullptr;
+        bool viewiInitStatus{false};
+    };
+} // namespace OHOS
+#endif // TraingEndnote_PRESENTER_H
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSPresenter.h
new file mode 100644 (file)
index 0000000..aa6055e
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _TraingGPS_PRESENTER_H
+#define _TraingGPS_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingGPSView.h"
+
+namespace OHOS
+{
+    class TraingGPSView;
+
+    class TraingGPSPresenter : public Presenter<TraingGPSView>,
+                                 public UIView::OnClickListener,
+                                 public UIView::OnDragListener
+    {
+    public:
+        TraingGPSPresenter();
+        virtual ~TraingGPSPresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+
+        static TraingGPSPresenter *GetInstance();
+
+    private:
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+    };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSView.h
new file mode 100644 (file)
index 0000000..4fa4616
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef _TraingGPS_VIEW_H
+#define _TraingGPS_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 "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingGPSPresenter.h"
+namespace OHOS
+{
+#define BUTTONGO "button1"
+#define BUTTONSET "button2"
+
+    class TraingGPSPresenter;
+    class TraingGPSView : public View<TraingGPSPresenter>
+    {
+
+    public:
+        TraingGPSView();
+        virtual ~TraingGPSView();
+        static TraingGPSView *GetInstance(void);
+
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+        void InitView();
+        void DeInit();
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+        void InitList();
+        void PreLoad(void);
+
+    private:
+        UIView::OnDragListener *draglistener{nullptr};
+        TraingGPSView(TraingGPSView &&) = delete;
+        TraingGPSView &operator=(TraingGPSView &&) = delete;
+
+        UIViewGroup *container_ = nullptr;
+        UILabel *label1_ = nullptr;
+        UILabel *label2_ = nullptr;
+        UILabel *label3_ = nullptr;
+        UILabel *label4_ = nullptr;
+        UIButton *button1_ = nullptr;
+        UIButton *button2_ = nullptr;
+        UIImageView *image1_ = nullptr;
+        UIImageView *image2_ = nullptr;
+        bool viewiInitStatus{false};
+    };
+} // namespace OHOS
+#endif // TraingGPS_PRESENTER_H
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSlackPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSlackPresenter.h
new file mode 100644 (file)
index 0000000..21713d7
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _TraingGPSlack_PRESENTER_H
+#define _TraingGPSlack_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingGPSlackView.h"
+
+namespace OHOS
+{
+    class TraingGPSlackView;
+
+    class TraingGPSlackPresenter : public Presenter<TraingGPSlackView>,
+                                 public UIView::OnClickListener,
+                                 public UIView::OnDragListener
+    {
+    public:
+        TraingGPSlackPresenter();
+        virtual ~TraingGPSlackPresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+
+        static TraingGPSlackPresenter *GetInstance();
+
+    private:
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+    };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSlackView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSlackView.h
new file mode 100644 (file)
index 0000000..c96f41e
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef _TraingGPSlack_VIEW_H
+#define _TraingGPSlack_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 "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingGPSlackPresenter.h"
+namespace OHOS
+{
+#define BUTTONGO "button1"
+#define BUTTONSET "button2"
+
+    class TraingGPSlackPresenter;
+    class TraingGPSlackView : public View<TraingGPSlackPresenter>
+    {
+
+    public:
+        TraingGPSlackView();
+        virtual ~TraingGPSlackView();
+        static TraingGPSlackView *GetInstance(void);
+
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+        void InitView();
+        void DeInit();
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+        void InitList();
+        void PreLoad(void);
+
+    private:
+        UIView::OnDragListener *draglistener{nullptr};
+        TraingGPSlackView(TraingGPSlackView &&) = delete;
+        TraingGPSlackView &operator=(TraingGPSlackView &&) = delete;
+
+        UIViewGroup *container_ = nullptr;
+        UILabel *label1_ = nullptr;
+        UILabel *label2_ = nullptr;
+        UILabel *label3_ = nullptr;
+        UILabel *label4_ = nullptr;
+        UIButton *button1_ = nullptr;
+        UIButton *button2_ = nullptr;
+        UIImageView *image1_ = nullptr;
+        UIImageView *image2_ = nullptr;
+        bool viewiInitStatus{false};
+    };
+} // namespace OHOS
+#endif // TraingGPSlack_PRESENTER_H
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSnotePresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSnotePresenter.h
new file mode 100644 (file)
index 0000000..cbaf8ea
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _TraingGPSnote_PRESENTER_H
+#define _TraingGPSnote_PRESENTER_H
+
+#include "Presenter.h"
+#include "TraingGPSnoteView.h"
+
+namespace OHOS
+{
+    class TraingGPSnoteView;
+
+    class TraingGPSnotePresenter : public Presenter<TraingGPSnoteView>,
+                                 public UIView::OnClickListener,
+                                 public UIView::OnDragListener
+    {
+    public:
+        TraingGPSnotePresenter();
+        virtual ~TraingGPSnotePresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+
+        static TraingGPSnotePresenter *GetInstance();
+
+    private:
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+    };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSnoteView.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingGPSnoteView.h
new file mode 100644 (file)
index 0000000..555f4c4
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef _TraingGPSnote_VIEW_H
+#define _TraingGPSnote_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 "components/ui_list.h"
+#include "components/icon_adapter.h"
+#include "wearable_log.h"
+#include "ohos_types.h"
+#include "components/ui_card_page.h"
+
+#include "TraingGPSnotePresenter.h"
+namespace OHOS
+{
+#define BUTTONBACK "button1"
+#define BUTTONGO "button2"
+
+    class TraingGPSnotePresenter;
+    class TraingGPSnoteView : public View<TraingGPSnotePresenter>
+    {
+
+    public:
+        TraingGPSnoteView();
+        virtual ~TraingGPSnoteView();
+        static TraingGPSnoteView *GetInstance(void);
+
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+        void InitView();
+        void DeInit();
+        void InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize);
+        void InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId);
+        void InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath);
+        void InitList();
+        void PreLoad(void);
+
+    private:
+        UIView::OnDragListener *draglistener{nullptr};
+        TraingGPSnoteView(TraingGPSnoteView &&) = delete;
+        TraingGPSnoteView &operator=(TraingGPSnoteView &&) = delete;
+
+        UIViewGroup *container_ = nullptr;
+        UIScrollView *scrollView1_ = nullptr;
+
+        UILabel *label1_ = nullptr;
+        UILabel *label2_ = nullptr;
+        UILabel *label3_ = nullptr;
+        UILabel *label4_ = nullptr;
+
+        UIButton *button1_ = nullptr;
+        UIButton *button2_ = nullptr;
+
+        UIImageView *image1_ = nullptr;
+        UIImageView *image2_ = nullptr;
+        bool viewiInitStatus{false};
+    };
+} // namespace OHOS
+#endif // TraingGPSnote_PRESENTER_H
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingSetCaluliPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingSetCaluliPresenter.h
new file mode 100644 (file)
index 0000000..5706845
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef _TraingSetCaluli_PRESENTER_H\r
+#define _TraingSetCaluli_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "TraingSetCaluliView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class TraingSetCaluliView;\r
+\r
+    class TraingSetCaluliPresenter : public Presenter<TraingSetCaluliView>,\r
+                                 public UIView::OnClickListener,\r
+                                 public UIView::OnDragListener\r
+    {\r
+    public:\r
+        TraingSetCaluliPresenter();\r
+        virtual ~TraingSetCaluliPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static TraingSetCaluliPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingCardPresenter.cpp
new file mode 100644 (file)
index 0000000..cac32c0
--- /dev/null
@@ -0,0 +1,79 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include <iostream>\r
+#include <chrono>\r
+#include <thread>\r
+#include "traing/include/TraingCardPresenter.h"\r
+// #include "TraingCardView.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static TraingCardPresenter *g_pTraingCardPresenter = nullptr;\r
+\r
+    TraingCardPresenter::TraingCardPresenter()\r
+    {\r
+\r
+        g_pTraingCardPresenter = this;\r
+    }\r
+\r
+    TraingCardPresenter::~TraingCardPresenter()\r
+    {\r
+\r
+        g_pTraingCardPresenter = nullptr;\r
+    }\r
+\r
+    TraingCardPresenter *TraingCardPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pTraingCardPresenter;\r
+    }\r
+\r
+    void TraingCardPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<TraingCardView>::OnStart();\r
+    }\r
+\r
+    void TraingCardPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<TraingCardView>::OnPause();\r
+    }\r
+\r
+    void TraingCardPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<TraingCardView>::OnResume();\r
+    }\r
+\r
+    void TraingCardPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<TraingCardView>::OnStop();\r
+    }\r
+\r
+    bool TraingCardPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL);\r
+        }\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+\r
+    bool TraingCardPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        // if (strcmp(view.GetViewId(), BUTTONSTOP) == 0)\r
+        // {\r
+        //     NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL);\r
+        //     NativeAbility::GetInstance().\r
+        // }\r
+        return true;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingCardView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingCardView.cpp
new file mode 100644 (file)
index 0000000..422454b
--- /dev/null
@@ -0,0 +1,224 @@
+\r
+#include "traing/include/TraingCardView.h"\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
+\r
+#include "common/screen.h"\r
+#include "components/ui_digital_clock.h"\r
+#include "components/ui_label.h"\r
+#include "font/ui_font.h"\r
+namespace OHOS\r
+{\r
+    static const uint16_t LABEL_FONT_SIZE = 200;\r
+    static const uint32_t BACK_GROUND_COLOR = 0xfff6f6f6;\r
+    static const uint32_t CARD_PAGE_COLOR = 0xffd0d0d0;\r
+\r
+    static TraingCardView *g_pTraingCardView{nullptr};\r
+\r
+    TraingCardView::TraingCardView()\r
+    {\r
+        g_pTraingCardView = this;\r
+    }\r
+\r
+    TraingCardView::~TraingCardView()\r
+    {\r
+        DeInit();\r
+        g_pTraingCardView = nullptr;\r
+    }\r
+\r
+    TraingCardView *TraingCardView::GetInstance()\r
+    {\r
+\r
+        return g_pTraingCardView;\r
+    }\r
+    /*\r
+    InitLabel:初始化标签\r
+    @param label 标签指针\r
+    @param left 标签左边位置\r
+    @param top 标签顶部位置\r
+    @param width 标签宽度\r
+    @param height 标签高度\r
+    @param viewId 标签的视图 ID\r
+    @param text 标签显示的文本\r
+    @param fontName 字体名称\r
+    @param fontSize 字体大小\r
+    */\r
+    void TraingCardView::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)\r
+    {\r
+        // 检查标签指针是否为空\r
+        if (label == nullptr)\r
+        {\r
+            label = new UILabel();\r
+        }\r
+        // 设置标签的位置和大小\r
+        label->SetPosition(left, top);\r
+        label->Resize(width, height);\r
+        // 设置标签的视图 ID\r
+        label->SetViewId(viewId);\r
+        // 设置标签的样式\r
+        label->SetStyle(STYLE_TEXT_FONT, fontSize);\r
+        label->SetFont(fontName, fontSize);\r
+        // 设置标签的文本和其他属性\r
+        label->SetText(text);\r
+        label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x43, 0xff));\r
+        label->SetRollSpeed(0);\r
+        // 设置标签可见\r
+        label->SetVisible(true);\r
+    }\r
+    /*\r
+    InitButton:初始化按钮\r
+    @param button 按钮指针\r
+    @param left 按钮左边位置\r
+    @param top 按钮顶部位置\r
+    @param width 按钮宽度\r
+    @param height 按钮高度\r
+    @param viewId 按钮的视图 ID\r
+    */\r
+    void TraingCardView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)\r
+    {\r
+        // 设置按钮的背景颜色\r
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色\r
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色\r
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色\r
+        // 创建新按钮(如果当前按钮为空)\r
+        if (button == nullptr)\r
+        {\r
+            button = new UIButton();\r
+        }\r
+        button->SetPosition(left, top);\r
+        button->Resize(width, height);\r
+        button->SetViewId(viewId);\r
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);\r
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);\r
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);\r
+        // 设置按钮的点击事件监听器为 TraingCardPresenter 的实例\r
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingCardPresenter::GetInstance()));\r
+        // 设置按钮可见\r
+        button->SetVisible(true);\r
+    }\r
+    /*\r
+   InitImageView:初始化图片\r
+   @param imageView 图片指针\r
+   @param left 图片左边位置\r
+   @param top 图片顶部位置\r
+   @param width 图片宽度\r
+   @param height 图片高度\r
+   @param viewId 图片的视图 ID\r
+   @param imagePath 图片路径\r
+   */\r
+    void TraingCardView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)\r
+    {\r
+        if (imageView == nullptr)\r
+        {\r
+            imageView = new UIImageView();\r
+        }\r
+        imageView->SetPosition(left, top);\r
+        imageView->Resize(width, height);\r
+        imageView->SetViewId(viewId);\r
+        imageView->SetSrc(imagePath);\r
+        imageView->SetVisible(true);\r
+    }\r
+\r
+    /* InitView:初始化界面*/\r
+    void TraingCardView ::InitView()\r
+    {\r
+        if (swipe_ == nullptr)\r
+        {\r
+            swipe_ = new UISwipeView(UISwipeView::HORIZONTAL);\r
+            swipe_->SetPosition(0, 0, 466, 466);\r
+            swipe_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+        }\r
+\r
+        // 初始化Lable\r
+        InitLabel(label1_, 0, 55, 466, 466, "label1", "训练", DEFAULT_VECTOR_FONT_FILENAME, 200);\r
+        InitLabel(label2_, 0, 55, 466, 466, "label2", "暂停", DEFAULT_VECTOR_FONT_FILENAME, 200);\r
+        InitLabel(label3_, 0, 55, 466, 466, "label3", "结束", DEFAULT_VECTOR_FONT_FILENAME, 200);\r
+\r
+        swipe_->Add(label1_);\r
+        swipe_->Add(label2_);\r
+        swipe_->Add(label3_);\r
+    }\r
+\r
+    /* DeInit:删除组件 */\r
+    void TraingCardView::DeInit()\r
+    {\r
+        UIView *view = static_cast<UISwipeView *>(swipe_)->GetChildrenHead();\r
+        while (view != nullptr)\r
+        {\r
+            UIView *tempView = view;\r
+            view = view->GetNextSibling();\r
+            if (tempView->GetParent())\r
+            {\r
+                static_cast<UISwipeView *>(tempView->GetParent())->Remove(tempView);\r
+            }\r
+            delete tempView;\r
+        }\r
+        delete swipe_;\r
+        swipe_ = nullptr;\r
+    }\r
+\r
+    void TraingCardView::PreLoad(void)\r
+    {\r
+        if (!viewiInitStatus)\r
+        {\r
+            InitView();\r
+            viewiInitStatus = true;\r
+        }\r
+    }\r
+    void TraingCardView::OnStart()\r
+    {\r
+        swipe_ = new UISwipeView(UISwipeView::HORIZONTAL);\r
+        if (swipe_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        swipe_->SetPosition(0, 0);\r
+        swipe_->SetWidth(Screen::GetInstance().GetWidth());\r
+        swipe_->SetHeight(Screen::GetInstance().GetHeight());\r
+\r
+        // 创建 draglistener 实例并设置为拖动监听器\r
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingCardPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        swipe_->SetOnDragListener(draglistener);\r
+\r
+        swipe_->SetTouchable(true);\r
+        swipe_->SetDraggable(true);\r
+        swipe_->SetStyle(STYLE_BACKGROUND_COLOR, BACK_GROUND_COLOR);\r
+        swipe_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);\r
+        swipe_->SetBlankSize(0);\r
+        swipe_->SetReboundSize(200); // 200: rebound size\r
+        swipe_->SetElastic(true);\r
+\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(swipe_);\r
+    }\r
+\r
+    void TraingCardView::OnSetUpView()\r
+    {\r
+\r
+        View<TraingCardPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void TraingCardView::OnTearDownView()\r
+    {\r
+        View<TraingCardPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void TraingCardView::OnStop()\r
+    {\r
+        View<TraingCardPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingControlPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingControlPresenter.cpp
new file mode 100644 (file)
index 0000000..f6e3394
--- /dev/null
@@ -0,0 +1,91 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include <iostream>\r
+#include <chrono>\r
+#include <thread>\r
+#include "traing/include/TraingControlPresenter.h"\r
+// #include "TraingControlView.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static TraingControlPresenter *g_pTraingControlPresenter = nullptr;\r
+\r
+    TraingControlPresenter::TraingControlPresenter()\r
+    {\r
+\r
+        g_pTraingControlPresenter = this;\r
+    }\r
+\r
+    TraingControlPresenter::~TraingControlPresenter()\r
+    {\r
+\r
+        g_pTraingControlPresenter = nullptr;\r
+    }\r
+\r
+    TraingControlPresenter *TraingControlPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pTraingControlPresenter;\r
+    }\r
+\r
+    void TraingControlPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<TraingControlView>::OnStart();\r
+    }\r
+\r
+    void TraingControlPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<TraingControlView>::OnPause();\r
+    }\r
+\r
+    void TraingControlPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<TraingControlView>::OnResume();\r
+    }\r
+\r
+    void TraingControlPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<TraingControlView>::OnStop();\r
+    }\r
+\r
+    bool TraingControlPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA);\r
+        }\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+\r
+    bool TraingControlPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (strcmp(view.GetViewId(), BUTTONSTOP) == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDNOTE);\r
+        }\r
+\r
+        printf("********* test:%s\n", test.c_str());\r
+        if (strcmp(view.GetViewId(), BUTTONPAUSE) == 0)\r
+        {\r
+            // 改变lable文字,button背景图片\r
+            // test如果等于继续那就变为暂停,反之;\r
+            test == "继续" ? test = "暂停" : test = "继续";\r
+            TraingControlView::GetInstance()->SetLabel();\r
+            TraingControlView::GetInstance()->SetButton();\r
+        }\r
+        printf("********* test:%s\n", test.c_str());\r
+        // TraingControlView::GetInstance()->InitView();\r
+\r
+        return true;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingControlView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingControlView.cpp
new file mode 100644 (file)
index 0000000..70123e6
--- /dev/null
@@ -0,0 +1,301 @@
+\r
+#include "traing/include/TraingControlView.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
+    static const char *imagePath_point = "/user/res/Training/control_point.bin";\r
+\r
+    static TraingControlView *g_pTraingControlView{nullptr};\r
+\r
+    TraingControlView::TraingControlView()\r
+    {\r
+        g_pTraingControlView = this;\r
+    }\r
+\r
+    TraingControlView::~TraingControlView()\r
+    {\r
+        DeInit();\r
+        g_pTraingControlView = nullptr;\r
+    }\r
+\r
+    TraingControlView *TraingControlView::GetInstance()\r
+    {\r
+\r
+        return g_pTraingControlView;\r
+    }\r
+    /*\r
+    InitLabel:初始化标签\r
+    @param label 标签指针\r
+    @param left 标签左边位置\r
+    @param top 标签顶部位置\r
+    @param width 标签宽度\r
+    @param height 标签高度\r
+    @param viewId 标签的视图 ID\r
+    @param text 标签显示的文本\r
+    @param fontName 字体名称\r
+    @param fontSize 字体大小\r
+    */\r
+    void TraingControlView::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)\r
+    {\r
+        // 检查标签指针是否为空\r
+        if (label == nullptr)\r
+        {\r
+            label = new UILabel();\r
+        }\r
+        // 设置标签的位置和大小\r
+        label->SetPosition(left, top);\r
+        label->Resize(width, height);\r
+        // 设置标签的视图 ID\r
+        label->SetViewId(viewId);\r
+        // 设置标签的样式\r
+        label->SetStyle(STYLE_TEXT_FONT, fontSize);\r
+        label->SetFont(fontName, fontSize);\r
+        // 设置标签的文本和其他属性\r
+        label->SetText(text);\r
+        label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label->SetRollSpeed(0);\r
+        // 设置标签可见\r
+        label->SetVisible(true);\r
+    }\r
+    /*\r
+    InitButton:初始化按钮\r
+    @param button 按钮指针\r
+    @param left 按钮左边位置\r
+    @param top 按钮顶部位置\r
+    @param width 按钮宽度\r
+    @param height 按钮高度\r
+    @param viewId 按钮的视图 ID\r
+    */\r
+    void TraingControlView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)\r
+    {\r
+        // 设置按钮的背景颜色\r
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色\r
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色\r
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色\r
+        // 创建新按钮(如果当前按钮为空)\r
+        if (button == nullptr)\r
+        {\r
+            button = new UIButton();\r
+        }\r
+        button->SetPosition(left, top);\r
+        button->Resize(width, height);\r
+        button->SetViewId(viewId);\r
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);\r
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);\r
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);\r
+        // 设置按钮的点击事件监听器为 TraingControlPresenter 的实例\r
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingControlPresenter::GetInstance()));\r
+        // 设置按钮可见\r
+        button->SetVisible(true);\r
+    }\r
+    /*\r
+   InitImageView:初始化图片\r
+   @param imageView 图片指针\r
+   @param left 图片左边位置\r
+   @param top 图片顶部位置\r
+   @param width 图片宽度\r
+   @param height 图片高度\r
+   @param viewId 图片的视图 ID\r
+   @param imagePath 图片路径\r
+   */\r
+    void TraingControlView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)\r
+    {\r
+        if (imageView == nullptr)\r
+        {\r
+            imageView = new UIImageView();\r
+        }\r
+        imageView->SetPosition(left, top);\r
+        imageView->Resize(width, height);\r
+        imageView->SetViewId(viewId);\r
+        imageView->SetSrc(imagePath);\r
+        imageView->SetVisible(true);\r
+    }\r
+    /* InitView:初始化界面*/\r
+    void TraingControlView ::InitView()\r
+    {\r
+        if (container_ == nullptr)\r
+        {\r
+            container_ = new UIViewGroup();\r
+            container_->SetPosition(0, 0, 466, 466);\r
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+        }\r
+\r
+        //  初始化Button\r
+        InitButton(button1_, 100, 202, 100, 100, BUTTONSTOP);\r
+        // Set additional property\r
+        char *button1defaultImgSrc = BUTTON_STOP_IMG_SRC;\r
+        char *button1triggeredImgSrc = nullptr;\r
+        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
+        container_->Add(button1_);\r
+\r
+        InitButton(button2_, 255, 202, 100, 100, BUTTONPAUSE);\r
+        // Set additional property\r
+        char *button2defaultImgSrc = BUTTON_PAUSE_IMG_SRC;\r
+        char *button2triggeredImgSrc = nullptr;\r
+        button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);\r
+        container_->Add(button2_);\r
+\r
+        // 初始化Lable\r
+        InitLabel(label1_, 188, 52, 90, 35, "label1", "训练中", DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+        InitLabel(label2_, 98, 110, 60, 35, "label2", "00:00:00", DEFAULT_VECTOR_FONT_FILENAME, 65);\r
+        InitLabel(label3_, 125, 324, 60, 40, "label3", "结束", DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+        InitLabel(label4_, 280, 324, 60, 40, "label4", "暂停", DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+        container_->Add(label1_);\r
+        container_->Add(label2_);\r
+        container_->Add(label3_);\r
+        container_->Add(label4_);\r
+\r
+        // 初始化Image\r
+        InitImageView(image1_, 193, 421, 80, 20, "image1", imagePath_point);\r
+        container_->Add(image1_);\r
+    }\r
+\r
+    /******************************************************************************************************/\r
+    void TraingControlView::SetLabel()\r
+    {\r
+        if (TraingControlPresenter::GetInstance()->test == "继续")\r
+        {\r
+            label4_->SetText("继续");\r
+        }\r
+        else\r
+        {\r
+            label4_->SetText("暂停");\r
+        }\r
+    }\r
+\r
+    void TraingControlView::SetButton()\r
+    {\r
+        if (TraingControlPresenter::GetInstance()->test == "继续")\r
+        {\r
+            //button2_->SetViewId(BUTTONCONTINUE);\r
+            button2_->SetImageSrc(BUTTON_CONTINUE_IMG_SRC, nullptr);\r
+        }\r
+        if (TraingControlPresenter::GetInstance()->test == "暂停")\r
+        {\r
+            //button2_->SetViewId(BUTTONPAUSE);\r
+            button2_->SetImageSrc(BUTTON_PAUSE_IMG_SRC, nullptr);\r
+        }\r
+    }\r
+    /******************************************************************************************************/\r
+\r
+    /* DeInit:删除组件 */\r
+    void TraingControlView::DeInit()\r
+    {\r
+        // 删除Label\r
+        if (label1_ != nullptr)\r
+        {\r
+            container_->Remove(label1_);\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (label2_ != nullptr)\r
+        {\r
+            container_->Remove(label2_);\r
+            delete label2_;\r
+            label2_ = nullptr;\r
+        }\r
+        if (label3_ != nullptr)\r
+        {\r
+            container_->Remove(label3_);\r
+            delete label3_;\r
+            label3_ = nullptr;\r
+        }\r
+        if (label4_ != nullptr)\r
+        {\r
+            container_->Remove(label4_);\r
+            delete label4_;\r
+            label4_ = nullptr;\r
+        }\r
+\r
+        // 删除Button\r
+        if (button1_ != nullptr)\r
+        {\r
+            container_->Remove(button1_);\r
+            delete button1_;\r
+            button1_ = nullptr;\r
+        }\r
+        if (button2_ != nullptr)\r
+        {\r
+            container_->Remove(button2_);\r
+            delete button2_;\r
+            button2_ = nullptr;\r
+        }\r
+\r
+        // 删除Image\r
+        if (image1_ != nullptr)\r
+        {\r
+            container_->Remove(image1_);\r
+            delete image1_;\r
+            image1_ = nullptr;\r
+        }\r
+\r
+        // 删除容器\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll(); // 移除容器中的所有组件\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+\r
+    void TraingControlView::PreLoad(void)\r
+    {\r
+        if (!viewiInitStatus)\r
+        {\r
+            InitView();\r
+            viewiInitStatus = true;\r
+        }\r
+    }\r
+    void TraingControlView::OnStart()\r
+    {\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetPosition(0, 0);\r
+        container_->SetWidth(Screen::GetInstance().GetWidth());\r
+        container_->SetHeight(Screen::GetInstance().GetHeight());\r
+\r
+        // 创建 draglistener 实例并设置为拖动监听器\r
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingControlPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetOnDragListener(draglistener);\r
+\r
+        container_->SetTouchable(true);\r
+        container_->SetDraggable(true);\r
+\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void TraingControlView::OnSetUpView()\r
+    {\r
+\r
+        View<TraingControlPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void TraingControlView::OnTearDownView()\r
+    {\r
+\r
+        View<TraingControlPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void TraingControlView::OnStop()\r
+    {\r
+        View<TraingControlPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDataPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDataPresenter.cpp
new file mode 100644 (file)
index 0000000..3e72cdd
--- /dev/null
@@ -0,0 +1,83 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include <iostream>\r
+#include <chrono>\r
+#include <thread>\r
+#include "traing/include/TraingDataPresenter.h"\r
+// #include "TraingDataView.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static TraingDataPresenter *g_pTraingDataPresenter = nullptr;\r
+\r
+    TraingDataPresenter::TraingDataPresenter()\r
+    {\r
+\r
+        g_pTraingDataPresenter = this;\r
+    }\r
+\r
+    TraingDataPresenter::~TraingDataPresenter()\r
+    {\r
+\r
+        g_pTraingDataPresenter = nullptr;\r
+    }\r
+\r
+    TraingDataPresenter *TraingDataPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pTraingDataPresenter;\r
+    }\r
+\r
+    void TraingDataPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<TraingDataView>::OnStart();\r
+    }\r
+\r
+    void TraingDataPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<TraingDataView>::OnPause();\r
+    }\r
+\r
+    void TraingDataPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<TraingDataView>::OnResume();\r
+    }\r
+\r
+    void TraingDataPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<TraingDataView>::OnStop();\r
+    }\r
+\r
+    bool TraingDataPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL);\r
+        }\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDETAIL);\r
+        }\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+\r
+    bool TraingDataPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (strcmp(view.GetViewId(), BUTTONNOTE) == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGNOMAL);\r
+        }\r
+        return true;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDataView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDataView.cpp
new file mode 100644 (file)
index 0000000..8a184e7
--- /dev/null
@@ -0,0 +1,237 @@
+\r
+#include "traing/include/TraingDataView.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
+    static const char *imagePath_point = "/user/res/Training/data_point.bin";\r
+    static const char *imagePath_progress = "/user/res/Training/progress.bin";\r
+    static const char *imagePath_incoup = "/user/res/Training/inco_up.bin";\r
+    static const char *imagePath_arrows = "/user/res/Training/arrows.bin";\r
+    static const char *imagePath_strength = "/user/res/Training/sport-strength.bin";\r
+    static const char *imagePath_note = "/user/res/Training/note.bin";\r
+\r
+    static TraingDataView *g_pTraingDataView{nullptr};\r
+\r
+    TraingDataView::TraingDataView()\r
+    {\r
+        g_pTraingDataView = this;\r
+    }\r
+\r
+    TraingDataView::~TraingDataView()\r
+    {\r
+        DeInit();\r
+        g_pTraingDataView = nullptr;\r
+    }\r
+\r
+    TraingDataView *TraingDataView::GetInstance()\r
+    {\r
+\r
+        return g_pTraingDataView;\r
+    }\r
+    /*\r
+    InitLabel:初始化标签\r
+    @param label 标签指针\r
+    @param left 标签左边位置\r
+    @param top 标签顶部位置\r
+    @param width 标签宽度\r
+    @param height 标签高度\r
+    @param viewId 标签的视图 ID\r
+    @param text 标签显示的文本\r
+    @param fontName 字体名称\r
+    @param fontSize 字体大小\r
+    */\r
+    void TraingDataView::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)\r
+    {\r
+        // 检查标签指针是否为空\r
+        if (label == nullptr)\r
+        {\r
+            label = new UILabel();\r
+        }\r
+        // 设置标签的位置和大小\r
+        label->SetPosition(left, top);\r
+        label->Resize(width, height);\r
+        // 设置标签的视图 ID\r
+        label->SetViewId(viewId);\r
+        // 设置标签的样式\r
+        label->SetStyle(STYLE_TEXT_FONT, fontSize);\r
+        label->SetFont(fontName, fontSize);\r
+        // 设置标签的文本和其他属性\r
+        label->SetText(text);\r
+        label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label->SetRollSpeed(0);\r
+        // 设置标签可见\r
+        label->SetVisible(true);\r
+    }\r
+    /*\r
+    InitButton:初始化按钮\r
+    @param button 按钮指针\r
+    @param left 按钮左边位置\r
+    @param top 按钮顶部位置\r
+    @param width 按钮宽度\r
+    @param height 按钮高度\r
+    @param viewId 按钮的视图 ID\r
+    */\r
+    void TraingDataView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)\r
+    {\r
+        // 设置按钮的背景颜色\r
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色\r
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色\r
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色\r
+        // 创建新按钮(如果当前按钮为空)\r
+        if (button == nullptr)\r
+        {\r
+            button = new UIButton();\r
+        }\r
+        button->SetPosition(left, top);\r
+        button->Resize(width, height);\r
+        button->SetViewId(viewId);\r
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);\r
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);\r
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);\r
+        // 设置按钮的点击事件监听器为 TraingDataPresenter 的实例\r
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingDataPresenter::GetInstance()));\r
+        // 设置按钮可见\r
+        button->SetVisible(true);\r
+    }\r
+    /*\r
+   InitImageView:初始化图片\r
+   @param imageView 图片指针\r
+   @param left 图片左边位置\r
+   @param top 图片顶部位置\r
+   @param width 图片宽度\r
+   @param height 图片高度\r
+   @param viewId 图片的视图 ID\r
+   @param imagePath 图片路径\r
+   */\r
+    void TraingDataView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)\r
+    {\r
+        if (imageView == nullptr)\r
+        {\r
+            imageView = new UIImageView();\r
+        }\r
+        imageView->SetPosition(left, top);\r
+        imageView->Resize(width, height);\r
+        imageView->SetViewId(viewId);\r
+        imageView->SetSrc(imagePath);\r
+        imageView->SetVisible(true);\r
+    }\r
+    /* InitView:初始化界面*/\r
+    void TraingDataView ::InitView()\r
+    {\r
+        if (container_ == nullptr)\r
+        {\r
+            container_ = new UIViewGroup();\r
+            container_->SetPosition(0, 0, 466, 466);\r
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+        }\r
+\r
+        // 初始化Image\r
+        InitImageView(image1_, 13, 13, 440, 386, "image1", imagePath_progress);\r
+        InitImageView(image2_, 208, 297, 20, 20, "image2", imagePath_arrows);\r
+        InitImageView(image3_, 98, 314, 270, 20, "image3", imagePath_strength);\r
+        InitImageView(image4_, 225, 396, 16, 10, "image4", imagePath_incoup);\r
+        InitImageView(image5_, 193, 421, 80, 20, "image5", imagePath_point);\r
+        container_->Add(image1_);\r
+        container_->Add(image2_);\r
+        container_->Add(image3_);\r
+        container_->Add(image4_);\r
+        container_->Add(image5_);\r
+        // 初始化Lable\r
+        InitLabel(label1_, 185, 60, 90, 35, "label1", "23:54", DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+        InitLabel(label2_, 158, 120, 150, 35, "label2", "跳绳运动中", DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+        InitLabel(label3_, 90, 175, 60, 40, "label3", "00:31:26", DEFAULT_VECTOR_FONT_FILENAME, 80);\r
+        InitLabel(label4_, 150, 276, 60, 40, "label4", "144", DEFAULT_VECTOR_FONT_FILENAME, 23);\r
+        InitLabel(label5_, 167, 350, 60, 40, "label4", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        container_->Add(label1_);\r
+        container_->Add(label2_);\r
+        container_->Add(label3_);\r
+        container_->Add(label4_);\r
+        container_->Add(label5_);\r
+        //  初始化Button\r
+        InitButton(button1_, 275, 350, 26, 26, BUTTONNOTE);\r
+        // Set additional property\r
+        static const char *button1defaultImgSrc = imagePath_note;\r
+        char *button1triggeredImgSrc = nullptr;\r
+        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
+        container_->Add(button1_);\r
+    }\r
+\r
+    /* DeInit:删除组件 */\r
+    void TraingDataView::DeInit()\r
+    {\r
+        UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();\r
+        while (view != nullptr)\r
+        {\r
+            UIView *tempView = view;\r
+            view = view->GetNextSibling();\r
+            if (tempView->GetParent())\r
+            {\r
+                static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);\r
+            }\r
+            delete tempView;\r
+        }\r
+        delete container_;\r
+        container_ = nullptr;\r
+    }\r
+\r
+    void TraingDataView::PreLoad(void)\r
+    {\r
+        if (!viewiInitStatus)\r
+        {\r
+            InitView();\r
+            viewiInitStatus = true;\r
+        }\r
+    }\r
+    void TraingDataView::OnStart()\r
+    {\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetPosition(0, 0);\r
+        container_->SetWidth(Screen::GetInstance().GetWidth());\r
+        container_->SetHeight(Screen::GetInstance().GetHeight());\r
+\r
+        // 创建 draglistener 实例并设置为拖动监听器\r
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingDataPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetOnDragListener(draglistener);\r
+\r
+        container_->SetTouchable(true);\r
+        container_->SetDraggable(true);\r
+\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void TraingDataView::OnSetUpView()\r
+    {\r
+\r
+        View<TraingDataPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void TraingDataView::OnTearDownView()\r
+    {\r
+\r
+        View<TraingDataPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void TraingDataView::OnStop()\r
+    {\r
+        View<TraingDataPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDetailPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDetailPresenter.cpp
new file mode 100644 (file)
index 0000000..f473ff1
--- /dev/null
@@ -0,0 +1,74 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include <iostream>\r
+#include <chrono>\r
+#include <thread>\r
+#include "traing/include/TraingDetailPresenter.h"\r
+// #include "TraingDetailView.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static TraingDetailPresenter *g_pTraingDetailPresenter = nullptr;\r
+\r
+    TraingDetailPresenter::TraingDetailPresenter()\r
+    {\r
+\r
+        g_pTraingDetailPresenter = this;\r
+    }\r
+\r
+    TraingDetailPresenter::~TraingDetailPresenter()\r
+    {\r
+\r
+        g_pTraingDetailPresenter = nullptr;\r
+    }\r
+\r
+    TraingDetailPresenter *TraingDetailPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pTraingDetailPresenter;\r
+    }\r
+\r
+    void TraingDetailPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<TraingDetailView>::OnStart();\r
+    }\r
+\r
+    void TraingDetailPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<TraingDetailView>::OnPause();\r
+    }\r
+\r
+    void TraingDetailPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<TraingDetailView>::OnResume();\r
+    }\r
+\r
+    void TraingDetailPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<TraingDetailView>::OnStop();\r
+    }\r
+\r
+    bool TraingDetailPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA);\r
+        }\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+\r
+    bool TraingDetailPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        return true;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDetailView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingDetailView.cpp
new file mode 100644 (file)
index 0000000..2f08671
--- /dev/null
@@ -0,0 +1,240 @@
+\r
+#include "traing/include/TraingDetailView.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
+    static const char *imagePath_heartrate = "/user/res/Training/heartrat_30.bin";\r
+    static const char *imagePath_mileage = "/user/res/Training/mileage_30.bin";\r
+    static const char *imagePath_step = "/user/res/Training/step_30.bin";\r
+    static const char *imagePath_calories = "/user/res/Training/calories_30.bin";\r
+    static const char *imagePath_line1 = "/user/res/Training/Line 1.bin";\r
+    static const char *imagePath_line2 = "/user/res/Training/Line 2.bin";\r
+\r
+    static TraingDetailView *g_pTraingDetailView{nullptr};\r
+\r
+    TraingDetailView::TraingDetailView()\r
+    {\r
+        g_pTraingDetailView = this;\r
+    }\r
+\r
+    TraingDetailView::~TraingDetailView()\r
+    {\r
+        DeInit();\r
+        g_pTraingDetailView = nullptr;\r
+    }\r
+\r
+    TraingDetailView *TraingDetailView::GetInstance()\r
+    {\r
+\r
+        return g_pTraingDetailView;\r
+    }\r
+    /*\r
+    InitLabel:初始化标签\r
+    @param label 标签指针\r
+    @param left 标签左边位置\r
+    @param top 标签顶部位置\r
+    @param width 标签宽度\r
+    @param height 标签高度\r
+    @param viewId 标签的视图 ID\r
+    @param text 标签显示的文本\r
+    @param fontName 字体名称\r
+    @param fontSize 字体大小\r
+    */\r
+    void TraingDetailView::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)\r
+    {\r
+        // 检查标签指针是否为空\r
+        if (label == nullptr)\r
+        {\r
+            label = new UILabel();\r
+        }\r
+        // 设置标签的位置和大小\r
+        label->SetPosition(left, top);\r
+        label->Resize(width, height);\r
+        // 设置标签的视图 ID\r
+        label->SetViewId(viewId);\r
+        // 设置标签的样式\r
+        label->SetStyle(STYLE_TEXT_FONT, fontSize);\r
+        label->SetFont(fontName, fontSize);\r
+        // 设置标签的文本和其他属性\r
+        label->SetText(text);\r
+        label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label->SetRollSpeed(0);\r
+        // 设置标签可见\r
+        label->SetVisible(true);\r
+    }\r
+    /*\r
+    InitButton:初始化按钮\r
+    @param button 按钮指针\r
+    @param left 按钮左边位置\r
+    @param top 按钮顶部位置\r
+    @param width 按钮宽度\r
+    @param height 按钮高度\r
+    @param viewId 按钮的视图 ID\r
+    */\r
+    void TraingDetailView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)\r
+    {\r
+        // 设置按钮的背景颜色\r
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色\r
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色\r
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色\r
+        // 创建新按钮(如果当前按钮为空)\r
+        if (button == nullptr)\r
+        {\r
+            button = new UIButton();\r
+        }\r
+        button->SetPosition(left, top);\r
+        button->Resize(width, height);\r
+        button->SetViewId(viewId);\r
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);\r
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);\r
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);\r
+        // 设置按钮的点击事件监听器为 TraingDetailPresenter 的实例\r
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingDetailPresenter::GetInstance()));\r
+        // 设置按钮可见\r
+        button->SetVisible(true);\r
+    }\r
+    /*\r
+   InitImageView:初始化图片\r
+   @param imageView 图片指针\r
+   @param left 图片左边位置\r
+   @param top 图片顶部位置\r
+   @param width 图片宽度\r
+   @param height 图片高度\r
+   @param viewId 图片的视图 ID\r
+   @param imagePath 图片路径\r
+   */\r
+    void TraingDetailView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)\r
+    {\r
+        if (imageView == nullptr)\r
+        {\r
+            imageView = new UIImageView();\r
+        }\r
+        imageView->SetPosition(left, top);\r
+        imageView->Resize(width, height);\r
+        imageView->SetViewId(viewId);\r
+        imageView->SetSrc(imagePath);\r
+        imageView->SetVisible(true);\r
+    }\r
+    /* InitView:初始化界面*/\r
+    void TraingDetailView ::InitView()\r
+    {\r
+        if (container_ == nullptr)\r
+        {\r
+            container_ = new UIViewGroup();\r
+            container_->SetPosition(0, 0, 466, 466);\r
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+        }\r
+\r
+        // 初始化Image\r
+        InitImageView(image1_, 134, 58, 30, 30, "image1", imagePath_heartrate);\r
+        InitImageView(image2_, 44, 189, 30, 30, "image2", imagePath_mileage);\r
+        InitImageView(image3_, 297, 189, 30, 30, "image3", imagePath_step);\r
+        InitImageView(image4_, 129, 335, 30, 30, "image4", imagePath_calories);\r
+        InitImageView(image5_, 0, 160, 10, 466, "image5", imagePath_line1);\r
+        InitImageView(image6_, 233, 193, 80, 20, "image5", imagePath_line2);\r
+        InitImageView(image7_, 0, 306, 10, 466, "image5", imagePath_line1);\r
+        container_->Add(image1_);\r
+        container_->Add(image2_);\r
+        container_->Add(image3_);\r
+        container_->Add(image4_);\r
+        container_->Add(image5_);\r
+        container_->Add(image6_);\r
+        container_->Add(image7_);\r
+        // 初始化Lable\r
+        InitLabel(label1_, 174, 60, 90, 35, "label1", "心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        InitLabel(label2_, 80, 190, 60, 40, "label2", "距离(公里)", DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        InitLabel(label3_, 332, 189, 60, 40, "label3", "步数", DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        InitLabel(label4_, 167, 336, 60, 40, "label4", "卡路里(千卡)", DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        InitLabel(label5_, 202, 94, 60, 40, "label5", "144", DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+        InitLabel(label6_, 76, 233, 60, 40, "label6", "13.21", DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+        InitLabel(label7_, 300, 233, 60, 40, "label7", "28312", DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+        InitLabel(label8_, 175, 376, 60, 40, "label8", "210.03", DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+        container_->Add(label1_);\r
+        container_->Add(label2_);\r
+        container_->Add(label3_);\r
+        container_->Add(label4_);\r
+        container_->Add(label5_);\r
+        container_->Add(label6_);\r
+        container_->Add(label7_);\r
+        container_->Add(label8_);\r
+    }\r
+\r
+    /* DeInit:删除组件 */\r
+    void TraingDetailView::DeInit()\r
+    {\r
+        UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();\r
+        while (view != nullptr)\r
+        {\r
+            UIView *tempView = view;\r
+            view = view->GetNextSibling();\r
+            if (tempView->GetParent())\r
+            {\r
+                static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);\r
+            }\r
+            delete tempView;\r
+        }\r
+        delete container_;\r
+        container_ = nullptr;\r
+    }\r
+\r
+    void TraingDetailView::PreLoad(void)\r
+    {\r
+        if (!viewiInitStatus)\r
+        {\r
+            InitView();\r
+            viewiInitStatus = true;\r
+        }\r
+    }\r
+    void TraingDetailView::OnStart()\r
+    {\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetPosition(0, 0);\r
+        container_->SetWidth(Screen::GetInstance().GetWidth());\r
+        container_->SetHeight(Screen::GetInstance().GetHeight());\r
+\r
+        // 创建 draglistener 实例并设置为拖动监听器\r
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingDetailPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetOnDragListener(draglistener);\r
+\r
+        container_->SetTouchable(true);\r
+        container_->SetDraggable(true);\r
+\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void TraingDetailView::OnSetUpView()\r
+    {\r
+\r
+        View<TraingDetailPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void TraingDetailView::OnTearDownView()\r
+    {\r
+\r
+        View<TraingDetailPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void TraingDetailView::OnStop()\r
+    {\r
+        View<TraingDetailPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEnddataPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEnddataPresenter.cpp
new file mode 100644 (file)
index 0000000..e1fd4f5
--- /dev/null
@@ -0,0 +1,79 @@
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingEnddataPresenter.h"
+// #include "TraingEnddataView.h"
+
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static TraingEnddataPresenter *g_pTraingEnddataPresenter = nullptr;
+
+    TraingEnddataPresenter::TraingEnddataPresenter()
+    {
+
+        g_pTraingEnddataPresenter = this;
+    }
+
+    TraingEnddataPresenter::~TraingEnddataPresenter()
+    {
+
+        g_pTraingEnddataPresenter = nullptr;
+    }
+
+    TraingEnddataPresenter *TraingEnddataPresenter::GetInstance()
+    {
+
+        return g_pTraingEnddataPresenter;
+    }
+
+    void TraingEnddataPresenter::OnStart()
+    {
+
+        Presenter<TraingEnddataView>::OnStart();
+    }
+
+    void TraingEnddataPresenter::OnPause(void)
+    {
+
+        Presenter<TraingEnddataView>::OnPause();
+    }
+
+    void TraingEnddataPresenter::OnResume(void)
+    {
+
+        Presenter<TraingEnddataView>::OnResume();
+    }
+
+    void TraingEnddataPresenter::OnStop(void)
+    {
+
+        Presenter<TraingEnddataView>::OnStop();
+    }
+
+    bool TraingEnddataPresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+
+        // if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM)
+        // {
+        //     NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA);
+        // }
+        UNUSED(view);
+        return true;
+    }
+
+    bool TraingEnddataPresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+
+        // 根据控件id查找是哪个控件触发了点击回调
+        if (strcmp(view.GetViewId(), BUTTONBACK) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
+        }
+        return true;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEnddataView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEnddataView.cpp
new file mode 100644 (file)
index 0000000..db4f865
--- /dev/null
@@ -0,0 +1,319 @@
+
+#include "traing/include/TraingEnddataView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+    static const char *imagePath_path = "/user/res/Training/path.bin";
+    static const char *imagePath_bubble = "/user/res/Training/bubble.bin";
+    static const char *imagePath_bubblepiont = "/user/res/Training/bubble_piont.bin";
+    static const char *imagePath_Line = "/user/res/Training/Line.bin";
+    static const char *imagePath_spot = "/user/res/Training/Walking_54.bin";
+    static const char *imagePath_incoup = "/user/res/Training/inco_up_40.bin";
+
+    static TraingEnddataView *g_pTraingEnddataView{nullptr};
+
+    TraingEnddataView::TraingEnddataView()
+    {
+        g_pTraingEnddataView = this;
+    }
+
+    TraingEnddataView::~TraingEnddataView()
+    {
+        DeInit();
+        g_pTraingEnddataView = nullptr;
+    }
+
+    TraingEnddataView *TraingEnddataView::GetInstance()
+    {
+
+        return g_pTraingEnddataView;
+    }
+
+    /*
+    InitLabel:初始化标签
+    @param label 标签指针
+    @param left 标签左边位置
+    @param top 标签顶部位置
+    @param width 标签宽度
+    @param height 标签高度
+    @param viewId 标签的视图 ID
+    @param text 标签显示的文本
+    @param fontName 字体名称
+    @param fontSize 字体大小
+    */
+    void TraingEnddataView::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();
+        }
+        // 设置标签的位置和大小
+        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);
+        label1_->SetTextColor(Color::GetColorFromRGBA(0x22, 0x9d, 0xd3, 0xff));
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        label->SetRollSpeed(0);
+        // 设置标签可见
+        label->SetVisible(true);
+    }
+    /*
+    InitButton:初始化按钮
+    @param button 按钮指针
+    @param left 按钮左边位置
+    @param top 按钮顶部位置
+    @param width 按钮宽度
+    @param height 按钮高度
+    @param viewId 按钮的视图 ID
+    */
+    void TraingEnddataView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+    {
+        // 设置按钮的背景颜色
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色
+        // 创建新按钮(如果当前按钮为空)
+        if (button == nullptr)
+        {
+            button = new UIButton();
+        }
+        button->SetPosition(left, top);
+        button->Resize(width, height);
+        button->SetViewId(viewId);
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+        // 设置按钮的点击事件监听器为 TraingEnddataPresenter 的实例
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingEnddataPresenter::GetInstance()));
+        // 设置按钮可见
+        button->SetVisible(true);
+    }
+    /*
+   InitImageView:初始化图片
+   @param imageView 图片指针
+   @param left 图片左边位置
+   @param top 图片顶部位置
+   @param width 图片宽度
+   @param height 图片高度
+   @param viewId 图片的视图 ID
+   @param imagePath 图片路径
+   */
+    void TraingEnddataView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+    {
+        if (imageView == nullptr)
+        {
+            imageView = new UIImageView();
+        }
+        imageView->SetPosition(left, top);
+        imageView->Resize(width, height);
+        imageView->SetViewId(viewId);
+        imageView->SetSrc(imagePath);
+        imageView->SetVisible(true);
+    }
+    /* InitView:初始化界面*/
+    void TraingEnddataView ::InitView()
+    {
+        if (container_ == nullptr)
+        {
+            container_ = new UIViewGroup();
+            container_->SetPosition(0, 0, 466, 466);
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+        }
+
+        // Add ScrollView to App
+        if (scrollView1_ == nullptr)
+        {
+            scrollView1_ = new UIScrollView();
+        }
+        scrollView1_->SetPosition(0, 0);        // widget's left position and top position
+        scrollView1_->Resize(466, 466);         // widget's width and height
+        scrollView1_->SetViewId("scrollView1"); // Set style
+        scrollView1_->SetReboundSize(100);
+        scrollView1_->SetScrollBlankSize(35);
+        scrollView1_->SetHorizontalScrollState(false);
+        // Add to rootView
+        container_->Add(scrollView1_);
+        scrollView1_->SetVisible(true);
+
+        // 初始化Image
+        InitImageView(image1_, 200, 131, 80, 48, "image1", imagePath_bubble);
+        InitImageView(image2_, 230, 183, 20, 20, "image2", imagePath_bubblepiont);
+        InitImageView(image3_, 96, 118, 271, 233, "image3", imagePath_path);
+        InitImageView(image4_, 212, 402, 40, 40, "image4", imagePath_incoup);
+        InitImageView(image5_, 80, 470, 54, 80, "image5", imagePath_spot);
+        InitImageView(image6_, 97, 552, 80, 20, "image6", imagePath_Line);
+        InitImageView(image8_, 97, 682, 80, 20, "image6", imagePath_Line);
+        InitImageView(image9_, 97, 812, 80, 20, "image6", imagePath_Line);
+        InitImageView(image10_, 97, 942, 80, 20, "image6", imagePath_Line);
+        InitImageView(image11_, 97, 1072, 80, 20, "image6", imagePath_Line);
+
+        scrollView1_->Add(image3_);
+        scrollView1_->Add(image6_);
+        scrollView1_->Add(image8_);
+        scrollView1_->Add(image9_);
+        scrollView1_->Add(image10_);
+        scrollView1_->Add(image11_);
+        scrollView1_->Add(image1_);
+        scrollView1_->Add(image2_);
+        scrollView1_->Add(image4_);
+        scrollView1_->Add(image5_);
+
+        // 初始化button
+        InitButton(button1_, 42, 1319, 380, 100, BUTTONBACK);
+        scrollView1_->Add(button1_);
+
+        // 初始化Lable
+        InitLabel(label1_, 188, 52, 90, 35, "label1", "健身类", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        InitLabel(label2_, 220, 140, 60, 40, "label2", "达标", DEFAULT_VECTOR_FONT_FILENAME, 20);
+        InitLabel(label3_, 114, 252, 60, 40, "label3", "终", DEFAULT_VECTOR_FONT_FILENAME, 20);
+        InitLabel(label4_, 172, 284, 60, 40, "label4", "起", DEFAULT_VECTOR_FONT_FILENAME, 20);
+        InitLabel(label5_, 155, 372, 60, 40, "label5", "距离:8.3KM", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        InitLabel(label6_, 146, 478, 60, 40, "label6", "健走", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        InitLabel(label7_, 146, 517, 60, 40, "label7", "13:00:22-15:00:12", DEFAULT_VECTOR_FONT_FILENAME, 28);
+
+        InitLabel(label8_, 146, 590, 60, 40, "label8", "目标完成度", DEFAULT_VECTOR_FONT_FILENAME, 26);
+        InitLabel(label9_, 146, 720, 60, 40, "label9", "训练时长", DEFAULT_VECTOR_FONT_FILENAME, 26);
+        InitLabel(label10_, 146, 850, 60, 40, "label10", "距离(米)", DEFAULT_VECTOR_FONT_FILENAME, 26);
+        InitLabel(label11_, 146, 980, 60, 40, "label11", "平均心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 26);
+        InitLabel(label12_, 146, 1110, 60, 40, "label2", "训练强度", DEFAULT_VECTOR_FONT_FILENAME, 26);
+        InitLabel(label18_, 155, 1232, 60, 40, "label8", "更多数据请前往手机\nAPP“小希爱玩”查看", DEFAULT_VECTOR_FONT_FILENAME, 26);
+
+        label7_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+        label8_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+        label9_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+        label10_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+        label11_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+        label12_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+        label18_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
+
+        InitLabel(label13_, 146, 626, 60, 40, "label18", "226%", DEFAULT_VECTOR_FONT_FILENAME, 40);
+        label13_->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+        InitLabel(label14_, 146, 756, 60, 40, "label14", "05:45:46", DEFAULT_VECTOR_FONT_FILENAME, 40);
+        label14_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff));
+        InitLabel(label15_, 146, 886, 60, 40, "label15", "8,301", DEFAULT_VECTOR_FONT_FILENAME, 40);
+        label15_->SetTextColor(Color::GetColorFromRGBA(0x36, 0x4a, 0xff, 0xff));
+        InitLabel(label16_, 146, 1016, 60, 40, "label16", "144", DEFAULT_VECTOR_FONT_FILENAME, 40);
+        label16_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+        InitLabel(label17_, 146, 1146, 60, 40, "label17", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 40);
+        label17_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+        InitLabel(label19_, 201, 1348, 60, 40, "label19", "关闭", DEFAULT_VECTOR_FONT_FILENAME, 31);
+
+        scrollView1_->Add(label1_);
+        scrollView1_->Add(label2_);
+        scrollView1_->Add(label3_);
+        scrollView1_->Add(label4_);
+        scrollView1_->Add(label5_);
+        scrollView1_->Add(label6_);
+        scrollView1_->Add(label7_);
+        scrollView1_->Add(label8_);
+        scrollView1_->Add(label9_);
+        scrollView1_->Add(label10_);
+        scrollView1_->Add(label11_);
+        scrollView1_->Add(label12_);
+        scrollView1_->Add(label13_);
+        scrollView1_->Add(label14_);
+        scrollView1_->Add(label15_);
+        scrollView1_->Add(label16_);
+        scrollView1_->Add(label17_);
+        scrollView1_->Add(label18_);
+        scrollView1_->Add(label19_);
+
+        // Add ImageView to App
+        if (image7_ == nullptr)
+        {
+            image7_ = new UIImageView();
+        }
+        image7_->SetPosition(188, 1460); // widget's left position and top position
+        image7_->Resize(100, 100);       // widget's width and height
+        image7_->SetViewId("image7");    // Set style
+        // Add to rootView
+        scrollView1_->Add(image7_);
+        image7_->SetVisible(true);
+    }
+
+    /* DeInit:删除组件 */
+    void TraingEnddataView::DeInit()
+    {
+        UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+        while (view != nullptr)
+        {
+            UIView *tempView = view;
+            view = view->GetNextSibling();
+            if (tempView->GetParent())
+            {
+                static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+            }
+            delete tempView;
+        }
+        delete container_;
+        container_ = nullptr;
+    }
+
+    void TraingEnddataView::PreLoad(void)
+    {
+        if (!viewiInitStatus)
+        {
+            InitView();
+            viewiInitStatus = true;
+        }
+    }
+    void TraingEnddataView::OnStart()
+    {
+        container_ = new UIViewGroup();
+        if (container_ == nullptr)
+        {
+            return;
+        }
+        container_->SetPosition(0, 0);
+        container_->SetWidth(Screen::GetInstance().GetWidth());
+        container_->SetHeight(Screen::GetInstance().GetHeight());
+
+        // 创建 draglistener 实例并设置为拖动监听器
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingEnddataPresenter::GetInstance());
+        if (draglistener == nullptr)
+        {
+            return;
+        }
+        container_->SetOnDragListener(draglistener);
+
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+
+        PreLoad();
+        RootView::GetInstance()->Add(container_);
+    }
+
+    void TraingEnddataView::OnSetUpView()
+    {
+
+        View<TraingEnddataPresenter>::OnSetUpView();
+        Draw();
+    }
+
+    void TraingEnddataView::OnTearDownView()
+    {
+
+        View<TraingEnddataPresenter>::OnTearDownView();
+        return;
+    }
+
+    void TraingEnddataView::OnStop()
+    {
+        View<TraingEnddataPresenter>::OnStop();
+        RootView::GetInstance()->RemoveAll();
+        return;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEndnotePresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEndnotePresenter.cpp
new file mode 100644 (file)
index 0000000..2c4920b
--- /dev/null
@@ -0,0 +1,83 @@
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingEndnotePresenter.h"
+// #include "TraingEndnoteView.h"
+
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static TraingEndnotePresenter *g_pTraingEndnotePresenter = nullptr;
+
+    TraingEndnotePresenter::TraingEndnotePresenter()
+    {
+
+        g_pTraingEndnotePresenter = this;
+    }
+
+    TraingEndnotePresenter::~TraingEndnotePresenter()
+    {
+
+        g_pTraingEndnotePresenter = nullptr;
+    }
+
+    TraingEndnotePresenter *TraingEndnotePresenter::GetInstance()
+    {
+
+        return g_pTraingEndnotePresenter;
+    }
+
+    void TraingEndnotePresenter::OnStart()
+    {
+
+        Presenter<TraingEndnoteView>::OnStart();
+    }
+
+    void TraingEndnotePresenter::OnPause(void)
+    {
+
+        Presenter<TraingEndnoteView>::OnPause();
+    }
+
+    void TraingEndnotePresenter::OnResume(void)
+    {
+
+        Presenter<TraingEndnoteView>::OnResume();
+    }
+
+    void TraingEndnotePresenter::OnStop(void)
+    {
+
+        Presenter<TraingEndnoteView>::OnStop();
+    }
+
+    bool TraingEndnotePresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+
+        // if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM)
+        // {
+        //     NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA);
+        // }
+        UNUSED(view);
+        return true;
+    }
+
+    bool TraingEndnotePresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+
+        // 根据控件id查找是哪个控件触发了点击回调
+        if (strcmp(view.GetViewId(), BUTTONNO) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL);
+        }
+        if (strcmp(view.GetViewId(), BUTTONYES) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDDATA);
+        }
+        return true;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEndnoteView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEndnoteView.cpp
new file mode 100644 (file)
index 0000000..e2c1d81
--- /dev/null
@@ -0,0 +1,225 @@
+
+#include "traing/include/TraingEndnoteView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+    static const char *imagePath_no = "/user/res/Training/no.bin";
+    static const char *imagePath_yes = "/user/res/Training/yes.bin";
+
+    static TraingEndnoteView *g_pTraingEndnoteView{nullptr};
+
+    TraingEndnoteView::TraingEndnoteView()
+    {
+        g_pTraingEndnoteView = this;
+    }
+
+    TraingEndnoteView::~TraingEndnoteView()
+    {
+        DeInit();
+        g_pTraingEndnoteView = nullptr;
+    }
+
+    TraingEndnoteView *TraingEndnoteView::GetInstance()
+    {
+
+        return g_pTraingEndnoteView;
+    }
+    /*
+    InitLabel:初始化标签
+    @param label 标签指针
+    @param left 标签左边位置
+    @param top 标签顶部位置
+    @param width 标签宽度
+    @param height 标签高度
+    @param viewId 标签的视图 ID
+    @param text 标签显示的文本
+    @param fontName 字体名称
+    @param fontSize 字体大小
+    */
+    void TraingEndnoteView::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();
+        }
+        // 设置标签的位置和大小
+        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);
+    }
+    /*
+    InitButton:初始化按钮
+    @param button 按钮指针
+    @param left 按钮左边位置
+    @param top 按钮顶部位置
+    @param width 按钮宽度
+    @param height 按钮高度
+    @param viewId 按钮的视图 ID
+    */
+    void TraingEndnoteView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+    {
+        // 设置按钮的背景颜色
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色
+        // 创建新按钮(如果当前按钮为空)
+        if (button == nullptr)
+        {
+            button = new UIButton();
+        }
+        button->SetPosition(left, top);
+        button->Resize(width, height);
+        button->SetViewId(viewId);
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+        // 设置按钮的点击事件监听器为 TraingEndnotePresenter 的实例
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingEndnotePresenter::GetInstance()));
+        // 设置按钮可见
+        button->SetVisible(true);
+    }
+    /*
+   InitImageView:初始化图片
+   @param imageView 图片指针
+   @param left 图片左边位置
+   @param top 图片顶部位置
+   @param width 图片宽度
+   @param height 图片高度
+   @param viewId 图片的视图 ID
+   @param imagePath 图片路径
+   */
+    void TraingEndnoteView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+    {
+        if (imageView == nullptr)
+        {
+            imageView = new UIImageView();
+        }
+        imageView->SetPosition(left, top);
+        imageView->Resize(width, height);
+        imageView->SetViewId(viewId);
+        imageView->SetSrc(imagePath);
+        imageView->SetVisible(true);
+    }
+    /* InitView:初始化界面*/
+    void TraingEndnoteView ::InitView()
+    {
+        if (container_ == nullptr)
+        {
+            container_ = new UIViewGroup();
+            container_->SetPosition(0, 0, 466, 466);
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+        }
+
+        // 初始化Lable
+        InitLabel(label1_, 173, 52, 90, 35, "label1", "结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        InitLabel(label2_, 116, 187, 60, 40, "label2", "是否结束本次运动", DEFAULT_VECTOR_FONT_FILENAME, 26);
+
+        container_->Add(label1_);
+        container_->Add(label2_);
+
+        InitButton(button1_, 111, 299, 100, 100, BUTTONNO);
+        // Set additional property
+        const char *button1defaultImgSrc = imagePath_no;
+        char *button1triggeredImgSrc = nullptr;
+        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+
+        InitButton(button2_, 256, 299, 100, 100, BUTTONYES);
+        // Set additional property
+        const char *button2defaultImgSrc = imagePath_yes;
+        char *button2triggeredImgSrc = nullptr;
+        button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);
+
+        container_->Add(button1_);
+        container_->Add(button2_);
+    }
+
+    /* DeInit:删除组件 */
+    void TraingEndnoteView::DeInit()
+    {
+        UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+        while (view != nullptr)
+        {
+            UIView *tempView = view;
+            view = view->GetNextSibling();
+            if (tempView->GetParent())
+            {
+                static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+            }
+            delete tempView;
+        }
+        delete container_;
+        container_ = nullptr;
+    }
+
+    void TraingEndnoteView::PreLoad(void)
+    {
+        if (!viewiInitStatus)
+        {
+            InitView();
+            viewiInitStatus = true;
+        }
+    }
+    void TraingEndnoteView::OnStart()
+    {
+        container_ = new UIViewGroup();
+        if (container_ == nullptr)
+        {
+            return;
+        }
+        container_->SetPosition(0, 0);
+        container_->SetWidth(Screen::GetInstance().GetWidth());
+        container_->SetHeight(Screen::GetInstance().GetHeight());
+
+        // 创建 draglistener 实例并设置为拖动监听器
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingEndnotePresenter::GetInstance());
+        if (draglistener == nullptr)
+        {
+            return;
+        }
+        container_->SetOnDragListener(draglistener);
+
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+
+        PreLoad();
+        RootView::GetInstance()->Add(container_);
+    }
+
+    void TraingEndnoteView::OnSetUpView()
+    {
+
+        View<TraingEndnotePresenter>::OnSetUpView();
+        Draw();
+    }
+
+    void TraingEndnoteView::OnTearDownView()
+    {
+
+        View<TraingEndnotePresenter>::OnTearDownView();
+        return;
+    }
+
+    void TraingEndnoteView::OnStop()
+    {
+        View<TraingEndnotePresenter>::OnStop();
+        RootView::GetInstance()->RemoveAll();
+        return;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSPresenter.cpp
new file mode 100644 (file)
index 0000000..589c892
--- /dev/null
@@ -0,0 +1,84 @@
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingGPSPresenter.h"
+// #include "TraingGPSView.h"
+
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static TraingGPSPresenter *g_pTraingGPSPresenter = nullptr;
+
+    TraingGPSPresenter::TraingGPSPresenter()
+    {
+
+        g_pTraingGPSPresenter = this;
+    }
+
+    TraingGPSPresenter::~TraingGPSPresenter()
+    {
+
+        g_pTraingGPSPresenter = nullptr;
+    }
+
+    TraingGPSPresenter *TraingGPSPresenter::GetInstance()
+    {
+
+        return g_pTraingGPSPresenter;
+    }
+
+    void TraingGPSPresenter::OnStart()
+    {
+
+        Presenter<TraingGPSView>::OnStart();
+    }
+
+    void TraingGPSPresenter::OnPause(void)
+    {
+
+        Presenter<TraingGPSView>::OnPause();
+    }
+
+    void TraingGPSPresenter::OnResume(void)
+    {
+
+        Presenter<TraingGPSView>::OnResume();
+    }
+
+    void TraingGPSPresenter::OnStop(void)
+    {
+
+        Presenter<TraingGPSView>::OnStop();
+    }
+
+    bool TraingGPSPresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
+            (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
+        {
+            uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
+                       NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
+        }
+        UNUSED(view);
+        return true;
+    }
+
+    bool TraingGPSPresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        // 根据控件id查找是哪个控件触发了点击回调
+        if (strcmp(view.GetViewId(), BUTTONSET) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGSET);
+        }
+        if (strcmp(view.GetViewId(), BUTTONGO) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL);
+        }
+        return true;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSView.cpp
new file mode 100644 (file)
index 0000000..46d4807
--- /dev/null
@@ -0,0 +1,231 @@
+
+#include "traing/include/TraingGPSView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+    static const char *imagePath_heartrate = "/user/res/Training/heartrate_1.bin";
+    static const char *imagePath_GPS = "/user/res/Training/GPS_1.bin";
+    static TraingGPSView *g_pTraingGPSView{nullptr};
+
+    TraingGPSView::TraingGPSView()
+    {
+        g_pTraingGPSView = this;
+    }
+
+    TraingGPSView::~TraingGPSView()
+    {
+        DeInit();
+        g_pTraingGPSView = nullptr;
+    }
+
+    TraingGPSView *TraingGPSView::GetInstance()
+    {
+
+        return g_pTraingGPSView;
+    }
+    /*
+    InitLabel:初始化标签
+    @param label 标签指针
+    @param left 标签左边位置
+    @param top 标签顶部位置
+    @param width 标签宽度
+    @param height 标签高度
+    @param viewId 标签的视图 ID
+    @param text 标签显示的文本
+    @param fontName 字体名称
+    @param fontSize 字体大小
+    */
+    void TraingGPSView::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();
+        }
+        // 设置标签的位置和大小
+        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);
+    }
+    /*
+    InitButton:初始化按钮
+    @param button 按钮指针
+    @param left 按钮左边位置
+    @param top 按钮顶部位置
+    @param width 按钮宽度
+    @param height 按钮高度
+    @param viewId 按钮的视图 ID
+    */
+    void TraingGPSView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+    {
+        // 设置按钮的背景颜色
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色
+        // 创建新按钮(如果当前按钮为空)
+        if (button == nullptr)
+        {
+            button = new UIButton();
+        }
+        button->SetPosition(left, top);
+        button->Resize(width, height);
+        button->SetViewId(viewId);
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+        // 设置按钮的点击事件监听器为 TraingGPSPresenter 的实例
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingGPSPresenter::GetInstance()));
+        // 设置按钮可见
+        button->SetVisible(true);
+    }
+    /*
+    InitImageView:初始化图片
+    @param imageView 图片指针
+    @param left 图片左边位置
+    @param top 图片顶部位置
+    @param width 图片宽度
+    @param height 图片高度
+    @param viewId 图片的视图 ID
+    @param imagePath 图片路径
+    */
+    void TraingGPSView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+    {
+        if (imageView == nullptr)
+        {
+            imageView = new UIImageView();
+        }
+        imageView->SetPosition(left, top);
+        imageView->Resize(width, height);
+        imageView->SetViewId(viewId);
+        imageView->SetSrc(imagePath);
+        imageView->SetVisible(true);
+    }
+
+    /* InitView:初始化界面*/
+    void TraingGPSView ::InitView()
+    {
+        if (container_ == nullptr)
+        {
+            container_ = new UIViewGroup();
+            container_->SetPosition(0, 0, 466, 466);
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+        }
+
+        // 初始化Lable
+        InitLabel(label1_, 203, 52, 195, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        container_->Add(label1_);
+        InitLabel(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        container_->Add(label2_);
+        InitLabel(label3_, 41, 237, 54, 41, "lable3", "144", DEFAULT_VECTOR_FONT_FILENAME, 35);
+        container_->Add(label3_);
+        InitLabel(label4_, 361, 237, 54, 41, "lable4", "GPS", DEFAULT_VECTOR_FONT_FILENAME, 35);
+        container_->Add(label4_);
+        // 初始化image
+        InitImageView(image1_, 48, 193, 40, 40, "image1", imagePath_heartrate);
+        InitImageView(image2_, 375, 193, 40, 40, "image2", imagePath_GPS);
+        container_->Add(image1_);
+        container_->Add(image2_);
+        // 初始化Button
+        InitButton(button1_, 133, 133, 200, 200, BUTTONGO);
+        // Set additional property
+        char *button1defaultImgSrc = "/user/res/Training/Go.bin";
+        char *button1triggeredImgSrc = nullptr;
+        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+
+        InitButton(button2_, 160, 370, 146, 35, BUTTONSET);
+        button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); // 设置为透明按键
+        button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+        button2_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x80, UIButton::PRESSED); // 设置按下时的透明度为半透明
+
+        container_->Add(button1_);
+        container_->Add(button2_);
+    }
+    /* DeInit:删除组件*/
+    void TraingGPSView::DeInit()
+    {
+        UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+        while (view != nullptr)
+        {
+            UIView *tempView = view;
+            view = view->GetNextSibling();
+            if (tempView->GetParent())
+            {
+                static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+            }
+            delete tempView;
+        }
+        delete container_;
+        container_ = nullptr;
+    }
+
+    void TraingGPSView::PreLoad(void)
+    {
+        if (!viewiInitStatus)
+        {
+            InitView();
+            viewiInitStatus = true;
+        }
+    }
+    void TraingGPSView::OnStart()
+    {
+        container_ = new UIViewGroup();
+        if (container_ == nullptr)
+        {
+            return;
+        }
+        container_->SetPosition(0, 0);
+        container_->SetWidth(Screen::GetInstance().GetWidth());
+        container_->SetHeight(Screen::GetInstance().GetHeight());
+
+        // 创建 draglistener 实例并设置为拖动监听器
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSPresenter::GetInstance());
+        if (draglistener == nullptr)
+        {
+            return;
+        }
+        container_->SetOnDragListener(draglistener);
+
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+
+        PreLoad();
+        RootView::GetInstance()->Add(container_);
+    }
+
+    void TraingGPSView::OnSetUpView()
+    {
+
+        View<TraingGPSPresenter>::OnSetUpView();
+        Draw();
+    }
+
+    void TraingGPSView::OnTearDownView()
+    {
+
+        View<TraingGPSPresenter>::OnTearDownView();
+        return;
+    }
+
+    void TraingGPSView::OnStop()
+    {
+        View<TraingGPSPresenter>::OnStop();
+        RootView::GetInstance()->RemoveAll();
+        return;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackPresenter.cpp
new file mode 100644 (file)
index 0000000..8cf922c
--- /dev/null
@@ -0,0 +1,84 @@
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingGPSlackPresenter.h"
+// #include "TraingGPSlackView.h"
+
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static TraingGPSlackPresenter *g_pTraingGPSlackPresenter = nullptr;
+
+    TraingGPSlackPresenter::TraingGPSlackPresenter()
+    {
+
+        g_pTraingGPSlackPresenter = this;
+    }
+
+    TraingGPSlackPresenter::~TraingGPSlackPresenter()
+    {
+
+        g_pTraingGPSlackPresenter = nullptr;
+    }
+
+    TraingGPSlackPresenter *TraingGPSlackPresenter::GetInstance()
+    {
+
+        return g_pTraingGPSlackPresenter;
+    }
+
+    void TraingGPSlackPresenter::OnStart()
+    {
+
+        Presenter<TraingGPSlackView>::OnStart();
+    }
+
+    void TraingGPSlackPresenter::OnPause(void)
+    {
+
+        Presenter<TraingGPSlackView>::OnPause();
+    }
+
+    void TraingGPSlackPresenter::OnResume(void)
+    {
+
+        Presenter<TraingGPSlackView>::OnResume();
+    }
+
+    void TraingGPSlackPresenter::OnStop(void)
+    {
+
+        Presenter<TraingGPSlackView>::OnStop();
+    }
+
+    bool TraingGPSlackPresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
+            (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
+        {
+            uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
+            NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
+        }
+        UNUSED(view);
+        return true;
+    }
+
+    bool TraingGPSlackPresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        // 根据控件id查找是哪个控件触发了点击回调
+        if (strcmp(view.GetViewId(), BUTTONSET) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGSET);
+        }
+        if (strcmp(view.GetViewId(), BUTTONGO) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPSNOTE);
+        }
+        return true;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackView.cpp
new file mode 100644 (file)
index 0000000..383e6a6
--- /dev/null
@@ -0,0 +1,231 @@
+
+#include "traing/include/TraingGPSlackView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+    static const char *imagePath_heartrate = "/user/res/Training/heartrate_2.bin";
+    static const char *imagePath_GPS = "/user/res/Training/GPS_2.bin";
+    static TraingGPSlackView *g_pTraingGPSlackView{nullptr};
+
+    TraingGPSlackView::TraingGPSlackView()
+    {
+        g_pTraingGPSlackView = this;
+    }
+
+    TraingGPSlackView::~TraingGPSlackView()
+    {
+        DeInit();
+        g_pTraingGPSlackView = nullptr;
+    }
+
+    TraingGPSlackView *TraingGPSlackView::GetInstance()
+    {
+
+        return g_pTraingGPSlackView;
+    }
+    /*
+    InitLabel:初始化标签
+    @param label 标签指针
+    @param left 标签左边位置
+    @param top 标签顶部位置
+    @param width 标签宽度
+    @param height 标签高度
+    @param viewId 标签的视图 ID
+    @param text 标签显示的文本
+    @param fontName 字体名称
+    @param fontSize 字体大小
+    */
+    void TraingGPSlackView::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();
+        }
+        // 设置标签的位置和大小
+        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);
+    }
+    /*
+    InitButton:初始化按钮
+    @param button 按钮指针
+    @param left 按钮左边位置
+    @param top 按钮顶部位置
+    @param width 按钮宽度
+    @param height 按钮高度
+    @param viewId 按钮的视图 ID
+    */
+    void TraingGPSlackView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+    {
+        // 设置按钮的背景颜色
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色
+        // 创建新按钮(如果当前按钮为空)
+        if (button == nullptr)
+        {
+            button = new UIButton();
+        }
+        button->SetPosition(left, top);
+        button->Resize(width, height);
+        button->SetViewId(viewId);
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+        // 设置按钮的点击事件监听器为 TraingGPSlackPresenter 的实例
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingGPSlackPresenter::GetInstance()));
+        // 设置按钮可见
+        button->SetVisible(true);
+    }
+    /*
+    InitImageView:初始化图片
+    @param imageView 图片指针
+    @param left 图片左边位置
+    @param top 图片顶部位置
+    @param width 图片宽度
+    @param height 图片高度
+    @param viewId 图片的视图 ID
+    @param imagePath 图片路径
+    */
+    void TraingGPSlackView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+    {
+        if (imageView == nullptr)
+        {
+            imageView = new UIImageView();
+        }
+        imageView->SetPosition(left, top);
+        imageView->Resize(width, height);
+        imageView->SetViewId(viewId);
+        imageView->SetSrc(imagePath);
+        imageView->SetVisible(true);
+    }
+
+    /* InitView:初始化界面*/
+    void TraingGPSlackView ::InitView()
+    {
+        if (container_ == nullptr)
+        {
+            container_ = new UIViewGroup();
+            container_->SetPosition(0, 0, 466, 466);
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+        }
+
+        // 初始化Lable
+        InitLabel(label1_, 203, 52, 195, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        container_->Add(label1_);
+        InitLabel(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        container_->Add(label2_);
+        InitLabel(label3_, 41, 237, 54, 41, "lable3", "--", DEFAULT_VECTOR_FONT_FILENAME, 35);
+        container_->Add(label3_);
+        InitLabel(label4_, 361, 237, 54, 41, "lable4", "--", DEFAULT_VECTOR_FONT_FILENAME, 35);
+        container_->Add(label4_);
+        // 初始化image
+        InitImageView(image1_, 48, 193, 40, 40, "image1", imagePath_heartrate);
+        InitImageView(image2_, 375, 193, 40, 40, "image2", imagePath_GPS);
+        container_->Add(image1_);
+        container_->Add(image2_);
+        // 初始化Button
+        InitButton(button1_, 133, 133, 200, 200, BUTTONGO);
+        // Set additional property
+        char *button1defaultImgSrc = "/user/res/Training/Go_2.bin";
+        char *button1triggeredImgSrc = nullptr;
+        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+
+        InitButton(button2_, 160, 370, 146, 35, BUTTONSET);
+        button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); // 设置为透明按键
+        button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+        button2_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x80, UIButton::PRESSED); // 设置按下时的透明度为半透明
+
+        container_->Add(button1_);
+        container_->Add(button2_);
+    }
+    /* DeInit:删除组件*/
+    void TraingGPSlackView::DeInit()
+    {
+        UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+        while (view != nullptr)
+        {
+            UIView *tempView = view;
+            view = view->GetNextSibling();
+            if (tempView->GetParent())
+            {
+                static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+            }
+            delete tempView;
+        }
+        delete container_;
+        container_ = nullptr;
+    }
+
+    void TraingGPSlackView::PreLoad(void)
+    {
+        if (!viewiInitStatus)
+        {
+            InitView();
+            viewiInitStatus = true;
+        }
+    }
+    void TraingGPSlackView::OnStart()
+    {
+        container_ = new UIViewGroup();
+        if (container_ == nullptr)
+        {
+            return;
+        }
+        container_->SetPosition(0, 0);
+        container_->SetWidth(Screen::GetInstance().GetWidth());
+        container_->SetHeight(Screen::GetInstance().GetHeight());
+
+        // 创建 draglistener 实例并设置为拖动监听器
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSlackPresenter::GetInstance());
+        if (draglistener == nullptr)
+        {
+            return;
+        }
+        container_->SetOnDragListener(draglistener);
+
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+
+        PreLoad();
+        RootView::GetInstance()->Add(container_);
+    }
+
+    void TraingGPSlackView::OnSetUpView()
+    {
+
+        View<TraingGPSlackPresenter>::OnSetUpView();
+        Draw();
+    }
+
+    void TraingGPSlackView::OnTearDownView()
+    {
+
+        View<TraingGPSlackPresenter>::OnTearDownView();
+        return;
+    }
+
+    void TraingGPSlackView::OnStop()
+    {
+        View<TraingGPSlackPresenter>::OnStop();
+        RootView::GetInstance()->RemoveAll();
+        return;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSnotePresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSnotePresenter.cpp
new file mode 100644 (file)
index 0000000..3c125e3
--- /dev/null
@@ -0,0 +1,84 @@
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include <iostream>
+#include <chrono>
+#include <thread>
+#include "traing/include/TraingGPSnotePresenter.h"
+// #include "TraingGPSnoteView.h"
+
+namespace OHOS
+{
+
+    // 当前Presenter属性实例化的内存指针
+    static TraingGPSnotePresenter *g_pTraingGPSnotePresenter = nullptr;
+
+    TraingGPSnotePresenter::TraingGPSnotePresenter()
+    {
+
+        g_pTraingGPSnotePresenter = this;
+    }
+
+    TraingGPSnotePresenter::~TraingGPSnotePresenter()
+    {
+
+        g_pTraingGPSnotePresenter = nullptr;
+    }
+
+    TraingGPSnotePresenter *TraingGPSnotePresenter::GetInstance()
+    {
+
+        return g_pTraingGPSnotePresenter;
+    }
+
+    void TraingGPSnotePresenter::OnStart()
+    {
+
+        Presenter<TraingGPSnoteView>::OnStart();
+    }
+
+    void TraingGPSnotePresenter::OnPause(void)
+    {
+
+        Presenter<TraingGPSnoteView>::OnPause();
+    }
+
+    void TraingGPSnotePresenter::OnResume(void)
+    {
+
+        Presenter<TraingGPSnoteView>::OnResume();
+    }
+
+    void TraingGPSnotePresenter::OnStop(void)
+    {
+
+        Presenter<TraingGPSnoteView>::OnStop();
+    }
+
+    bool TraingGPSnotePresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
+            (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
+        {
+            uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
+            NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
+        }
+        UNUSED(view);
+        return true;
+    }
+
+    bool TraingGPSnotePresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        // 根据控件id查找是哪个控件触发了点击回调
+        if (strcmp(view.GetViewId(), BUTTONBACK) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPS);
+        }
+        if (strcmp(view.GetViewId(), BUTTONGO) == 0)
+        {
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL);
+        }
+        return true;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSnoteView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSnoteView.cpp
new file mode 100644 (file)
index 0000000..4be1e94
--- /dev/null
@@ -0,0 +1,254 @@
+
+#include "traing/include/TraingGPSnoteView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+    static const char *imagePath_warning = "/user/res/Training/warning.bin";
+
+    static TraingGPSnoteView *g_pTraingGPSnoteView{nullptr};
+
+    TraingGPSnoteView::TraingGPSnoteView()
+    {
+        g_pTraingGPSnoteView = this;
+    }
+
+    TraingGPSnoteView::~TraingGPSnoteView()
+    {
+        DeInit();
+        g_pTraingGPSnoteView = nullptr;
+    }
+
+    TraingGPSnoteView *TraingGPSnoteView::GetInstance()
+    {
+
+        return g_pTraingGPSnoteView;
+    }
+
+    /*
+    InitLabel:初始化标签
+    @param label 标签指针
+    @param left 标签左边位置
+    @param top 标签顶部位置
+    @param width 标签宽度
+    @param height 标签高度
+    @param viewId 标签的视图 ID
+    @param text 标签显示的文本
+    @param fontName 字体名称
+    @param fontSize 字体大小
+    */
+    void TraingGPSnoteView::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();
+        }
+        // 设置标签的位置和大小
+        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);
+        label1_->SetTextColor(Color::GetColorFromRGBA(0x22, 0x9d, 0xd3, 0xff));
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+        label->SetRollSpeed(0);
+        // 设置标签可见
+        label->SetVisible(true);
+    }
+    /*
+    InitButton:初始化按钮
+    @param button 按钮指针
+    @param left 按钮左边位置
+    @param top 按钮顶部位置
+    @param width 按钮宽度
+    @param height 按钮高度
+    @param viewId 按钮的视图 ID
+    */
+    void TraingGPSnoteView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)
+    {
+        // 设置按钮的背景颜色
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色
+        // 创建新按钮(如果当前按钮为空)
+        if (button == nullptr)
+        {
+            button = new UIButton();
+        }
+        button->SetPosition(left, top);
+        button->Resize(width, height);
+        button->SetViewId(viewId);
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);
+        // 设置按钮的点击事件监听器为 TraingGPSnotePresenter 的实例
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingGPSnotePresenter::GetInstance()));
+        // 设置按钮可见
+        button->SetVisible(true);
+    }
+    /*
+   InitImageView:初始化图片
+   @param imageView 图片指针
+   @param left 图片左边位置
+   @param top 图片顶部位置
+   @param width 图片宽度
+   @param height 图片高度
+   @param viewId 图片的视图 ID
+   @param imagePath 图片路径
+   */
+    void TraingGPSnoteView::InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath)
+    {
+        if (imageView == nullptr)
+        {
+            imageView = new UIImageView();
+        }
+        imageView->SetPosition(left, top);
+        imageView->Resize(width, height);
+        imageView->SetViewId(viewId);
+        imageView->SetSrc(imagePath);
+        imageView->SetVisible(true);
+    }
+    /* InitView:初始化界面*/
+    void TraingGPSnoteView ::InitView()
+    {
+        if (container_ == nullptr)
+        {
+            container_ = new UIViewGroup();
+            container_->SetPosition(0, 0, 466, 466);
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+        }
+
+        // Add ScrollView to App
+        if (scrollView1_ == nullptr)
+        {
+            scrollView1_ = new UIScrollView();
+        }
+        scrollView1_->SetPosition(0, 0);        // widget's left position and top position
+        scrollView1_->Resize(466, 466);         // widget's width and height
+        scrollView1_->SetViewId("scrollView1"); // Set style
+        scrollView1_->SetReboundSize(100);
+        scrollView1_->SetScrollBlankSize(52);
+        scrollView1_->SetHorizontalScrollState(false);
+        // Add to rootView
+        container_->Add(scrollView1_);
+        scrollView1_->SetVisible(true);
+
+        // 初始化Image
+        InitImageView(image1_, 193, 111, 80, 80, "image1", imagePath_warning);
+        scrollView1_->Add(image1_);
+
+        // 初始化button
+        InitButton(button1_, 118, 334, 230, 80, BUTTONBACK);
+        button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c);
+        scrollView1_->Add(button1_);
+
+        InitButton(button2_, 118, 434, 230, 80, BUTTONBACK);
+        scrollView1_->Add(button2_);
+
+        // 初始化Lable
+        InitLabel(label1_, 160, 52, 90, 35, "label1", "GPS未准备", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        InitLabel(label2_, 33, 215, 60, 40, "label2", "GPS仍在定位,建议等待定位\n完成后再开始训练", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        InitLabel(label3_, 181, 357, 60, 40, "label3", "继续等待", DEFAULT_VECTOR_FONT_FILENAME, 30);
+        InitLabel(label4_, 181, 457, 60, 40, "label4", "直接开始", DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+        scrollView1_->Add(label1_);
+        scrollView1_->Add(label2_);
+        scrollView1_->Add(label3_);
+        scrollView1_->Add(label4_);
+
+        // Add ImageView to App
+        if (image2_ == nullptr)
+        {
+            image2_ = new UIImageView();
+        }
+        image2_->SetPosition(181, 500); // widget's left position and top position
+        image2_->Resize(100, 100);       // widget's width and height
+        image2_->SetViewId("image7");    // Set style
+        // Add to rootView
+        scrollView1_->Add(image2_);
+        image2_->SetVisible(true);
+    }
+
+    /* DeInit:删除组件 */
+    void TraingGPSnoteView::DeInit()
+    {
+        UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
+        while (view != nullptr)
+        {
+            UIView *tempView = view;
+            view = view->GetNextSibling();
+            if (tempView->GetParent())
+            {
+                static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
+            }
+            delete tempView;
+        }
+        delete container_;
+        container_ = nullptr;
+    }
+
+    void TraingGPSnoteView::PreLoad(void)
+    {
+        if (!viewiInitStatus)
+        {
+            InitView();
+            viewiInitStatus = true;
+        }
+    }
+    void TraingGPSnoteView::OnStart()
+    {
+        container_ = new UIViewGroup();
+        if (container_ == nullptr)
+        {
+            return;
+        }
+        container_->SetPosition(0, 0);
+        container_->SetWidth(Screen::GetInstance().GetWidth());
+        container_->SetHeight(Screen::GetInstance().GetHeight());
+
+        // 创建 draglistener 实例并设置为拖动监听器
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSnotePresenter::GetInstance());
+        if (draglistener == nullptr)
+        {
+            return;
+        }
+        container_->SetOnDragListener(draglistener);
+
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+
+        PreLoad();
+        RootView::GetInstance()->Add(container_);
+    }
+
+    void TraingGPSnoteView::OnSetUpView()
+    {
+
+        View<TraingGPSnotePresenter>::OnSetUpView();
+        Draw();
+    }
+
+    void TraingGPSnoteView::OnTearDownView()
+    {
+
+        View<TraingGPSnotePresenter>::OnTearDownView();
+        return;
+    }
+
+    void TraingGPSnoteView::OnStop()
+    {
+        View<TraingGPSnotePresenter>::OnStop();
+        RootView::GetInstance()->RemoveAll();
+        return;
+    }
+}
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingSetCaluliPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingSetCaluliPresenter.cpp
new file mode 100644 (file)
index 0000000..0898371
--- /dev/null
@@ -0,0 +1,79 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include <iostream>\r
+#include <chrono>\r
+#include <thread>\r
+#include "traing/include/TraingSetCaluliPresenter.h"\r
+// #include "TraingSetCaluliView.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static TraingSetCaluliPresenter *g_pTraingSetCaluliPresenter = nullptr;\r
+\r
+    TraingSetCaluliPresenter::TraingSetCaluliPresenter()\r
+    {\r
+\r
+        g_pTraingSetCaluliPresenter = this;\r
+    }\r
+\r
+    TraingSetCaluliPresenter::~TraingSetCaluliPresenter()\r
+    {\r
+\r
+        g_pTraingSetCaluliPresenter = nullptr;\r
+    }\r
+\r
+    TraingSetCaluliPresenter *TraingSetCaluliPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pTraingSetCaluliPresenter;\r
+    }\r
+\r
+    void TraingSetCaluliPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<TraingSetCaluliView>::OnStart();\r
+    }\r
+\r
+    void TraingSetCaluliPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<TraingSetCaluliView>::OnPause();\r
+    }\r
+\r
+    void TraingSetCaluliPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<TraingSetCaluliView>::OnResume();\r
+    }\r
+\r
+    void TraingSetCaluliPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<TraingSetCaluliView>::OnStop();\r
+    }\r
+\r
+    bool TraingSetCaluliPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        // if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+        //     (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        // {\r
+        //     NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGSET);\r
+        // }\r
+        UNUSED(view);\r
+        return true;\r
+    }\r
+\r
+    bool TraingSetCaluliPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        if (strcmp(view.GetViewId(), BUTTONOK) == 0)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGSET);\r
+        }\r
+        return true;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingSetCaluliView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingSetCaluliView.cpp
new file mode 100644 (file)
index 0000000..5d5ff2a
--- /dev/null
@@ -0,0 +1,280 @@
+\r
+#include "traing/include/TraingSetCaluliView.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
+#include "common/screen.h"\r
+#include <sstream>\r
+#include <string>\r
+#include <vector>\r
+\r
+namespace OHOS\r
+{\r
+\r
+    /***************************************************************************************/\r
+    // 动态生成包含指定卡路里区间内所有卡路里数的字符串数组\r
+    std::vector<std::string> GenerateCaluliValues(int minTime, int maxTime, int interval)\r
+    {\r
+        std::vector<std::string> values;\r
+        for (int i = minTime; i <= maxTime; i += interval)\r
+        {\r
+            values.push_back(std::to_string(i) + " 千卡");\r
+        }\r
+        return values;\r
+    }\r
+    /***************************************************************************************/\r
+    static TraingSetCaluliView *g_pTraingSetCaluliView{nullptr};\r
+\r
+    TraingSetCaluliView::TraingSetCaluliView()\r
+    {\r
+        g_pTraingSetCaluliView = this;\r
+    }\r
+\r
+    TraingSetCaluliView::~TraingSetCaluliView()\r
+    {\r
+        DeInit();\r
+        g_pTraingSetCaluliView = nullptr;\r
+    }\r
+\r
+    TraingSetCaluliView *TraingSetCaluliView::GetInstance()\r
+    {\r
+\r
+        return g_pTraingSetCaluliView;\r
+    }\r
+    /*\r
+    InitLabel:初始化标签\r
+    @param label 标签指针\r
+    @param left 标签左边位置\r
+    @param top 标签顶部位置\r
+    @param width 标签宽度\r
+    @param height 标签高度\r
+    @param viewId 标签的视图 ID\r
+    @param text 标签显示的文本\r
+    @param fontName 字体名称\r
+    @param fontSize 字体大小\r
+    */\r
+    void TraingSetCaluliView::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize)\r
+    {\r
+        // 检查标签指针是否为空\r
+        if (label == nullptr)\r
+        {\r
+            label = new UILabel();\r
+        }\r
+        // 设置标签的位置和大小\r
+        label->SetPosition(left, top);\r
+        label->Resize(width, height);\r
+        // 设置标签的视图 ID\r
+        label->SetViewId(viewId);\r
+        // 设置标签的样式\r
+        label->SetStyle(STYLE_TEXT_FONT, fontSize);\r
+        label->SetFont(fontName, fontSize);\r
+        // 设置标签的文本和其他属性\r
+        label->SetText(text);\r
+        label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label->SetRollSpeed(0);\r
+        // 设置标签可见\r
+        label->SetVisible(true);\r
+    }\r
+    /*\r
+    InitButton:初始化按钮\r
+    @param button 按钮指针\r
+    @param left 按钮左边位置\r
+    @param top 按钮顶部位置\r
+    @param width 按钮宽度\r
+    @param height 按钮高度\r
+    @param viewId 按钮的视图 ID\r
+    */\r
+    void TraingSetCaluliView::InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId)\r
+    {\r
+        // 设置按钮的背景颜色\r
+        uint32_t backgroundColor = 0xff191919;        // 默认背景颜色\r
+        uint32_t pressedBackgroundColor = 0xff249115; // 按下时的背景颜色\r
+        uint32_t pressedBorderColor = 0xff0b1928;     // 按下时的边框颜色\r
+        // 创建新按钮(如果当前按钮为空)\r
+        if (button == nullptr)\r
+        {\r
+            button = new UIButton();\r
+        }\r
+        button->SetPosition(left, top);\r
+        button->Resize(width, height);\r
+        button->SetViewId(viewId);\r
+        button->SetStyle(STYLE_BACKGROUND_COLOR, backgroundColor);\r
+        button->SetStyleForState(STYLE_BACKGROUND_COLOR, pressedBackgroundColor, UIButton::PRESSED);\r
+        button->SetStyleForState(STYLE_BORDER_COLOR, pressedBorderColor, UIButton::PRESSED);\r
+        // 设置按钮的点击事件监听器为 TraingSetCaluliPresenter 的实例\r
+        button->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingSetCaluliPresenter::GetInstance()));\r
+        // 设置按钮可见\r
+        button->SetVisible(true);\r
+    }\r
+    /*\r
+    InitUIPicker: 初始化UIPicker组件\r
+    @param picker: 指向UIPicker的指针\r
+    @param x: UIPicker的左边位置\r
+    @param y: UIPicker的顶部位置\r
+    @param width: UIPicker的宽度\r
+    @param height: UIPicker的高度\r
+    @param viewId: UIPicker的视图 ID\r
+    @param values: 选项数组\r
+    @param count: 选项数量\r
+    @param backgroundFontSize: 普通文本大小\r
+    @highlightFontSize: 高光文本大小\r
+    */\r
+    void TraingSetCaluliView::InitUIPicker(UIPicker *&picker, int x, int y, int width, int height, const char *viewId)\r
+    {\r
+        // 文本大小\r
+        constexpr uint8_t BACKGROUND_FONT = 40;\r
+        constexpr uint8_t HIGHTLIGHT_FONT = 60;\r
+        // 获取value数组\r
+        int minCaluli = 100;\r
+        int maxCaluli = 1000;\r
+        int interval = 100;\r
+        std::vector<std::string> caluliValues = GenerateCaluliValues(minCaluli, maxCaluli, interval);\r
+\r
+        const char **values = new const char *[caluliValues.size()];\r
+        for (size_t i = 0; i < caluliValues.size(); i++)\r
+        {\r
+            values[i] = caluliValues[i].c_str();\r
+        }\r
+        // 创建 UIPicker\r
+        if (picker == nullptr)\r
+        {\r
+            picker = new UIPicker();\r
+        }\r
+\r
+        // 设置 UIPicker 的位置和大小\r
+        picker->SetPosition(x, y);\r
+        picker->Resize(width, height);\r
+        // 设置 UIPicker 的 ViewId\r
+        picker->SetViewId(viewId);\r
+        // 设置 UIPicker 的属性\r
+        picker->SetItemHeight(70);\r
+        picker->SetLoopState(true);\r
+        picker->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff), Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));\r
+        picker->SetBackgroundFont(DEFAULT_VECTOR_FONT_FILENAME, BACKGROUND_FONT); // 设置普通文本大小\r
+        picker->SetHighlightFont(DEFAULT_VECTOR_FONT_FILENAME, HIGHTLIGHT_FONT);  // 设置高光文本大小\r
+        picker->SetValues(values, caluliValues.size());\r
+        // 将 UIPicker 设置为显示\r
+        picker->SetVisible(true);\r
+    }\r
+\r
+    /* InitView:初始化界面*/\r
+    void TraingSetCaluliView ::InitView()\r
+    {\r
+        if (container_ == nullptr)\r
+        {\r
+            container_ = new UIViewGroup();\r
+            container_->SetPosition(0, 0, 466, 466);\r
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+        }\r
+        // 初始化Lable\r
+        InitLabel(label1_, 173, 52, 120, 35, "label1", "卡路里设定", DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+        container_->Add(label1_);\r
+\r
+        // 初始化UIPicker\r
+        InitUIPicker(uiPicker1_, 43, 106, 380, 240, "uiPicker1");\r
+        container_->Add(uiPicker1_);\r
+        //  初始化Button\r
+        InitButton(button1_, 0, 366, 466, 100, BUTTONOK);\r
+        // Set additional property\r
+        char *button1defaultImgSrc = "/user/res/Training/buttonok.bin";\r
+        char *button1triggeredImgSrc = nullptr;\r
+        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
+        container_->Add(button1_);\r
+    }\r
+    /* DeInit:删除组件 */\r
+    void TraingSetCaluliView::DeInit()\r
+    {\r
+        // 删除Label\r
+        if (label1_ != nullptr)\r
+        {\r
+            container_->Remove(label1_);\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        // 删除Button\r
+        if (button1_ != nullptr)\r
+        {\r
+            container_->Remove(button1_);\r
+            delete button1_;\r
+            button1_ = nullptr;\r
+        }\r
+\r
+        // 删除Image\r
+\r
+        // 删除滚动选择器\r
+        if (uiPicker1_ != nullptr)\r
+        {\r
+            container_->Remove(uiPicker1_);\r
+            delete uiPicker1_;\r
+            uiPicker1_ = nullptr;\r
+        }\r
+\r
+        // 删除容器\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll(); // 移除容器中的所有组件\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+\r
+    void TraingSetCaluliView::PreLoad(void)\r
+    {\r
+        if (!viewiInitStatus)\r
+        {\r
+            //printf("init traingsetcaluliview\n");\r
+            InitView();\r
+            viewiInitStatus = true;\r
+        }\r
+    }\r
+    void TraingSetCaluliView::OnStart()\r
+    {\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetPosition(0, 0);\r
+        container_->SetWidth(Screen::GetInstance().GetWidth());\r
+        container_->SetHeight(Screen::GetInstance().GetHeight());\r
+\r
+        // 创建 draglistener 实例并设置为拖动监听器\r
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingSetCaluliPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetOnDragListener(draglistener);\r
+\r
+        container_->SetTouchable(true);\r
+        container_->SetDraggable(true);\r
+\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void TraingSetCaluliView::OnSetUpView()\r
+    {\r
+\r
+        View<TraingSetCaluliPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void TraingSetCaluliView::OnTearDownView()\r
+    {\r
+\r
+        View<TraingSetCaluliPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void TraingSetCaluliView::OnStop()\r
+    {\r
+        View<TraingSetCaluliPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/include/FutureWeatherPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/weather/include/FutureWeatherPresenter.h
new file mode 100644 (file)
index 0000000..6451306
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef FUTURE_WEATHER_PRESENTER_H\r
+#define FUTURE_WEATHER_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+\r
+#include "FutureWeatherView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class FutureWeatherView;\r
+\r
+    class FutureWeatherPresenter : public Presenter<FutureWeatherView>,\r
+                                   public UIView::OnClickListener,\r
+                                   public UIView::OnDragListener\r
+    {\r
+    public:\r
+        FutureWeatherPresenter();\r
+        virtual ~FutureWeatherPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static FutureWeatherPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // FutureWeather_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/include/FutureWeatherView.h b/code/sdk/application/wearable/nativeapp/nativeui/weather/include/FutureWeatherView.h
new file mode 100644 (file)
index 0000000..d4ba47d
--- /dev/null
@@ -0,0 +1,66 @@
+#ifndef FUTURE_WEATHER_VIEW_H\r
+#define FUTURE_WEATHER_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_list.h"\r
+#include "components/icon_adapter.h"\r
+\r
+namespace OHOS\r
+{\r
+#define weather_src "/user/res/weather/"\r
+static const char *weather65x65[] =\r
+{\r
+weather_src"weather_sunny.bin",          //晴天\r
+weather_src"weather_clear-cloudy.bin",   //多云\r
+weather_src"weather_rain.bin",           //阵雨\r
+weather_src"weather_thundershower.bin",\r
+weather_src"weather_foggy.bin",\r
+weather_src"weather_unknown.bin",\r
+weather_src"weather_overcast.bin",\r
+weather_src"weather_clear-sunny.bin",\r
+weather_src"weather_duststorm.bin",\r
+weather_src"weather_haze.bin",\r
+weather_src"weather_snow.bin",\r
+weather_src"weather_sunny-cloudy.bin",        \r
+};\r
+\r
+\r
+}\r
+\r
+namespace OHOS\r
+{\r
+    class FutureWeatherPresenter;\r
+    class FutureWeatherView : public View<FutureWeatherPresenter>\r
+    {\r
+\r
+    public:\r
+        FutureWeatherView();\r
+        virtual ~FutureWeatherView();\r
+        static FutureWeatherView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UIList *list = nullptr;\r
+        IconAdapter *listadapter = nullptr;\r
+        List<IconItemNode *> *listdata = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // FutureWeather_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/include/GetWeatherDataErrorPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/weather/include/GetWeatherDataErrorPresenter.h
new file mode 100644 (file)
index 0000000..2bda7b5
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef Get_WEATHER_DATA_ERROR_PRESENTER_H\r
+#define Get_WEATHER_DATA_ERROR_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "GetWeatherDataErrorView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class GetWeatherDataErrorView;\r
+\r
+    class GetWeatherDataErrorPresenter : public Presenter<GetWeatherDataErrorView>,\r
+                                         public UIView::OnClickListener,\r
+                                         public UIView::OnDragListener\r
+    {\r
+    public:\r
+        GetWeatherDataErrorPresenter();\r
+        virtual ~GetWeatherDataErrorPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static GetWeatherDataErrorPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // GetWeatherDataError_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/include/GetWeatherDataErrorView.h b/code/sdk/application/wearable/nativeapp/nativeui/weather/include/GetWeatherDataErrorView.h
new file mode 100644 (file)
index 0000000..b22d633
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef Get_WEATHER_DATA_ERROR_VIEW_H\r
+#define Get_WEATHER_DATA_ERROR_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+namespace OHOS\r
+{\r
+    class GetWeatherDataErrorPresenter;\r
+    class GetWeatherDataErrorView : public View<GetWeatherDataErrorPresenter>\r
+    {\r
+\r
+    public:\r
+        GetWeatherDataErrorView();\r
+        virtual ~GetWeatherDataErrorView();\r
+        static GetWeatherDataErrorView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIView::OnDragListener *draglistener{nullptr};\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UIImageView *image1_ = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // GetWeatherDataError_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/include/MainWeatherPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/weather/include/MainWeatherPresenter.h
new file mode 100644 (file)
index 0000000..70bbd4e
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef MAIN_WEATHER_PRESENTER_H\r
+#define MAIN_WEATHER_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "MainWeatherView.h"\r
+\r
+/*主天气视图*/\r
+namespace OHOS\r
+{\r
+    class MainWeatherView;\r
+\r
+    class MainWeatherPresenter : public Presenter<MainWeatherView>,\r
+                                 public UIView::OnClickListener,\r
+                                 public UIView::OnDragListener\r
+    {\r
+    public:\r
+        MainWeatherPresenter();\r
+        virtual ~MainWeatherPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static MainWeatherPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // MainWeather_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/include/MainWeatherView.h b/code/sdk/application/wearable/nativeapp/nativeui/weather/include/MainWeatherView.h
new file mode 100644 (file)
index 0000000..b7da481
--- /dev/null
@@ -0,0 +1,83 @@
+#ifndef MAIN_WEATHER_VIEW_H\r
+#define MAIN_WEATHER_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_view.h"\r
+#include "components/ui_image_animator.h"\r
+#include <iostream>\r
+\r
+namespace OHOS\r
+{\r
+#define weather_src "/user/res/weather/"\r
+    static const char *background = weather_src "WEATHER_BACKGROUND.bin";\r
+    static const char *weather130x130[] =\r
+        {\r
+            weather_src "WEATHER_CLEAR-CLOUDY.bin",\r
+            weather_src "WEATHER_CLEAR-SUNNY.bin",\r
+            weather_src "WEATHER_DUSTSTORM.bin",\r
+            weather_src "WEATHER_FOGGY.bin",\r
+            weather_src "WEATHER_HAZE.bin",\r
+            weather_src "WEATHER_OVERCAST.bin",\r
+            weather_src "WEATHER_RAIN.bin",\r
+            weather_src "WEATHER_SNOW.bin",\r
+            weather_src "WEATHER_SUNNY.bin",\r
+            weather_src "WEATHER_SUNNY-CLOUNDY.bin",\r
+            weather_src "WEATHER_THUNDERSHOWER.bin",\r
+            weather_src "WEATHER_UNKNOWN.bin"};\r
+}\r
+\r
+namespace OHOS\r
+{\r
+    class MainWeatherPresenter;\r
+    class MainWeatherView : public View<MainWeatherPresenter>\r
+    {\r
+\r
+    public:\r
+        MainWeatherView();\r
+        virtual ~MainWeatherView();\r
+        static MainWeatherView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        UILabel *InitLabel(int x, int y, const char *text, const char *id, int textfont, int lineheight);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        std::string GetTime();\r
+        std::string GetWeatherImage();\r
+        std::string GetWeatherTemperature();\r
+        std::string GetWeatherDescription();\r
+        std::string GetWeatherArea();\r
+        std::string GetWeatherMaxAndMinTemperature();\r
+\r
+        std::string Time;                 // 时间\r
+        std::string WeatherImag;          // 天气图片\r
+        std::string Temperature;          // 温度\r
+        std::string WeatherDescription;   // 天气描述\r
+        std::string WeatherArea;          // 天气地区\r
+        std::string MaxandMinTemperature; // 最高与最低气温\r
+    private:\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label1_ = nullptr;\r
+        UILabel *label2_ = nullptr;\r
+        UIImageView *image1_ = nullptr;\r
+        UILabel *label3_ = nullptr;\r
+        UILabel *label4_ = nullptr;\r
+        UILabel *label5_ = nullptr;\r
+        UIImageAnimatorView *imageAnimator1_ = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/include/WeatherReportPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/weather/include/WeatherReportPresenter.h
new file mode 100644 (file)
index 0000000..a604926
--- /dev/null
@@ -0,0 +1,33 @@
+#ifndef WEATHER_REPORT_PRESENTER_H\r
+#define WEATHER_REPORT_PRESENTER_H\r
+\r
+#include "Presenter.h"\r
+#include "WeatherReportView.h"\r
+\r
+namespace OHOS\r
+{\r
+    class WeatherReportView;\r
+\r
+    class WeatherReportPresenter : public Presenter<WeatherReportView>,\r
+                                   public UIView::OnClickListener,\r
+                                   public UIView::OnDragListener\r
+    {\r
+    public:\r
+        WeatherReportPresenter();\r
+        virtual ~WeatherReportPresenter();\r
+\r
+        void OnStart() override;\r
+        void OnPause() override;\r
+        void OnResume() override;\r
+        void OnStop() override;\r
+\r
+        static WeatherReportPresenter *GetInstance();\r
+\r
+    private:\r
+        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
+        bool OnClick(UIView &view, const ClickEvent &event) override;\r
+        bool OnDrag(UIView &view, const DragEvent &event) override;\r
+    };\r
+} // namespace OHOS\r
+\r
+#endif // WeatherReport_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/include/WeatherReportView.h b/code/sdk/application/wearable/nativeapp/nativeui/weather/include/WeatherReportView.h
new file mode 100644 (file)
index 0000000..31c9082
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef WEATHER_REPORT_VIEW_H\r
+#define WEATHER_REPORT_VIEW_H\r
+\r
+#include "BaseView.h"\r
+#include "View.h"\r
+#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
+#include "components/ui_label.h"\r
+#include "components/ui_image_animator.h"\r
+namespace OHOS\r
+{\r
+    class WeatherReportPresenter;\r
+    class WeatherReportView : public View<WeatherReportPresenter>\r
+    {\r
+\r
+    public:\r
+        WeatherReportView();\r
+        virtual ~WeatherReportView();\r
+        static WeatherReportView *GetInstance(void);\r
+\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+\r
+    private:\r
+        void InitView(void);\r
+        void DeInitView(void);\r
+        void PreLoad(void);\r
+\r
+    private:\r
+        UIViewGroup *container_ = nullptr;\r
+        UIScrollView *scrollView1_ = nullptr;\r
+        UILabel *label5_ = nullptr;\r
+        UIImageAnimatorView *imageAnimator3_ = nullptr;\r
+        UIImageAnimatorView *imageAnimator2_ = nullptr;\r
+        UIImageAnimatorView *imageAnimator1_ = nullptr;\r
+        UIImageAnimatorView *imageAnimator = nullptr;\r
+        UILabel *label6_ = nullptr;\r
+        UILabel *label7_ = nullptr;\r
+        UILabel *label8_ = nullptr;\r
+        UILabel *label9_ = nullptr;\r
+        UILabel *label10_ = nullptr;\r
+        UILabel *label11_ = nullptr;\r
+        bool viewInitStatus{false};\r
+    };\r
+} // namespace OHOS\r
+#endif // WeatherReport_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/FutureWeatherPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/FutureWeatherPresenter.cpp
new file mode 100644 (file)
index 0000000..8c2d22b
--- /dev/null
@@ -0,0 +1,72 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include "weather/include/FutureWeatherPresenter.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static FutureWeatherPresenter *g_pFutureWeatherPresenter = nullptr;\r
+\r
+    FutureWeatherPresenter::FutureWeatherPresenter()\r
+    {\r
+\r
+        g_pFutureWeatherPresenter = this;\r
+    }\r
+\r
+    FutureWeatherPresenter::~FutureWeatherPresenter()\r
+    {\r
+\r
+        g_pFutureWeatherPresenter = nullptr;\r
+    }\r
+\r
+    FutureWeatherPresenter *FutureWeatherPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pFutureWeatherPresenter;\r
+    }\r
+\r
+    void FutureWeatherPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<FutureWeatherView>::OnStart();\r
+    }\r
+\r
+    void FutureWeatherPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<FutureWeatherView>::OnPause();\r
+    }\r
+\r
+    void FutureWeatherPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<FutureWeatherView>::OnResume();\r
+    }\r
+\r
+    void FutureWeatherPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<FutureWeatherView>::OnStop();\r
+    }\r
+\r
+    bool FutureWeatherPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM &&\r
+            (event.GetDeltaY() > 20) && (event.GetDeltaY() > (2 * MATH_ABS(event.GetDeltaX()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_WEATHER_REPORT); // 未来天气界面从上往下滑进入气象报告界面\r
+        }\r
+        return true;\r
+    }\r
+\r
+    bool FutureWeatherPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/FutureWeatherView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/FutureWeatherView.cpp
new file mode 100644 (file)
index 0000000..1c94715
--- /dev/null
@@ -0,0 +1,199 @@
+#include "weather/include/FutureWeatherView.h"\r
+#include "weather/include/FutureWeatherPresenter.h"\r
+\r
+#include "common/image_cache_manager.h"\r
+#include "UiConfig.h"\r
+#include "ui_resource_image.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    static FutureWeatherView *g_pFutureWeatherView{nullptr};\r
+\r
+    FutureWeatherView::FutureWeatherView()\r
+    {\r
+\r
+        g_pFutureWeatherView = this;\r
+    }\r
+\r
+    FutureWeatherView::~FutureWeatherView()\r
+    {\r
+        DeInitView();\r
+        g_pFutureWeatherView = nullptr;\r
+    }\r
+\r
+    FutureWeatherView *FutureWeatherView::GetInstance()\r
+    {\r
+\r
+        return g_pFutureWeatherView;\r
+    }\r
+\r
+    void FutureWeatherView::InitView()\r
+    {\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);        // widget's left position and top position\r
+        scrollView1_->Resize(466, 466);         // widget's width and height\r
+        scrollView1_->SetViewId("scrollView1"); // Set style\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        scrollView1_->SetReboundSize(50); // 设置回弹大小\r
+        scrollView1_->SetScrollBarCenter({200, 200});\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(179, 52);\r
+        label1_->Resize(108, 35);\r
+        label1_->SetViewId("label1");\r
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\r
+        label1_->SetText("未来7天");\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
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+\r
+        if (list == nullptr)\r
+        {\r
+            list = new UIList();\r
+        }\r
+        list->SetPosition(65, 140);\r
+        list->Resize(354, 520);\r
+        list->SetViewId("list1");\r
+        list->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
+        list->SetReboundSize(50); // 设置回弹值\r
+        if (listdata == nullptr)\r
+        {\r
+            listdata = new List<IconItemNode *>();\r
+        }\r
+        IconItemNode *list3data1 = new IconItemNode();\r
+        list3data1->imagePath = "/user/res/weather/weather_sunny.bin";\r
+        list3data1->txt = "周一  晴天  18°/24°";\r
+        listdata->PushBack(list3data1);\r
+\r
+        IconItemNode *list3data2 = new IconItemNode();\r
+        list3data2->imagePath = "/user/res/weather/weather_clear-cloudy.bin";\r
+        list3data2->txt = "周二  多云  19°/24°";\r
+        listdata->PushBack(list3data2);\r
+\r
+        IconItemNode *list3data3 = new IconItemNode();\r
+        list3data3->imagePath = "/user/res/weather/weather_rain.bin";\r
+        list3data3->txt = "  周三  阵雨  -11°/-12°";\r
+        listdata->PushBack(list3data3);\r
+\r
+        IconItemNode *list3data4 = new IconItemNode();\r
+        list3data4->imagePath = "/user/res/weather/weather_sunny.bin";\r
+        list3data4->txt = "周四  晴天  18°/22°";\r
+        listdata->PushBack(list3data4);\r
+\r
+        IconItemNode *list3data5 = new IconItemNode();\r
+        list3data5->imagePath = "/user/res/weather/weather_foggy.bin";\r
+        list3data5->txt = "周五  阴天  16°/20°";\r
+        listdata->PushBack(list3data5);\r
+\r
+        IconItemNode *list3data6 = new IconItemNode();\r
+        list3data6->imagePath = "/user/res/weather/weather_thundershower.bin";\r
+        list3data6->txt = "    周六  雷阵雨  10°/15°";\r
+        listdata->PushBack(list3data6);\r
+\r
+        IconItemNode *list3data7 = new IconItemNode();\r
+        list3data7->imagePath = "/user/res/weather/weather_overcast.bin";\r
+        list3data7->txt = "周日  阴     20°/24°";\r
+        listdata->PushBack(list3data7);\r
+        if (listadapter == nullptr)\r
+        {\r
+            listadapter = new IconAdapter();\r
+        }\r
+        listadapter->SetItemSize(355, 65);\r
+        listadapter->SetImageSize(65, 65);\r
+        listadapter->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+        listadapter->SetData(listdata);\r
+        list->SetAdapter(listadapter);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(list);\r
+        list->SetVisible(true);\r
+    }\r
+\r
+    void FutureWeatherView::DeInitView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+\r
+            delete list;\r
+            list = nullptr;\r
+\r
+            delete listadapter;\r
+            listadapter = nullptr;\r
+\r
+            delete draglistener;\r
+            draglistener = nullptr;\r
+\r
+            listdata->Clear();\r
+            delete listdata;\r
+            listdata = nullptr;\r
+\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+\r
+    void FutureWeatherView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void FutureWeatherView::OnStart()\r
+    {\r
+        View<FutureWeatherPresenter>::OnStart();\r
+        if (container_ == nullptr)\r
+        {\r
+            container_ = new UIViewGroup();\r
+            container_->Resize(466, 466);\r
+            container_->SetTouchable(true);\r
+            container_->SetDraggable(true);\r
+            draglistener = static_cast<UIView::OnDragListener *>(FutureWeatherPresenter::GetInstance());\r
+            container_->SetOnDragListener(draglistener);\r
+        }\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void FutureWeatherView::OnSetUpView()\r
+    {\r
+\r
+        View<FutureWeatherPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void FutureWeatherView::OnTearDownView()\r
+    {\r
+\r
+        View<FutureWeatherPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void FutureWeatherView::OnStop()\r
+    {\r
+\r
+        View<FutureWeatherPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/GetWeatherDataErrorPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/GetWeatherDataErrorPresenter.cpp
new file mode 100644 (file)
index 0000000..6fffd00
--- /dev/null
@@ -0,0 +1,71 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "weather/include/GetWeatherDataErrorPresenter.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static GetWeatherDataErrorPresenter *g_pGetWeatherDataErrorPresenter = nullptr;\r
+\r
+    GetWeatherDataErrorPresenter::GetWeatherDataErrorPresenter()\r
+    {\r
+\r
+        g_pGetWeatherDataErrorPresenter = this;\r
+    }\r
+\r
+    GetWeatherDataErrorPresenter::~GetWeatherDataErrorPresenter()\r
+    {\r
+\r
+        g_pGetWeatherDataErrorPresenter = nullptr;\r
+    }\r
+\r
+    GetWeatherDataErrorPresenter *GetWeatherDataErrorPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pGetWeatherDataErrorPresenter;\r
+    }\r
+\r
+    void GetWeatherDataErrorPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<GetWeatherDataErrorView>::OnStart();\r
+    }\r
+\r
+    void GetWeatherDataErrorPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<GetWeatherDataErrorView>::OnPause();\r
+    }\r
+\r
+    void GetWeatherDataErrorPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<GetWeatherDataErrorView>::OnResume();\r
+    }\r
+\r
+    void GetWeatherDataErrorPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<GetWeatherDataErrorView>::OnStop();\r
+    }\r
+\r
+    bool GetWeatherDataErrorPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_WEATHER);\r
+        }\r
+        return true;\r
+    }\r
+\r
+    bool GetWeatherDataErrorPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/GetWeatherDataErrorView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/GetWeatherDataErrorView.cpp
new file mode 100644 (file)
index 0000000..6279185
--- /dev/null
@@ -0,0 +1,161 @@
+#include "weather/include/GetWeatherDataErrorView.h"\r
+#include "weather/include/GetWeatherDataErrorPresenter.h"\r
+#include "UiConfig.h"\r
+\r
+/* 天气获取数据失败后会调用该视图*/\r
+namespace OHOS\r
+{\r
+\r
+    static GetWeatherDataErrorView *g_pGetWeatherDataErrorView{nullptr};\r
+\r
+    GetWeatherDataErrorView::GetWeatherDataErrorView()\r
+    {\r
+\r
+        g_pGetWeatherDataErrorView = this;\r
+    }\r
+\r
+    GetWeatherDataErrorView::~GetWeatherDataErrorView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pGetWeatherDataErrorView = nullptr;\r
+    }\r
+\r
+    GetWeatherDataErrorView *GetWeatherDataErrorView::GetInstance()\r
+    {\r
+\r
+        return g_pGetWeatherDataErrorView;\r
+    }\r
+\r
+    void GetWeatherDataErrorView::InitView()\r
+    {\r
+        // Add ScrollView to App\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);\r
+        scrollView1_->Resize(466, 466);\r
+        scrollView1_->SetViewId("scrollView1");\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label1_ == nullptr)\r
+        {\r
+            label1_ = new UILabel();\r
+        }\r
+        label1_->SetPosition(113, 268);\r
+        label1_->Resize(240, 70);\r
+        label1_->SetViewId("label1");\r
+        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\r
+\r
+        // Set additional property\r
+        label1_->SetText("未获取到天气信息\n请前往APP更新");\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 scrollView1\r
+        scrollView1_->Add(label1_);\r
+        label1_->SetVisible(true);\r
+\r
+        // Add ImageView to App\r
+        if (image1_ == nullptr)\r
+        {\r
+            image1_ = new UIImageView();\r
+        }\r
+        image1_->SetPosition(168, 127);\r
+        image1_->Resize(130, 130);\r
+        image1_->SetViewId("image1");\r
+        image1_->SetSrc("/user/res/weather/WEATHER_UNKNOWN.bin");\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(image1_);\r
+        image1_->SetVisible(true);\r
+    }\r
+\r
+    void GetWeatherDataErrorView::DeInitView()\r
+    {\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (image1_ != nullptr)\r
+        {\r
+            delete image1_;\r
+            image1_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+    \r
+    void GetWeatherDataErrorView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void GetWeatherDataErrorView::OnStart()\r
+    {\r
+        container_ = new UIViewGroup();\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        // container_容器属性 扩展\r
+        container_->SetPosition(0, 0);\r
+        container_->SetWidth(Screen::GetInstance().GetWidth());\r
+        container_->SetHeight(Screen::GetInstance().GetHeight());\r
+\r
+        draglistener = static_cast<UIView::OnDragListener *>(GetWeatherDataErrorPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        container_->SetOnDragListener(draglistener);\r
+        container_->SetTouchable(true);\r
+        container_->SetDraggable(true);\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void GetWeatherDataErrorView::OnSetUpView()\r
+    {\r
+\r
+        View<GetWeatherDataErrorPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void GetWeatherDataErrorView::OnTearDownView()\r
+    {\r
+\r
+        View<GetWeatherDataErrorPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void GetWeatherDataErrorView::OnStop()\r
+    {\r
+\r
+        View<GetWeatherDataErrorPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/MainWeatherPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/MainWeatherPresenter.cpp
new file mode 100644 (file)
index 0000000..d065faf
--- /dev/null
@@ -0,0 +1,76 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+#include "weather/include/MainWeatherPresenter.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static MainWeatherPresenter *g_pMainWeatherPresenter = nullptr;\r
+\r
+    MainWeatherPresenter::MainWeatherPresenter()\r
+    {\r
+\r
+        g_pMainWeatherPresenter = this;\r
+    }\r
+\r
+    MainWeatherPresenter::~MainWeatherPresenter()\r
+    {\r
+\r
+        g_pMainWeatherPresenter = nullptr;\r
+    }\r
+\r
+    MainWeatherPresenter *MainWeatherPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pMainWeatherPresenter;\r
+    }\r
+\r
+    void MainWeatherPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<MainWeatherView>::OnStart();\r
+    }\r
+\r
+    void MainWeatherPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<MainWeatherView>::OnPause();\r
+    }\r
+\r
+    void MainWeatherPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<MainWeatherView>::OnResume();\r
+    }\r
+\r
+    void MainWeatherPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<MainWeatherView>::OnStop();\r
+    }\r
+\r
+    bool MainWeatherPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
+            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);\r
+            return true;\r
+        }\r
+        else if (event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_WEATHER_REPORT); // 主天气界面从下往上滑进入气象报告界面\r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
+\r
+    bool MainWeatherPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/MainWeatherView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/MainWeatherView.cpp
new file mode 100644 (file)
index 0000000..9ca4e81
--- /dev/null
@@ -0,0 +1,283 @@
+#include "weather/include/MainWeatherView.h"\r
+#include "weather/include/MainWeatherPresenter.h"\r
+#include "UiConfig.h"\r
+/*\r
+当至天气界面时,主动获取最新天气数据。\r
+(此操作静默将进行,获取到则立刻更新显示,获取不到则重试\r
+重试3次无果结束更新)\r
+在加载该视图时,需要加载:1时间,2天气图片,3温度,4天气描述,5,地点,6,温度范围\r
+*/\r
+\r
+namespace OHOS\r
+{\r
+    static ImageAnimatorInfo g_imageAnimator1Info[2] = {\r
+        {PNG_ANIMATOR1_IMAGE, {213, 400}, 40, 40, IMG_SRC_FILE_PATH},\r
+        {PNG_ANIMATOR2_IMAGE, {213, 400}, 40, 40, IMG_SRC_FILE_PATH},\r
+    };\r
+    static MainWeatherView *g_pMainWeatherView{nullptr};\r
+\r
+    MainWeatherView::MainWeatherView()\r
+    {\r
+        Time = GetTime();\r
+        WeatherImag = GetWeatherImage();\r
+        Temperature = GetWeatherTemperature();\r
+        WeatherDescription = GetWeatherDescription();\r
+        WeatherArea = GetWeatherArea();\r
+        MaxandMinTemperature = GetWeatherMaxAndMinTemperature();\r
+        g_pMainWeatherView = this;\r
+    }\r
+\r
+    MainWeatherView::~MainWeatherView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pMainWeatherView = nullptr;\r
+    }\r
+\r
+    MainWeatherView *MainWeatherView::GetInstance()\r
+    {\r
+        return g_pMainWeatherView;\r
+    }\r
+\r
+    // 获取时间\r
+    std::string MainWeatherView::GetTime()\r
+    {\r
+        srand(time(0));\r
+        std::string area[] = {"23:54", "12:00", "7:25"};\r
+        int num = rand() % (sizeof(area) / sizeof(area[0]));\r
+        return area[num];\r
+    }\r
+\r
+    // 获取天气图片\r
+    std::string MainWeatherView::GetWeatherImage()\r
+    {\r
+        int size = sizeof(weather130x130) / sizeof(weather130x130[0]);\r
+        return weather130x130[rand() % size];\r
+    }\r
+    // 获取温度\r
+\r
+    std::string MainWeatherView::GetWeatherTemperature()\r
+    {\r
+        // 使用系统时间作为种子\r
+        srand(time(0));\r
+        int temperature = rand() % 50;\r
+        return std::to_string(temperature) + "°";\r
+    }\r
+    // 获取天气描述\r
+\r
+    std::string MainWeatherView::GetWeatherDescription()\r
+    {\r
+        srand(time(0));\r
+        std::string area[] = {"晴", "雨夹雪", "雷阵雨伴有冰雹"};\r
+        int num = rand() % (sizeof(area) / sizeof(area[0]));\r
+        return area[num];\r
+    }\r
+    // 获取天气地区\r
+\r
+    std::string MainWeatherView::GetWeatherArea()\r
+    {\r
+        srand(time(0));\r
+        std::string area[] = {"北京市东城区", "深圳市福田区", "那然色布斯台音布拉格市那然色布斯台音努如"};\r
+        int num = rand() % (sizeof(area) / sizeof(area[0]));\r
+        return area[num];\r
+    }\r
+    // 获取最高气温和最低气温\r
+\r
+    std::string MainWeatherView::GetWeatherMaxAndMinTemperature()\r
+    {\r
+        // 使用系统时间作为种子\r
+        srand(time(0));\r
+        // 生成随机数\r
+        int maxtemperature = 20 + rand() % 40; // 最高气温:20°~60°\r
+        int mintemperature = -5 + rand() % 20;\r
+        std::string MaxandMinTemperature = "最高" + std::to_string(maxtemperature) + "°" + " " + "最低" + std::to_string(mintemperature) + "°";\r
+        return MaxandMinTemperature;\r
+    }\r
+\r
+    // 初始化标签\r
+    UILabel *MainWeatherView::InitLabel(int x, int y, const char *text, const char *id, int textfont, int lineheight)\r
+    {\r
+        UILabel *label = new UILabel();\r
+        label->SetPosition(x, y);\r
+        label->Resize(200, 30);\r
+        label->SetViewId(id);\r
+        label->SetStyle(STYLE_TEXT_FONT, textfont);\r
+        label->SetStyle(STYLE_LINE_HEIGHT, lineheight);\r
+        label->SetText(text);\r
+        label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label->SetRollSpeed(0);\r
+        label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, textfont);\r
+        label->SetVisible(true);\r
+        return label;\r
+    }\r
+\r
+    void MainWeatherView::InitView(void)\r
+    {\r
+        if (container_ == nullptr)\r
+        {\r
+            return;\r
+        }\r
+        // Add ScrollView to App\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);\r
+        scrollView1_->Resize(466, 466);\r
+        scrollView1_->SetViewId("scrollView1");\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+        scrollView1_->SetVerticalScrollState(false);   // 设置纵向是否可滚动。\r
+        scrollView1_->SetHorizontalScrollState(false); // 设置横向是否可滚动。\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (image1_ == nullptr)\r
+        {\r
+            image1_ = new UIImageView();\r
+        }\r
+        image1_->SetPosition(109, 124);\r
+        image1_->Resize(100, 100);\r
+        image1_->SetViewId("image1");\r
+        image1_->SetSrc(WeatherImag.c_str());\r
+        scrollView1_->Add(image1_);\r
+        image1_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        label1_ = InitLabel(185, 52, Time.c_str(), "label1", 40, 47);\r
+        scrollView1_->Add(label1_);\r
+        /* -------------------------------------------------------------------------- */\r
+        label2_ = InitLabel(249, 126, Temperature.c_str(), "label2", 100, 125);\r
+        scrollView1_->Add(label2_);\r
+        /* -------------------------------------------------------------------------- */\r
+        label3_ = InitLabel(111, 264, WeatherDescription.c_str(), "label3", 35, 41);\r
+        scrollView1_->Add(label3_);\r
+        /* -------------------------------------------------------------------------- */\r
+        label4_ = InitLabel(155, 330, WeatherArea.c_str(), "label4", 26, 30);\r
+        label4_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
+        scrollView1_->Add(label4_);\r
+        /* -------------------------------------------------------------------------- */\r
+        label5_ = InitLabel(158, 368, MaxandMinTemperature.c_str(), "label5", 20, 23);\r
+        label5_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));\r
+        scrollView1_->Add(label5_);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add ImageAnimatorView to App\r
+        if (imageAnimator1_ == nullptr)\r
+        {\r
+            imageAnimator1_ = new UIImageAnimatorView();\r
+        }\r
+        imageAnimator1_->SetPosition(213, 400);\r
+        imageAnimator1_->Resize(40, 40);\r
+        imageAnimator1_->SetViewId("imageAnimator1");\r
+        imageAnimator1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+\r
+        // Set additional property\r
+        imageAnimator1_->SetImageAnimatorSrc(g_imageAnimator1Info, 2, 200);\r
+        imageAnimator1_->SetTimeOfPause(200);\r
+        imageAnimator1_->SetRepeatTimes(1);\r
+        imageAnimator1_->SetReverse(true);\r
+        imageAnimator1_->Start();\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(imageAnimator1_);\r
+        imageAnimator1_->SetVisible(true);\r
+    }\r
+\r
+    void MainWeatherView::DeInitView()\r
+    {\r
+\r
+        if (label1_ != nullptr)\r
+        {\r
+            delete label1_;\r
+            label1_ = nullptr;\r
+        }\r
+        if (label2_ != nullptr)\r
+        {\r
+            delete label2_;\r
+            label2_ = nullptr;\r
+        }\r
+        if (image1_ != nullptr)\r
+        {\r
+            delete image1_;\r
+            image1_ = nullptr;\r
+        }\r
+        if (label3_ != nullptr)\r
+        {\r
+            delete label3_;\r
+            label3_ = nullptr;\r
+        }\r
+        if (label4_ != nullptr)\r
+        {\r
+            delete label4_;\r
+            label4_ = nullptr;\r
+        }\r
+        if (label5_ != nullptr)\r
+        {\r
+            delete label5_;\r
+            label5_ = nullptr;\r
+        }\r
+        if (imageAnimator1_ != nullptr)\r
+        {\r
+            imageAnimator1_->Stop(); // 视图退出后动画停止\r
+            delete imageAnimator1_;\r
+            imageAnimator1_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+    \r
+    void MainWeatherView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void MainWeatherView::OnStart()\r
+    {\r
+        View<MainWeatherPresenter>::OnStart();\r
+        if (container_ == nullptr)\r
+        {\r
+            container_ = new UIViewGroup();\r
+            container_->Resize(466, 466);\r
+            container_->SetTouchable(true);\r
+            container_->SetDraggable(true);\r
+            UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(MainWeatherPresenter::GetInstance());\r
+            container_->SetOnDragListener(draglistener);\r
+        }\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void MainWeatherView::OnSetUpView()\r
+    {\r
+        View<MainWeatherPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void MainWeatherView::OnTearDownView()\r
+    {\r
+\r
+        View<MainWeatherPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void MainWeatherView::OnStop()\r
+    {\r
+\r
+        View<MainWeatherPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherReportPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherReportPresenter.cpp
new file mode 100644 (file)
index 0000000..22ef28c
--- /dev/null
@@ -0,0 +1,78 @@
+#include "AppViewIDs.h"\r
+#include "NativeAbility.h"\r
+\r
+#include "weather/include/WeatherReportPresenter.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    // 当前Presenter属性实例化的内存指针\r
+    static WeatherReportPresenter *g_pWeatherReportPresenter = nullptr;\r
+\r
+    WeatherReportPresenter::WeatherReportPresenter()\r
+    {\r
+\r
+        g_pWeatherReportPresenter = this;\r
+    }\r
+\r
+    WeatherReportPresenter::~WeatherReportPresenter()\r
+    {\r
+\r
+        g_pWeatherReportPresenter = nullptr;\r
+    }\r
+\r
+    WeatherReportPresenter *WeatherReportPresenter::GetInstance()\r
+    {\r
+\r
+        return g_pWeatherReportPresenter;\r
+    }\r
+\r
+    void WeatherReportPresenter::OnStart()\r
+    {\r
+\r
+        Presenter<WeatherReportView>::OnStart();\r
+    }\r
+\r
+    void WeatherReportPresenter::OnPause(void)\r
+    {\r
+\r
+        Presenter<WeatherReportView>::OnPause();\r
+    }\r
+\r
+    void WeatherReportPresenter::OnResume(void)\r
+    {\r
+\r
+        Presenter<WeatherReportView>::OnResume();\r
+    }\r
+\r
+    void WeatherReportPresenter::OnStop(void)\r
+    {\r
+\r
+        Presenter<WeatherReportView>::OnStop();\r
+    }\r
+\r
+    bool WeatherReportPresenter::OnDrag(UIView &view, const DragEvent &event)\r
+    {\r
+\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM &&\r
+            (event.GetDeltaY() > 20) && (event.GetDeltaY() > (2 * MATH_ABS(event.GetDeltaX()))))\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_WEATHER); // 气象报告界面从上往下滑进入主天气界面\r
+            return true;\r
+        }\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP)\r
+        {\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_FUTURE_WEATHER); // 气象报告界面从下往上进入未来天气界面\r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
+\r
+    bool WeatherReportPresenter::OnClick(UIView &view, const ClickEvent &event)\r
+    {\r
+\r
+        // 根据控件id查找是哪个控件触发了点击回调\r
+        // if (strcmp(view.GetViewId(), 控件ID) == 0)\r
+        return true;\r
+    }\r
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherReportView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/weather/src/WeatherReportView.cpp
new file mode 100644 (file)
index 0000000..d3a048a
--- /dev/null
@@ -0,0 +1,426 @@
+#include "weather/include/WeatherReportView.h"\r
+#include "weather/include/WeatherReportPresenter.h"\r
+#include "UiConfig.h"\r
+\r
+namespace OHOS\r
+{\r
+\r
+    const char *IMAGEANIMATOR3 = "/user/res/weather/WEATHER_WINDSPEED.bin";\r
+    const char *IMAGEANIMATOR2 = "/user/res/weather/WEATHER_HUMIDITY.bin";\r
+    const char *IMAGEANIMATOR1 = "/user/res/weather/WEATHER_UVI.bin";\r
+    static ImageAnimatorInfo g_imageAnimator3Info[2] = {\r
+        {IMAGEANIMATOR3, {341, 167}, 60, 60, IMG_SRC_FILE_PATH},\r
+        {"", {341, 167}, 60, 60, IMG_SRC_FILE_PATH},\r
+    };\r
+    static ImageAnimatorInfo g_imageAnimator2Info[2] = {\r
+        {IMAGEANIMATOR2, {207, 167}, 60, 60, IMG_SRC_FILE_PATH},\r
+        {"", {207, 167}, 60, 60, IMG_SRC_FILE_PATH},\r
+    };\r
+\r
+    static ImageAnimatorInfo g_imageAnimator1Info[2] = {\r
+        {IMAGEANIMATOR1, {73, 167}, 60, 60, IMG_SRC_FILE_PATH},\r
+        {"", {73, 167}, 60, 60, IMG_SRC_FILE_PATH},\r
+    };\r
+    static ImageAnimatorInfo g_imageAnimatorInfo[2] = {\r
+        {PNG_ANIMATOR1_IMAGE, {213, 400}, 40, 40, IMG_SRC_FILE_PATH},\r
+        {PNG_ANIMATOR2_IMAGE, {213, 400}, 40, 40, IMG_SRC_FILE_PATH},\r
+    };\r
+    static WeatherReportView *g_pWeatherReportView{nullptr};\r
+\r
+    WeatherReportView::WeatherReportView()\r
+    {\r
+\r
+        g_pWeatherReportView = this;\r
+    }\r
+\r
+    WeatherReportView::~WeatherReportView()\r
+    {\r
+        if (viewInitStatus == true)\r
+        {\r
+            DeInitView();\r
+        }\r
+        g_pWeatherReportView = nullptr;\r
+    }\r
+\r
+    WeatherReportView *WeatherReportView::GetInstance()\r
+    {\r
+\r
+        return g_pWeatherReportView;\r
+    }\r
+\r
+    void WeatherReportView::InitView()\r
+    {\r
+        if (container_ == nullptr)\r
+        {\r
+            container_ = new UIViewGroup();\r
+            container_->SetPosition(0, 0, 466, 466);\r
+            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+            container_->SetTouchable(true);\r
+            container_->SetDraggable(true);\r
+            UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(WeatherReportPresenter::GetInstance());\r
+            container_->SetOnDragListener(draglistener);\r
+        }\r
+\r
+        // Add ScrollView to App\r
+        if (scrollView1_ == nullptr)\r
+        {\r
+            scrollView1_ = new UIScrollView();\r
+        }\r
+        scrollView1_->SetPosition(0, 0);        // widget's left position and top position\r
+        scrollView1_->Resize(466, 466);         // widget's width and height\r
+        scrollView1_->SetViewId("scrollView1"); // Set style\r
+        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+\r
+        // Set additional property\r
+\r
+        // Add to rootView\r
+        container_->Add(scrollView1_);\r
+        scrollView1_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label5_ == nullptr)\r
+        {\r
+            label5_ = new UILabel();\r
+        }\r
+        label5_->SetPosition(173, 52); // widget's left position and top position\r
+        label5_->Resize(120, 35);      // widget's width and height\r
+        label5_->SetViewId("label5");  // Set style\r
+        label5_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        label5_->SetStyle(STYLE_LINE_HEIGHT, 35);\r
+\r
+        // Set additional property\r
+        label5_->SetText("气象报告");\r
+        label5_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label5_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label5_->SetRollSpeed(0);\r
+        label5_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label5_);\r
+        label5_->SetVisible(true);\r
+\r
+        // Add ImageAnimatorView to App\r
+        if (imageAnimator3_ == nullptr)\r
+        {\r
+            imageAnimator3_ = new UIImageAnimatorView();\r
+        }\r
+        imageAnimator3_->SetPosition(341, 167);       // widget's left position and top position\r
+        imageAnimator3_->Resize(60, 60);              // widget's width and height\r
+        imageAnimator3_->SetViewId("imageAnimator3"); // Set style\r
+\r
+        // Set additional property\r
+        imageAnimator3_->SetImageAnimatorSrc(g_imageAnimator3Info, 2, 200);\r
+        imageAnimator3_->SetTimeOfPause(500);\r
+        imageAnimator3_->SetRepeatTimes(1);\r
+        imageAnimator3_->SetReverse(true);\r
+        imageAnimator3_->Start();\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(imageAnimator3_);\r
+        imageAnimator3_->SetVisible(true);\r
+\r
+        // Add ImageAnimatorView to App\r
+        if (imageAnimator2_ == nullptr)\r
+        {\r
+            imageAnimator2_ = new UIImageAnimatorView();\r
+        }\r
+        imageAnimator2_->SetPosition(207, 167);       // widget's left position and top position\r
+        imageAnimator2_->Resize(60, 60);              // widget's width and height\r
+        imageAnimator2_->SetViewId("imageAnimator2"); // Set style\r
+\r
+        // Set additional property\r
+        imageAnimator2_->SetImageAnimatorSrc(g_imageAnimator2Info, 2, 200);\r
+        imageAnimator2_->SetTimeOfPause(500);\r
+        imageAnimator2_->SetRepeatTimes(1);\r
+        imageAnimator2_->SetReverse(true);\r
+        imageAnimator2_->Start();\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(imageAnimator2_);\r
+        imageAnimator2_->SetVisible(true);\r
+\r
+        // Add ImageAnimatorView to App\r
+        if (imageAnimator1_ == nullptr)\r
+        {\r
+            imageAnimator1_ = new UIImageAnimatorView();\r
+        }\r
+        imageAnimator1_->SetPosition(73, 167);        // widget's left position and top position\r
+        imageAnimator1_->Resize(60, 60);              // widget's width and height\r
+        imageAnimator1_->SetViewId("imageAnimator1"); // Set style\r
+\r
+        // Set additional property\r
+        imageAnimator1_->SetImageAnimatorSrc(g_imageAnimator1Info, 2, 200);\r
+        imageAnimator1_->SetTimeOfPause(500);\r
+        imageAnimator1_->SetRepeatTimes(1);\r
+        imageAnimator1_->SetReverse(true);\r
+        imageAnimator1_->Start();\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(imageAnimator1_);\r
+        imageAnimator1_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label6_ == nullptr)\r
+        {\r
+            label6_ = new UILabel();\r
+        }\r
+        label6_->SetPosition(93, 240); // widget's left position and top position\r
+        label6_->Resize(20, 50);       // widget's width and height\r
+        label6_->SetViewId("label6");  // Set style\r
+        label6_->SetStyle(STYLE_TEXT_FONT, 40);\r
+        label6_->SetStyle(STYLE_LINE_HEIGHT, 50);\r
+\r
+        // Set additional property\r
+        label6_->SetText("7");\r
+        label6_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label6_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label6_->SetRollSpeed(0);\r
+        label6_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label6_);\r
+        label6_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label7_ == nullptr)\r
+        {\r
+            label7_ = new UILabel();\r
+        }\r
+        label7_->SetPosition(210, 240); // widget's left position and top position\r
+        label7_->Resize(200, 60);       // widget's width and height\r
+        label7_->SetViewId("label7");   // Set style\r
+        label7_->SetStyle(STYLE_TEXT_FONT, 40);\r
+        label7_->SetStyle(STYLE_LINE_HEIGHT, 50);\r
+\r
+        // Set additional property\r
+        label7_->SetText("1-2");\r
+        label7_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label7_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label7_->SetRollSpeed(0);\r
+        label7_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label7_);\r
+        label7_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label8_ == nullptr)\r
+        {\r
+            label8_ = new UILabel();\r
+        }\r
+        label8_->SetPosition(337, 240); // widget's left position and top position\r
+        label8_->Resize(200, 60);       // widget's width and height\r
+        label8_->SetViewId("label8");   // Set style\r
+        label8_->SetStyle(STYLE_TEXT_FONT, 40);\r
+        label8_->SetStyle(STYLE_LINE_HEIGHT, 50);\r
+\r
+        // Set additional property\r
+        label8_->SetText("75%");\r
+        label8_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label8_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label8_->SetRollSpeed(0);\r
+        label8_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label8_);\r
+        label8_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label9_ == nullptr)\r
+        {\r
+            label9_ = new UILabel();\r
+        }\r
+        label9_->SetPosition(63, 293); // widget's left position and top position\r
+        label9_->Resize(200, 60);      // widget's width and height\r
+        label9_->SetViewId("label9");  // Set style\r
+        label9_->SetStyle(STYLE_TEXT_FONT, 26);\r
+        label9_->SetStyle(STYLE_LINE_HEIGHT, 30);\r
+\r
+        // Set additional property\r
+        label9_->SetText("紫外线");\r
+        label9_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label9_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label9_->SetRollSpeed(0);\r
+        label9_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label9_);\r
+        label9_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label10_ == nullptr)\r
+        {\r
+            label10_ = new UILabel();\r
+        }\r
+        label10_->SetPosition(212, 293); // widget's left position and top position\r
+        label10_->Resize(290, 60);       // widget's width and height\r
+        label10_->SetViewId("label10");  // Set style\r
+        label10_->SetStyle(STYLE_TEXT_FONT, 26);\r
+        label10_->SetStyle(STYLE_LINE_HEIGHT, 30);\r
+\r
+        // Set additional property\r
+        label10_->SetText("风速");\r
+        label10_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label10_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label10_->SetRollSpeed(0);\r
+        label10_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label10_);\r
+        label10_->SetVisible(true);\r
+\r
+        // Add Label to App\r
+        if (label11_ == nullptr)\r
+        {\r
+            label11_ = new UILabel();\r
+        }\r
+        label11_->SetPosition(345, 293); // widget's left position and top position\r
+        label11_->Resize(200, 60);       // widget's width and height\r
+        label11_->SetViewId("label11");  // Set style\r
+        label11_->SetStyle(STYLE_TEXT_FONT, 26);\r
+        label11_->SetStyle(STYLE_LINE_HEIGHT, 30);\r
+\r
+        // Set additional property\r
+        label11_->SetText("湿度");\r
+        label11_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        label11_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label11_->SetRollSpeed(0);\r
+        label11_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(label11_);\r
+        label11_->SetVisible(true);\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add ImageAnimatorView to App\r
+        if (imageAnimator == nullptr)\r
+        {\r
+            imageAnimator = new UIImageAnimatorView();\r
+        }\r
+        imageAnimator->SetPosition(213, 400);\r
+        imageAnimator->Resize(40, 40);\r
+        imageAnimator->SetViewId("imageAnimator1");\r
+        imageAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
+\r
+        // Set additional property\r
+        imageAnimator->SetImageAnimatorSrc(g_imageAnimatorInfo, 2, 200);\r
+        imageAnimator->SetTimeOfPause(200);\r
+        imageAnimator->SetRepeatTimes(1);\r
+        imageAnimator->SetReverse(true);\r
+        imageAnimator->Start();\r
+\r
+        // Add to scrollView1\r
+        scrollView1_->Add(imageAnimator);\r
+        imageAnimator->SetVisible(true);\r
+    }\r
+\r
+    void WeatherReportView::DeInitView()\r
+    {\r
+        if (label5_ != nullptr)\r
+        {\r
+            delete label5_;\r
+            label5_ = nullptr;\r
+        }\r
+        if (imageAnimator3_ != nullptr)\r
+        {\r
+            imageAnimator3_->Stop();\r
+            delete imageAnimator3_;\r
+            imageAnimator3_ = nullptr;\r
+        }\r
+        if (imageAnimator2_ != nullptr)\r
+        {\r
+            imageAnimator2_->Stop();\r
+            delete imageAnimator2_;\r
+            imageAnimator2_ = nullptr;\r
+        }\r
+        if (imageAnimator1_ != nullptr)\r
+        {\r
+            imageAnimator1_->Stop();\r
+            delete imageAnimator1_;\r
+            imageAnimator1_ = nullptr;\r
+        }\r
+        if (imageAnimator != nullptr)\r
+        {\r
+            imageAnimator->Stop();\r
+            delete imageAnimator;\r
+            imageAnimator = nullptr;\r
+        }\r
+        if (label6_ != nullptr)\r
+        {\r
+            delete label6_;\r
+            label6_ = nullptr;\r
+        }\r
+        if (label7_ != nullptr)\r
+        {\r
+            delete label7_;\r
+            label7_ = nullptr;\r
+        }\r
+        if (label8_ != nullptr)\r
+        {\r
+            delete label8_;\r
+            label8_ = nullptr;\r
+        }\r
+        if (label9_ != nullptr)\r
+        {\r
+            delete label9_;\r
+            label9_ = nullptr;\r
+        }\r
+        if (label10_ != nullptr)\r
+        {\r
+            delete label10_;\r
+            label10_ = nullptr;\r
+        }\r
+        if (label11_ != nullptr)\r
+        {\r
+            delete label11_;\r
+            label11_ = nullptr;\r
+        }\r
+        if (scrollView1_ != nullptr)\r
+        {\r
+            delete scrollView1_;\r
+            scrollView1_ = nullptr;\r
+        }\r
+        if (container_ != nullptr)\r
+        {\r
+            container_->RemoveAll();\r
+            delete container_;\r
+            container_ = nullptr;\r
+        }\r
+    }\r
+\r
+    void WeatherReportView::PreLoad(void)\r
+    {\r
+        if (!viewInitStatus)\r
+        {\r
+            InitView();\r
+            viewInitStatus = true;\r
+        }\r
+    }\r
+    void WeatherReportView::OnStart()\r
+    {\r
+        View<WeatherReportPresenter>::OnStart();\r
+        PreLoad();\r
+        RootView::GetInstance()->Add(container_);\r
+    }\r
+\r
+    void WeatherReportView::OnSetUpView()\r
+    {\r
+\r
+        View<WeatherReportPresenter>::OnSetUpView();\r
+        Draw();\r
+    }\r
+\r
+    void WeatherReportView::OnTearDownView()\r
+    {\r
+\r
+        View<WeatherReportPresenter>::OnTearDownView();\r
+        return;\r
+    }\r
+\r
+    void WeatherReportView::OnStop()\r
+    {\r
+\r
+        View<WeatherReportPresenter>::OnStop();\r
+        RootView::GetInstance()->RemoveAll();\r
+        return;\r
+    }\r
+}
\ No newline at end of file