172 lines
4.7 KiB
C++
172 lines
4.7 KiB
C++
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2025. All rights reserved.
|
|
*
|
|
* Description: TjdUiAppPhoneView.h
|
|
*
|
|
* Author: luziquan@ss-tjd.com
|
|
*
|
|
* Create: 2025-08-16
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
#ifndef TJD_UI_APP_PHONE_VIEW_H
|
|
#define TJD_UI_APP_PHONE_VIEW_H
|
|
|
|
#include "TjdUiAppPhoneAdapter.h"
|
|
#include "TjdUiAppPhonePresenter.h"
|
|
#include "TjdUiMsgCenter.h"
|
|
#include "TjdUiMultiLanguageExt.h"
|
|
#include "View.h"
|
|
#include "components/tjd_ui_transform_list_group.h"
|
|
#include "components/ui_button.h"
|
|
#include "components/ui_image_animator.h"
|
|
#include "components/ui_image_view.h"
|
|
#include "components/ui_label_ext.h"
|
|
#include "components/ui_list.h"
|
|
#include "components/ui_scroll_view.h"
|
|
#include "components/ui_scroll_view_nested.h"
|
|
#include "components/ui_slider.h"
|
|
#include "notification_manager.h"
|
|
#include <list>
|
|
#include <unordered_map>
|
|
namespace TJD {
|
|
|
|
class PhoneUIScrollView : public OHOS::UIScrollViewNested
|
|
{
|
|
public:
|
|
PhoneUIScrollView() {}
|
|
~PhoneUIScrollView() {}
|
|
bool OnDragStartEvent(const OHOS::DragEvent &event) override;
|
|
bool OnDragEvent(const OHOS::DragEvent &event) override;
|
|
bool OnDragEndEvent(const OHOS::DragEvent &event) override;
|
|
|
|
private:
|
|
bool isOnStart_{false};
|
|
};
|
|
|
|
class PhoneViewBase : public OHOS::UIScrollView
|
|
{
|
|
public:
|
|
PhoneViewBase() { SetHorizontalScrollState(false); }
|
|
virtual ~PhoneViewBase() {}
|
|
virtual void ShowView() { SetVisible(true); };
|
|
virtual void HideView() { SetVisible(false); };
|
|
};
|
|
|
|
class PhoneMainListView : public PhoneViewBase
|
|
{
|
|
public:
|
|
PhoneMainListView();
|
|
~PhoneMainListView() { RemoveAll(); }
|
|
void ShowView() override;
|
|
void HideView() override;
|
|
|
|
private:
|
|
OHOS::UILabelExt title_;
|
|
TjdUITransformListGroupAdapter<PhoneListItemInfo, PhoneMainItemView, std::list<PhoneListItemInfo>> *adapter_{
|
|
nullptr};
|
|
TjdUITransformListGroup *listGroup_{nullptr};
|
|
std::list<PhoneListItemInfo> listInfo_;
|
|
};
|
|
|
|
class PhoneContactView : public PhoneViewBase
|
|
{
|
|
public:
|
|
PhoneContactView();
|
|
~PhoneContactView();
|
|
void ShowView() override;
|
|
void HideView() override;
|
|
|
|
private:
|
|
void RefreshContactList();
|
|
OHOS::UIViewGroup errorView_;
|
|
OHOS::UILabelExt errorViewTitle_;
|
|
OHOS::UILabelExt title_;
|
|
OHOS::UIImageView bg_;
|
|
OHOS::UILabelExt desc_;
|
|
|
|
TjdUITransformListGroupAdapter<PhoneListItemInfo, PhoneContactItemView, std::list<PhoneListItemInfo>> *adapter_{
|
|
nullptr};
|
|
TjdUITransformListGroup *listGroup_{nullptr};
|
|
std::list<PhoneListItemInfo> listInfo_;
|
|
};
|
|
|
|
class PhoneCallLogView : public PhoneViewBase
|
|
{
|
|
public:
|
|
PhoneCallLogView();
|
|
~PhoneCallLogView();
|
|
void ShowView() override;
|
|
void HideView() override;
|
|
|
|
private:
|
|
void RefreshCallLogList();
|
|
OHOS::UIViewGroup errorView_;
|
|
OHOS::UILabelExt errorViewTitle_;
|
|
OHOS::UILabelExt title_;
|
|
OHOS::UIImageView bg_;
|
|
OHOS::UILabelExt desc_;
|
|
|
|
TjdUITransformListGroupAdapter<PhoneListItemInfo, PhoneCallLogItemView, std::list<PhoneListItemInfo>> *adapter_{
|
|
nullptr};
|
|
TjdUITransformListGroup *listGroup_{nullptr};
|
|
std::list<PhoneListItemInfo> listInfo_;
|
|
|
|
int callLogStatusResId[CallLogStatus::CALL_LOG_STATUS_UNKNOWN];
|
|
};
|
|
|
|
class PhoneDialView : public PhoneViewBase
|
|
{
|
|
public:
|
|
PhoneDialView();
|
|
~PhoneDialView();
|
|
void SetNumber(std::string &number);
|
|
|
|
private:
|
|
const std::unordered_map<size_t, int> fontSizeMap = {{12, 44}, {13, 41}, {14, 38}, {15, 36}, {16, 33},
|
|
{17, 31}, {18, 29}, {19, 28}, {20, 26}};
|
|
OHOS::UILabel dialEdit_;
|
|
OHOS::UIButton dialBtn_[12];
|
|
std::string dialId_[12]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "0", "-"};
|
|
};
|
|
|
|
class PhoneDisConnectView : public PhoneViewBase
|
|
{
|
|
public:
|
|
PhoneDisConnectView();
|
|
~PhoneDisConnectView() { RemoveAll(); }
|
|
|
|
private:
|
|
OHOS::UIImageView bg_;
|
|
OHOS::UILabelExt desc_;
|
|
};
|
|
|
|
class TjdUiAppPhonePresenter;
|
|
class TjdUiAppPhoneView : public OHOS::View<TjdUiAppPhonePresenter>
|
|
{
|
|
public:
|
|
TjdUiAppPhoneView();
|
|
~TjdUiAppPhoneView();
|
|
static TjdUiAppPhoneView *GetInstance(void);
|
|
void OnStart() override;
|
|
void OnStop() override;
|
|
static PhoneViewIndex currentViewIndex_;
|
|
void ShowView(PhoneViewIndex showIndex);
|
|
void SetDialNumber(std::string &number);
|
|
// 设置快速进入的界面
|
|
static void SetQuickEnterView(PhoneViewIndex index)
|
|
{
|
|
currentViewIndex_ = index;
|
|
isQuickEnter_ = true;
|
|
}
|
|
static bool IsQuickEnter() { return isQuickEnter_; }
|
|
|
|
private:
|
|
void InitTargetView(PhoneViewIndex index);
|
|
PhoneUIScrollView *mainView_{nullptr};
|
|
PhoneViewBase *viewManager_[PHONE_UNKNOWN]{nullptr};
|
|
static bool isQuickEnter_;
|
|
};
|
|
|
|
} // namespace TJD
|
|
|
|
#endif |