126 lines
3.7 KiB
C++
126 lines
3.7 KiB
C++
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
|
|
*
|
|
* Description:
|
|
*
|
|
* Author: huangshuyi
|
|
*
|
|
* Create: 2024-4
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
#include "View.h"
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "ChangeSliceListener.h"
|
|
#include "NativeAbility.h"
|
|
#include "TjdUiAppIds.h"
|
|
#include "TjdUiAppMainView.h"
|
|
#include "TjdUiMessageParticularView.h"
|
|
#include "TjdUiMessageTotalPresenter.h"
|
|
#include "TjdUiRegisterManager.h"
|
|
#include "TjdUiScreenManage.h"
|
|
#include "TransitionType.h"
|
|
#include "components/root_view.h"
|
|
#include "dock/input_device.h"
|
|
#include "sys_config.h"
|
|
using namespace OHOS;
|
|
namespace TJD {
|
|
|
|
TJD_REGIST_NATIVE_MENU(TJD_APP_VIEW_MESSAGE_TOTAL, TjdUiMessageTotalView, TjdUiMessageTotalPresenter,
|
|
IMG_MENU_LIST_MENU_MESSAGE, STR_ID_09);
|
|
|
|
#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 TjdUiMessageTotalPresenter *g_pMessageTotalPresenter = nullptr;
|
|
|
|
TjdUiMessageTotalPresenter::TjdUiMessageTotalPresenter() { g_pMessageTotalPresenter = this; }
|
|
|
|
TjdUiMessageTotalPresenter::~TjdUiMessageTotalPresenter() { g_pMessageTotalPresenter = nullptr; }
|
|
|
|
TjdUiMessageTotalPresenter *TjdUiMessageTotalPresenter::GetInstance(void) { return g_pMessageTotalPresenter; }
|
|
|
|
void TjdUiMessageTotalPresenter::OnStart()
|
|
{
|
|
TjdUiCommonOnKeyListener::GetInstance()->SetOnKeyActListener(this, KeyModelType::APP_KEY_TYPE);
|
|
static_print_debug("TjdUiMessageTotalPresenter::OnStart\n");
|
|
}
|
|
|
|
void TjdUiMessageTotalPresenter::OnPause()
|
|
{
|
|
Presenter::OnPause();
|
|
static_print_debug("TjdUiMessageTotalPresenter::OnPause\n");
|
|
}
|
|
|
|
void TjdUiMessageTotalPresenter::OnResume()
|
|
{
|
|
Presenter::OnResume();
|
|
static_print_debug("TjdUiMessageTotalPresenter::OnResume\n");
|
|
}
|
|
|
|
bool TjdUiMessageTotalPresenter::OnDragStart(OHOS::UIView &view, const OHOS::DragEvent &event)
|
|
{
|
|
static_print_debug("drag start\n");
|
|
|
|
return false;
|
|
}
|
|
|
|
bool TjdUiMessageTotalPresenter::OnDragEnd(OHOS::UIView &view, const OHOS::DragEvent &event)
|
|
{
|
|
static_print_debug("drag end\n");
|
|
return false;
|
|
}
|
|
|
|
bool TjdUiMessageTotalPresenter::OnDrag(OHOS::UIView &view, const OHOS::DragEvent &event)
|
|
{
|
|
static_print_debug("draging\n");
|
|
return false;
|
|
}
|
|
|
|
void TjdUiMessageTotalPresenter::OnSwipe(UISwipeView &view)
|
|
{
|
|
int page = view.GetCurrentPage();
|
|
static_print_debug("swipe done page:%d\n", page);
|
|
}
|
|
|
|
void TjdUiMessageTotalPresenter::OnStop()
|
|
{
|
|
TjdUiCommonOnKeyListener::GetInstance()->ClearOnKeyActListener(KeyModelType::APP_KEY_TYPE);
|
|
static_print_debug("TjdUiMessageTotalPresenter::OnStop\n");
|
|
}
|
|
|
|
bool TjdUiMessageTotalPresenter::OnClick(UIView &view, const ClickEvent &event) { return true; }
|
|
|
|
bool TjdUiMessageTotalPresenter::OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event)
|
|
{
|
|
if (!TjdUiCommonOnKeyListener::CheckIsExitEvent(event)) {
|
|
return true;
|
|
}
|
|
|
|
switch (TjdUiMessageParticularView::preSliceId) {
|
|
case TJD_APP_VIEW_MAIN:
|
|
OHOS::NativeAbility::GetInstance().ChangeSlice(TJD_APP_VIEW_MAIN);
|
|
break;
|
|
case TJD_APP_VIEW_MESSAGE_TOTAL:
|
|
OHOS::NativeAbility::GetInstance().ChangeSlice(TJD_APP_VIEW_LIST);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
} // namespace TJD
|