#include "ConfigModel.h"
#include "traing/include/TraingModel.h"
#include <ThemeStyleModel.h>
-namespace OHOS {
+#include "heart_blood/health_service/health_service.h"
+#include "battery_hal.h"
+
+namespace OHOS
+{
ApplistPresenter::ApplistPresenter()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::ApplistPresenter()");
ApplistPresenter::~ApplistPresenter()
{
- if (keyActListenr != nullptr) {
+ if (keyActListenr != nullptr)
+ {
delete keyActListenr;
keyActListenr = nullptr;
}
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnStart()");
Presenter<ApplistView>::OnStart();
- if (keyActListenr == nullptr) {
+ if (keyActListenr == nullptr)
+ {
keyActListenr = new KeyInputListener();
- if (keyActListenr != nullptr) {
+ if (keyActListenr != nullptr)
+ {
RootView::GetInstance()->SetOnKeyActListener(keyActListenr);
- } else {
+ }
+ else
+ {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnStart: new KeyInputListener fail");
}
}
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnResume()");
Presenter<ApplistView>::OnResume();
- if (view_ == nullptr) {
+ if (view_ == nullptr)
+ {
return;
}
const AppItem *itemInfo = model->GetApplistItems();
- for (uint8 i = 0; i < model->GetAppListNum(); i++) {
+ for (uint8 i = 0; i < model->GetAppListNum(); i++)
+ {
view_->AddAppItemToList(itemInfo[i]);
}
view_->RefreshAppList();
Presenter<ApplistView>::OnStop();
}
- bool ApplistPresenter::OnRotate(UIView& view, const RotateEvent& event)
+ bool ApplistPresenter::OnRotate(UIView &view, const RotateEvent &event)
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnRotate");
- UICustomHexagonsList* hexagonsView = dynamic_cast<UICustomHexagonsList *>(&view);
- if (hexagonsView == nullptr) {
+ UICustomHexagonsList *hexagonsView = dynamic_cast<UICustomHexagonsList *>(&view);
+ if (hexagonsView == nullptr)
+ {
return false;
}
-
+
int8_t index = hexagonsView->GetFocusedImgIndex();
uint8_t focusIndex_ = 0;
- if (index >= 0) {
+ if (index >= 0)
+ {
focusIndex_ = static_cast<uint8_t>(index);
}
-
+
HexagonsItemView *itemView = dynamic_cast<HexagonsItemView *>(hexagonsView->GetViewByIndex(focusIndex_));
AppViewId viewId = itemView->GetViewId();
- if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f)) { // 2.0 threshold for beginning transition
+ if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f))
+ { // 2.0 threshold for beginning transition
hexagonsView->StopRotateAnimator();
- //NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
+ // NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
NativeAbility::GetInstance().EnterSlice(viewId, TransitionType::TRANSITION_HEXAGONS);
hexagonsView->ClearFocus();
}
{
UNUSED(event);
AppViewId viewId = VIEW_INVALID;
- char *uid = nullptr;
+ char *uid = nullptr;
TransitionType type = TransitionType::TRANSITION_INVALID;
AppListStyle style = GetCurrentStyle();
- if (style == AppListStyle::FOOTBALL_STYLE) {
+ if (style == AppListStyle::FOOTBALL_STYLE)
+ {
FootballItemView *itemView = dynamic_cast<FootballItemView *>(&view);
viewId = itemView->GetViewId();
uid = (char *)itemView->GetAppUid();
- } else if (style == AppListStyle::HEXAGONS_STYLE) {
+ }
+ else if (style == AppListStyle::HEXAGONS_STYLE)
+ {
HexagonsItemView *itemView = dynamic_cast<HexagonsItemView *>(&view);
- UIHexagonsList* hexagonsView = dynamic_cast<UIHexagonsList *>(itemView->GetParent());
- if (hexagonsView == nullptr || itemView == nullptr) {
+ UIHexagonsList *hexagonsView = dynamic_cast<UIHexagonsList *>(itemView->GetParent());
+ if (hexagonsView == nullptr || itemView == nullptr)
+ {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hexagonsView or itemView is nullptr");
return false;
}
hexagonsView->SetDraggable(false);
hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view
type = TransitionType::TRANSITION_HEXAGONS;
- }
- else if(AppListStyle::ARC_SCALE_LIST_STYLE == style)
+ }
+ else if (AppListStyle::ARC_SCALE_LIST_STYLE == style)
{
- ArcScaleListItemView * itemView = dynamic_cast<ArcScaleListItemView *>(&view);
- if(nullptr == itemView)
+ ArcScaleListItemView *itemView = dynamic_cast<ArcScaleListItemView *>(&view);
+ if (nullptr == itemView)
{
return false;
}
viewId = itemView->GetViewId();
uid = (char *)itemView->GetAppUid();
}
- else {
+ else
+ {
AppItemView *itemView = dynamic_cast<AppItemView *>(&view);
- if (itemView == nullptr) {
+ if (itemView == nullptr)
+ {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "itemView is nullptr", viewId);
return false;
}
viewId = itemView->GetViewId();
uid = (char *)itemView->GetAppUid();
}
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d type = %d", viewId,type);
- if (viewId < VIEW_MAX_INTER_APP) {
- //NativeAbility::GetInstance().ChangeSlice(viewId, type);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d type = %d", viewId, type);
+ if (viewId < VIEW_MAX_INTER_APP)
+ {
+ /*心率Slice需要增加特殊配置*/
+ bool isCharging = get_charge_stat(); // 获取充电状态
+ if (isCharging && viewId == VIEW_HEART_CHART)
+ {
+ HealthState highHealthState;
+ highHealthState.checkType = CHARGE;
+ HealthService::GetInstance()->SetHealthCurrent(highHealthState);
+ viewId = VIEW_CHECK_INVALID;
+ }
NativeAbility::GetInstance().EnterSlice(viewId, type);
return true;
- } else if (viewId == VIEW_EXTERN_APP) {
+ }
+ else if (viewId == VIEW_EXTERN_APP)
+ {
#ifdef JS_ENABLE
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick bundleName = %s", uid);
Want *want = new Want();
void ApplistPresenter::OnItemSelected(int16 index, UIView *view)
{
UNUSED(index);
- if (view != nullptr) {
+ if (view != nullptr)
+ {
itemViewSele = static_cast<AppItemView *>(view);
itemViewSele->SelectedChange();
- if (preItemViewSele != nullptr && preItemViewSele != itemViewSele) {
+ if (preItemViewSele != nullptr && preItemViewSele != itemViewSele)
+ {
preItemViewSele->Reset();
}
preItemViewSele = itemViewSele;
return model->GetCurrentStyle();
}
- ApplistView* ApplistPresenter::GetAppListView()
+ ApplistView *ApplistPresenter::GetAppListView()
{
return view_;
}