From ab85758fee09d8e5755159dbd3d073e98051ad83 Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 24 Oct 2024 14:47:13 +0800 Subject: [PATCH] =?utf8?q?=E9=80=9A=E8=AE=AF=E5=BD=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/phone/include/CallLogAdapter.h | 7 +++++-- .../fd230app/nativeui/phone/src/CallLogAdapter.cpp | 11 +++++++++++ .../fd230app/nativeui/phone/src/CallLogItem.cpp | 7 ++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/include/CallLogAdapter.h b/code/sdk/application/wearable/fd230app/nativeui/phone/include/CallLogAdapter.h index c2181a088..2d29122e2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/include/CallLogAdapter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/include/CallLogAdapter.h @@ -16,14 +16,16 @@ #include #include "languagecode/LanguageInit.h" #include "PhoneService.h" +#include "components/ui_swipe_view.h" namespace OHOS { class CallLogListAdapter : public AbstractAdapter, - public UIView::OnClickListener - { + public UIView::OnClickListener, + public UISwipeView::OnSwipeListener + { public: explicit CallLogListAdapter(); virtual ~CallLogListAdapter(); @@ -57,6 +59,7 @@ namespace OHOS } bool OnClick(UIView &view, const ClickEvent &event); + void OnSwipe(UISwipeView &view); private: std::list listData; diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/CallLogAdapter.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/CallLogAdapter.cpp index 7846be311..d3dc7a32b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/CallLogAdapter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/CallLogAdapter.cpp @@ -107,8 +107,10 @@ namespace OHOS // } //item->SetOnClickListener(this); + // item->Getbutton_calllog()->->SetOnSwipeListener(this); item->Getbutton_calllog()->SetOnClickListener(this); item->GetDeleteButton()->SetOnClickListener(this); + item->Getbutton_calllog_SwipeView()->SetOnSwipeListener(this); // item->GetUILabelButtonExt()->SetOnClickListener(itemClickListener); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GetView, id = %s", item->GetUILabelButtonExt()->GetViewId()); @@ -174,6 +176,15 @@ namespace OHOS listData.push_back(item); } + void CallLogListAdapter::OnSwipe(UISwipeView &view) + { + UNUSED(view); + + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnSwipe "); + view.SetIntercept((0 == view.GetCurrentPage()) ? false : true); + } + + } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/CallLogItem.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/CallLogItem.cpp index 43e78c89c..61a5b7dbe 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/CallLogItem.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/CallLogItem.cpp @@ -186,8 +186,8 @@ namespace OHOS button_calllog_SwipeView->SetAnimatorTime(50); // 200:animator drag time(ms) - UIView::OnDragListener *dragListener = static_cast(MainPhonePresenter::GetInstance()); - button_calllog_SwipeView->SetOnDragListener(dragListener); + // UIView::OnDragListener *dragListener = static_cast(MainPhonePresenter::GetInstance()); + // button_calllog_SwipeView->SetOnDragListener(dragListener); button_calllog_SwipeView->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); button_calllog_SwipeView->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); @@ -207,7 +207,8 @@ namespace OHOS button_calllog_SwipeView->SetLoopState(false); button_calllog_SwipeView->SetVisible(true); - + button_calllog_SwipeView->SetReboundSize(0); + button_calllog_SwipeView->SetBlankSize(0); //button_calllog_SwipeView[i]->SetDirection(); //button_calllog_SwipeView->SetDraggable(false); -- 2.17.1