${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/Maingoalview.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalother.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalhint.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/goal/src/goalControlView.cpp
#${CMAKE_CURRENT_SOURCE_DIR} /service/acc_service.c
)
if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES)
WEATHER,
TRAINING,
ACTIVITY,
- SETCARD,
+ SETCARD,
+ GOAL,
MAX_CARD,
} CardId;
--- /dev/null
+#ifndef GOAL_CONTROL_VIEW_H
+#define GOAL_CONTROL_VIEW_H
+/*该视图主要放在主视图*/
+
+#include "components/root_view.h"
+#include "components/ui_card_page.h"
+#include "wearable_log.h"
+#include "goal/include/Maingoalview.h"
+namespace OHOS
+{
+ class goalControlView : public UICardPage
+ {
+ public:
+ goalControlView();
+ virtual ~goalControlView();
+ bool InitView(void);
+ void PreLoad(void) override;
+ void UnLoad(void) override;
+
+ private:
+ void ClearAll(void);
+ MaingoalrView *maingoalView{nullptr};
+ UISwipeView::OnSwipeListener *goalOnSwipeListener{nullptr};
+ bool viewiInitStatus{false};
+ };
+}
+#endif
\ No newline at end of file
void ClearAll();
bool GetInitViewState(void);
void GoalViewrefresh();
-
+
private:
UILabelExt *InitLabelExt(int x, int y, int w, int h, const char *text, int textfont, int lineheight);
UILabelExt *goalTitle{nullptr}; // 目标
UILabelExt *goalstepLabel{nullptr}; // 目标
UILabelExt *nowstepLabel{nullptr}; // 完成
-
+ UIImageView* circleProgressimage{nullptr};
UIImageAnimatorView *PullUpAnimatorView{nullptr}; // 上拉动画
UIImageAnimatorView *stepAnimatorView{nullptr}; // 走路动画
const char **PullUpPathsArray{nullptr};
--- /dev/null
+#include "goal/include/goalControlView.h"
+#include "goal/include/Maingoalpresenter.h"
+namespace OHOS
+{
+ goalControlView::goalControlView()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "goalControlView::goalControlView");
+ SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+ }
+
+ goalControlView::~goalControlView()
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "goalControlView::~goalControlView");
+ ClearAll();
+ }
+
+ void goalControlView::ClearAll(void)
+ {
+ if (viewiInitStatus == true)
+ {
+ RemoveAll();
+ if (maingoalView != nullptr)
+ {
+ if (goalOnSwipeListener != nullptr)
+ {
+ delete goalOnSwipeListener;
+ goalOnSwipeListener = nullptr;
+ }
+
+ if (maingoalView != nullptr)
+ {
+ delete maingoalView;
+ maingoalView = nullptr;
+ }
+ }
+ }
+ }
+
+ bool goalControlView::InitView(void)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "goalControlView::InitView");
+ maingoalView = new MaingoalrView();
+ if (maingoalView == nullptr)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "WeatherView::new mainweatherView fail!");
+ return false;
+ }
+
+
+ UISwipeView *goalSwipView = dynamic_cast<UISwipeView *>(maingoalView->GetGoalPageView());
+ if (goalSwipView == nullptr)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "mainWeatherView->MainWeatherViewInit() == nullptr!!");
+ return false;
+ }
+
+ goalOnSwipeListener = static_cast<UISwipeView::OnSwipeListener *>(new GoalControlViewOnSwipeListener());
+ if (goalOnSwipeListener == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weatherOnSwipeListener new fail");
+ return false;
+ }
+ goalSwipView->SetOnSwipeListener(goalOnSwipeListener);
+ Add(goalSwipView);
+
+ return true;
+ }
+
+ void goalControlView::PreLoad(void)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "goalControlView::PreLoad");
+ if (!viewiInitStatus)
+ {
+ InitView();
+ viewiInitStatus = true;
+ }
+ }
+
+ void goalControlView::UnLoad(void)
+ {
+ // Weather's usage scenes is complicated, so we do not release it's resources inner slice.
+ }
+
+}
\ No newline at end of file
{
int stepgoal= ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_SPORTS_GOAL_STEPCOUNT);
int stepdata= OHOS::ActivityModel::GetInstance()->GetStepCounter();
- return stepdata/stepgoal *100;
+ int value= stepdata/stepgoal *100;
+ if(value>100)
+ {
+ value=100;
+ }
+ return value;
}
char stepgoalstr[20];
char* GoalModel::getstepGoal()
{
nowstepLabel->SetText(GoalModel::GetInstance().getstepnew());
goalstepLabel->SetText(GoalModel::GetInstance().getstepGoal());
-
circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue());
+ RootView::GetInstance()->Invalidate();
+
}
void GoalView::ClearAll()
delete PullUpAnimatorView;
PullUpAnimatorView = nullptr;
}
+ if (circleProgressimage != nullptr)
+ {
+
+ delete circleProgressimage;
+ circleProgressimage = nullptr;
+ }
+
FreeImagePathsArray(PullUpPathsArray, PULLUP_ANIMATOR_VIEW_NUM_FRAMES);
FreeImagePathsArray(PullUpPathsArray, 20);
/*----------------------------------------------------------------------------- */
+ // Add ImageView to App
+ if (circleProgressimage == nullptr) {
+ circleProgressimage = new UIImageView();
+ }
+ circleProgressimage->SetPosition(28, 80); // widget's left position and top position
+ circleProgressimage->Resize(100, 100); // widget's width and height
+ circleProgressimage->SetViewId("image5");// Set style
+
+
+ char* image5imagesPath = "/user/res/step/step_b.bin";
+
+ circleProgressimage->SetSrc(image5imagesPath);
+
+ // Add to rootView
+
+ circleProgressimage->SetVisible(true);
+ if(circleProgressimage!=NULL)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "circleProgressimage");
+ }
+
+
if (circleProgress1_ == nullptr) {
- circleProgress1_ = new UICircleProgress();
+ circleProgress1_ = new UICircleProgress();
}
- circleProgress1_->SetPosition(0, 0); // widget's left position and top position
+ circleProgress1_->SetPosition(-1, 0); // widget's left position and top position
circleProgress1_->Resize(466, 466); // widget's width and height
circleProgress1_->SetViewId("circleProgress1");// Set style
circleProgress1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
- circleProgress1_->SetStyle(STYLE_BORDER_WIDTH, 10);
// Set additional property
// Set BackgroundStyle
circleProgress1_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
- circleProgress1_->SetBackgroundStyle(STYLE_LINE_WIDTH, 16);
+ circleProgress1_->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0x00);
+ circleProgress1_->SetBackgroundStyle(STYLE_LINE_HEIGHT, 200);
+ circleProgress1_->SetBackgroundStyle(STYLE_LINE_WIDTH, 21);
+ circleProgress1_->SetBackgroundStyle(STYLE_LINE_OPA, 0x00);
+
+
// Set ForegroundStyle
- circleProgress1_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff2195f6);
- circleProgress1_->SetForegroundStyle(STYLE_BORDER_WIDTH, 80);
- circleProgress1_->SetForegroundStyle(STYLE_BORDER_RADIUS, 16);
- circleProgress1_->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff);
+ circleProgress1_->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xff2195F6);
+ circleProgress1_->SetForegroundStyle(STYLE_BORDER_WIDTH, 200);
+ circleProgress1_->SetForegroundStyle(STYLE_BORDER_RADIUS, 200);
+ circleProgress1_->SetForegroundStyle(STYLE_BORDER_COLOR, 0xff000000);
circleProgress1_->SetForegroundStyle(STYLE_LINE_HEIGHT, 35);
circleProgress1_->SetForegroundStyle(STYLE_LINE_COLOR, 0xff45ff5d);
- circleProgress1_->SetForegroundStyle(STYLE_LINE_WIDTH, 16);
- circleProgress1_->SetCenterPosition(224, 220);
- circleProgress1_->SetRadius(195);
+ circleProgress1_->SetForegroundStyle(STYLE_LINE_WIDTH, 20);
+ circleProgress1_->SetCenterPosition(233, 229);
+ circleProgress1_->SetRadius(205);
circleProgress1_->SetStartAngle(40);
circleProgress1_->SetEndAngle(320);
- circleProgress1_->SetValue(1);
+ circleProgress1_->SetValue(GoalModel::GetInstance().getstepvalue());
+ circleProgress1_->SetBackgroundImagePosition(36, 26);
/*----------------------------------------------------------------------------- */
goalPathsArray = CreateImagePathsArray(stepPaths, "bin", 20);
PullUpAnimatorView->Start();
}
/* -------------------------------- 将组件添加到根视图 ------------------------------- */
+ Add(circleProgressimage);
+
Add(circleProgress1_);
+
Add(goalstepLabel);
Add(nowstepLabel);
Add(PullUpAnimatorView);
Add(goalTitle);
Add(stepAnimatorView);
+
viewInitStatus = true;
return true;
#include "traing/training_card/include/Training_CardView.h"
// #include "ApplistCardView.h"
#include "weather/include/WeatherControlView.h"
+#include "goal/include/goalControlView.h"
+
#include "message/include/MessageCardView.h"
#include "set_card/include/SetMainView.h"
namespace OHOS
UICardPage *InitMusicPlayerPage(void);
UICardPage *InitBloodOxygenPage(void);
UICardPage *InitWeatherPage(void);
+ UICardPage *InitGoalPage(void);
+
UICardPage *InitTrainingPage(void);
UICardPage *InitApplistPage(void);
UICardPage *InitSetMainPage(void);
CompassControlView *compassControlView{nullptr};
HeartRateView *heartRateView{nullptr};
BloodCardView *bloodView{nullptr};
+
WeatherControlView *weatherControlView{nullptr};
+ goalControlView *GoalControlView{nullptr};
+
Training_CardView *traingView{nullptr};
SetMainView *setmainView{nullptr};
+
// ApplistCardView *applistCardView{nullptr};
UIButton *changebut{nullptr};
UIImageView *disturbIcon{nullptr}; // 勿扰图标
{TRAINING, PNG_SET_CARD_TRAIN},\r
{ACTIVITY, PNG_SET_CARD_ACTIVITY},\r
{SETCARD, PNG_SET_CARD_ACTIVITY},\r
+ {GOAL, PNG_SET_CARD_TRAIN},\r
};\r
/*自定义map?*/\r
const DialInfo dialInfoMap[] = {\r
{WEATHER, &MainViewSample::InitWeatherPage},
{TRAINING, &MainViewSample::InitTrainingPage},
{ACTIVITY, &MainViewSample::InitActivityPage},
- {SETCARD, &MainViewSample::InitSetMainPage},
+ {SETCARD, &MainViewSample::InitSetMainPage},
+ {GOAL, &MainViewSample::InitGoalPage},
};
MainViewSample::MainViewSample()
{
delete bloodView;
bloodView = nullptr;
}
+
if (traingView != nullptr)
{
traingView->RemoveAll();
- delete traingView;
+ delete traingView;
traingView = nullptr;
+ }
+ if (GoalControlView != nullptr)
+ {
+ GoalControlView->RemoveAll();
+ delete GoalControlView;
+ GoalControlView = nullptr;
}
// if (applistCardView != nullptr)
// {
}
return traingView;
}
+
// 主界面天气卡片
UICardPage *MainViewSample::InitWeatherPage(void)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainweatherView new fail");
return nullptr;
}
- return weatherControlView;
+ return weatherControlView;
+ }
+
+ UICardPage *MainViewSample::InitGoalPage(void)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::InitWeatherPage");
+ GoalControlView = new goalControlView();
+ if (GoalControlView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainweatherView new fail");
+ return nullptr;
+ }
+ return GoalControlView;
}
// 主界面心率卡片
UICardPage *MainViewSample::InitHeartRatePage(void)
${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include
${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include
${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/goal/include
${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps
${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include
${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits
${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/player/include
${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativeui/bluetooth/include
${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativelauncher/include
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../fd230app/nativeui/goal/include
${CMAKE_CURRENT_SOURCE_DIR}/../../nativeapp/nativelauncher/include
${CMAKE_CURRENT_SOURCE_DIR}/../../ohos_deps
${CMAKE_CURRENT_SOURCE_DIR}/../../CustomUIComponentTool/uicomponents/
#include "producttest/include/testcat1.h"
#endif
#include <cywee_hal.h>
+
+#include "goalview.h"
//#include "Systemupgrade.h"
namespace OHOS {
calories_history_save();
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "保存每小时距离数据");
distances_history_save();
+}
-
+void MsgCenterNotifystepProc(const Topic topic, Request* req)
+{
+ unused(req);
+ if(OHOS::GoalView::GetInstance())
+ {
+ OHOS::GoalView::GetInstance()->GoalViewrefresh();
+ }
+ // The alarm notification is not displayed if the incoming call notification is already being processed
+ // cywee_save_data();
}
static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
{TOPIC_EVENT_ALARM_RING, MsgCenterNotifyAlarmProc},
{TOPIC_EVENT_ON_TIME, MsgCenterNotifyONtimeProc},//增加整点保存数据
+ {TOPIC_EVENT_STEPDATA_UPDATE, MsgCenterNotifystepProc},
{TOPIC_EVENT_NEXTDAY_UPDATE, MsgCenterNotifyNextDayProc},
{TOPIC_EVENT_HFP_INCOMMING, MsgCenterNotifyHfpIncomingProc},
{TOPIC_EVENT_HFP_PHONE_ACTIVE, MsgCenterNotifyHfpPhoneProc},
--- /dev/null
+version https://git-lfs.github.com/spec/v1
+oid sha256:aa5fbb908c94f811a58664a8d03f44091e4098e6de2b0609101af23c74269c84
+size 98280