/*---------------------------------------------------------------------------- * Copyright (c) TJD Technologies Co., Ltd. 2025. All rights reserved. * * Description: TjdUiAppPhonePresenter.h * * Author: luziquan@ss-tjd.com * * Create: 2025-08-16 *--------------------------------------------------------------------------*/ #ifndef TJD_UI_APP_PHONE_PRESENTER_H #define TJD_UI_APP_PHONE_PRESENTER_H #include "Presenter.h" #include "TjdUiScreenDrag.h" #include "components/root_view.h" #include "components/ui_slider.h" #include "components/ui_view.h" #include "graphic_timer.h" #include #include namespace TJD { #define BTN_DIAL_VIEW_ID "btn_dial_view" #define BTN_CONTACT_VIEW_ID "btn_contact_view" #define BTN_CALL_LOG_VIEW_ID "btn_call_log_view" enum CallLogStatus { CALL_LOG_STATUS_OUT = 0, CALL_LOG_STATUS_IN, CALL_LOG_STATUS_MISS, CALL_LOG_STATUS_UNKNOWN }; struct PhoneListCaseInfo { std::string name; std::string number; int16_t index; CallLogStatus status; }; enum PhoneViewIndex { PHONE_MAIN_LIST = 0, // 主页面功能列表 PHONE_CONTACT, // 通讯录 PHONE_CALL_LOG, // 通话记录 PHONE_DIAL, // 拨号界面 PHONE_DISCONNECT, // 尚未连接 PHONE_UNKNOWN }; class TjdUiAppPhoneView; class TjdUiAppPhonePresenter : public OHOS::Presenter, public OHOS::RootView::OnKeyActListener, public OHOS::UIView::OnClickListener, public OHOS::UIView::OnRotateListener, public OHOS::UIView::OnTouchListener, public OHOS::UIView::OnLongPressListener, public TjdUiScreenDragListener { public: TjdUiAppPhonePresenter(); virtual ~TjdUiAppPhonePresenter(); static TjdUiAppPhonePresenter *GetInstance(void); void OnStart() override; void OnStop() override; bool OnClick(OHOS::UIView &view, const OHOS::ClickEvent &event) override; bool OnPress(OHOS::UIView &view, const OHOS::PressEvent &event) override; bool OnRelease(OHOS::UIView &view, const OHOS::ReleaseEvent &event) override; bool OnLongPress(OHOS::UIView &view, const OHOS::LongPressEvent &event) override; void ScreenDragEventCallback(OHOS::UIView &view, const OHOS::DragEvent &event) override { ViewExitEvent(true); } bool OnKeyAct(OHOS::UIView &view, const OHOS::KeyEvent &event) override; void ViewExitEvent(bool isSwipe); std::list &GetContactListCase() { return contactListCase_; } std::list &GetCallLogListCase() { return callLogListCase_; } void ClickDialEvent(); void ClickContactEvent(); void ClickCallLogEvent(); void ClickDialKeyEvent(std::string key, bool isPopup); void ClickDialCallEvent(int index); void ClearDialNumber(); void DeleteJumpTimer(); bool GetNeedRefreshCallLog() { return needRefreshCallLog_; } bool GetNeedRefreshContact() { return needRefreshContact_; } void SetNeedRefreshCallLog(bool needRefresh) { needRefreshCallLog_ = needRefresh; } void SetNeedRefreshContact(bool needRefresh) { needRefreshContact_ = needRefresh; } private: void UpdateCallLogList(); void UpdateContactsList(); void StartJumpTimer(PhoneViewIndex jumpView); osTimerId_t jumpTimerId_{nullptr}; osTimerId_t volumeHideTimerId_{nullptr}; osTimerId_t g_startCounting_{nullptr}; std::list contactListCase_; std::list callLogListCase_; std::string dialNumber_; std::string callDuration; bool needRefreshCallLog_{true}; bool needRefreshContact_{true}; }; } // namespace TJD #endif