mcu_hi3321_watch/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogView.h
2025-05-26 20:15:20 +08:00

92 lines
2.7 KiB
C++

/*
* Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
* Description: CallerLogView.h
* Author:
* Create: 2021-10-12
*/
#ifndef CALLER_LOG_VIEW_H
#define CALLER_LOG_VIEW_H
#include "View.h"
#include "CallerLogPresenter.h"
#include "CallerItemView.h"
#include "components/ui_view_group.h"
#include "components/ui_image_animator.h"
#include "components/ui_scroll_view.h"
#include "components/ui_label.h"
#include "components/ui_label_button.h"
#include "components/ui_list.h"
#include "components/abstract_adapter.h"
#include "PhoneService.h"
#include "vector.h"
#include "ChangeSliceListener.h"
namespace OHOS {
using namespace Graphic;
class CallerListOnDragListener : public UIView::OnDragListener {
public:
CallerListOnDragListener() {}
~CallerListOnDragListener() override {}
bool OnDrag(UIView& view, const DragEvent& event) override
{
UNUSED(view);
if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) &&
(event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) {
NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
}
return false;
}
};
class CallerUIScrollView : public UIScrollView {
public:
CallerUIScrollView() {}
~CallerUIScrollView() {}
bool OnDragEvent(const DragEvent& event) override
{
return UIScrollView::OnDragEvent(event);
}
};
class CallerLogView : public View<CallerLogPresenter> {
public:
CallerLogView();
~CallerLogView() override;
void OnStart() override;
UIViewGroup* GetHintsGroup();
CallerUIScrollView *GetGroupView();
CallerUIScrollView *GetContainerView();
static CallerLogView *GetInstance();
uint32 GetCurrentNumber();
CallLogInfo *GetCurrentCallInfo();
private:
bool InitOrBandOnclickEvent();
bool CreateCallerLogViewGroup(void);
bool CreateNoDataCallerLogViewGroup(void);
void ChangeLabelsStytleClear(int32 groupFinaly, int32 Index);
void ChangeLabelsStytleLog();
void InitBluetoothHintsGroup();
uint32 currentNumber;
UILabel labelLog;
UILabel labelClear;
CallLogInfo *info{nullptr};
UIViewGroup *groupFirst{nullptr};
UIViewGroup *groupFinal{nullptr};
UIViewGroup *hintsGroup{nullptr};
CallerUIScrollView *container{nullptr};
CallerUIScrollView *group{nullptr};
UIImageView *imageView{nullptr};
UIImageView *hintsImageView{nullptr};
UIView::OnClickListener* clickLeftListener{nullptr};
Vector<CallerItemView *>item;
CallerListOnDragListener *dragListener{nullptr};
};
}
#endif