114 lines
3.3 KiB
C++
114 lines
3.3 KiB
C++
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
|
|
*
|
|
* Description:
|
|
*
|
|
* Author: wuchangxin
|
|
*
|
|
* Create: 2024-8-24
|
|
*--------------------------------------------------------------------------*/
|
|
#include "TjdUiAppTimerPresenter.h"
|
|
#include "NativeAbility.h"
|
|
#include "TjdUiAppTimerModel.h"
|
|
#include "TjdUiAppTimerView.h"
|
|
#include "dock/input_device.h"
|
|
#include "graphic_service.h"
|
|
#include "sys_config.h"
|
|
#include "TjdUiRegisterManager.h"
|
|
|
|
namespace TJD {
|
|
|
|
TJD_REGIST_NATIVE_MENU(TJD_APP_VIEW_TIMER, TjdUiAppTimerView, TjdUiAppTimerPresenter, IMG_MENU_LIST_MENU_TIMER, STR_ID_12);
|
|
|
|
#define ENABLE_PRINT_INFO 1
|
|
#if ENABLE_PRINT_INFO
|
|
#define static_print_info(...) sys_ui_log_i(__VA_ARGS__) // 一般信息打印宏控制
|
|
#define static_print_warn(...) sys_ui_log_w(__VA_ARGS__) // 警告信息打印一般常开
|
|
#define static_print_error(...) sys_ui_log_e(__VA_ARGS__) // 错误信息打印一般常开
|
|
#define static_print_debug(...) sys_ui_log_d(__VA_ARGS__) // 调试信息打印一般常开
|
|
#else
|
|
#define static_print_info(...)
|
|
#define static_print_warn(...)
|
|
#define static_print_error(...)
|
|
#define static_print_debug(...)
|
|
#endif
|
|
|
|
static TjdUiAppTimerPresenter *g_pv_AppTimerPresenter = nullptr;
|
|
|
|
TjdUiAppTimerPresenter::TjdUiAppTimerPresenter() { g_pv_AppTimerPresenter = this; }
|
|
|
|
TjdUiAppTimerPresenter::~TjdUiAppTimerPresenter() { g_pv_AppTimerPresenter = nullptr; }
|
|
|
|
TjdUiAppTimerPresenter &TjdUiAppTimerPresenter::GetInstance(void) { return *g_pv_AppTimerPresenter; }
|
|
|
|
void TjdUiAppTimerPresenter::OnStart()
|
|
{
|
|
TjdUiCommonOnKeyListener::GetInstance()->SetOnKeyActListener(this, KeyModelType::APP_KEY_TYPE);
|
|
}
|
|
|
|
void TjdUiAppTimerPresenter::OnStop()
|
|
{
|
|
TjdUiCommonOnKeyListener::GetInstance()->ClearOnKeyActListener(KeyModelType::APP_KEY_TYPE);
|
|
}
|
|
|
|
void TjdUiAppTimerPresenter::OnPause()
|
|
{
|
|
Presenter::OnPause();
|
|
}
|
|
|
|
void TjdUiAppTimerPresenter::OnResume()
|
|
{
|
|
Presenter::OnResume();
|
|
}
|
|
|
|
bool TjdUiAppTimerPresenter::OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event)
|
|
{
|
|
std::string viewId = view.GetViewId();
|
|
if (viewId.empty()) {
|
|
return false;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void TjdUiAppTimerPresenter::ViewExitEvent(bool isSwipe)
|
|
{
|
|
auto timerView = TjdUiAppTimerView::GetInstance();
|
|
|
|
switch (TjdUiAppTimerView::currentViewIndex_) {
|
|
case TIMER_MAIN_VIEW:
|
|
OHOS::NativeAbility::GetInstance().ChangePreSlice();
|
|
break;
|
|
case TIMER_RUNNING_VIEW:
|
|
if (GetTimerStatus())
|
|
{
|
|
auto timerRunningView = TimerRunningView::GetInstance();
|
|
timerRunningView->GetCountDownLabel()->SetVisible(false);
|
|
timerRunningView->GetRemindLabel()->SetVisible(true);
|
|
timerRunningView->CreateRunningTimer();
|
|
return;
|
|
}
|
|
else
|
|
timerView->ShowView(TIMER_MAIN_VIEW);
|
|
break;
|
|
case TIMER_CUSTOM_SETTING_VIEW:
|
|
timerView->ShowView(TIMER_MAIN_VIEW);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
bool TjdUiAppTimerPresenter::OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event)
|
|
{
|
|
if(!TjdUiCommonOnKeyListener::CheckIsExitEvent(event)) {
|
|
return true;
|
|
}
|
|
ViewExitEvent(false);
|
|
return true;
|
|
}
|
|
|
|
void TjdUiAppTimerPresenter::OnClickTrans(OHOS::UIView &view) {}
|
|
|
|
} // namespace TJD
|