mcu_hi3321_watch/tjd/ui/app/calculator/TjdUiAppCalculatorPresenter.cpp
2025-05-26 20:15:20 +08:00

85 lines
2.4 KiB
C++

#include "TjdUiAppCalculatorPresenter.h"
#include "NativeAbility.h"
#include "TjdUiAppCalculatorModel.h"
#include "TjdUiAppCalculatorView.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_CALCULATOR, TjdUiAppCalculatorView, TjdUiAppCalculatorPresenter, IMG_MENU_LIST_MENU_CALCULATOR, STR_ID_15);
#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 TjdUiAppCalculatorPresenter *g_pv_AppCalculatorPresenter = nullptr;
TjdUiAppCalculatorPresenter::TjdUiAppCalculatorPresenter() { g_pv_AppCalculatorPresenter = this; }
TjdUiAppCalculatorPresenter::~TjdUiAppCalculatorPresenter() { g_pv_AppCalculatorPresenter = nullptr; }
TjdUiAppCalculatorPresenter &TjdUiAppCalculatorPresenter::GetInstance(void) { return *g_pv_AppCalculatorPresenter; }
void TjdUiAppCalculatorPresenter::OnStart()
{
TjdUiCommonOnKeyListener::GetInstance()->SetOnKeyActListener(this, KeyModelType::APP_KEY_TYPE);
}
void TjdUiAppCalculatorPresenter::OnStop()
{
TjdUiCommonOnKeyListener::GetInstance()->ClearOnKeyActListener(KeyModelType::APP_KEY_TYPE);
}
void TjdUiAppCalculatorPresenter::OnPause()
{
Presenter::OnPause();
}
void TjdUiAppCalculatorPresenter::OnResume()
{
Presenter::OnResume();
}
bool TjdUiAppCalculatorPresenter::OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event)
{
std::string viewId = view.GetViewId();
if (viewId.empty()) {
return false;
}
return false;
}
void TjdUiAppCalculatorPresenter::ViewExitEvent(bool isSwipe)
{
OHOS::NativeAbility::GetInstance().ChangePreSlice();
}
bool TjdUiAppCalculatorPresenter::OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event)
{
if(!TjdUiCommonOnKeyListener::GetInstance()->CheckIsExitEvent(event)) {
return true;
}
ViewExitEvent(false);
return true;
}
void TjdUiAppCalculatorPresenter::OnClickTrans(OHOS::UIView &view)
{
}
} // namespace TJD