From: Caisking <3449750381@qq.com> Date: Sat, 3 Aug 2024 06:57:04 +0000 (+0800) Subject: 适配卡片管理Slice回退以及按键 X-Git-Tag: release_V1.2.70_20241020_135402~555^2~17^2~3 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=c06a8074d8522b1c7e556c7309193ebf684329da;p=mirrors%2FFD230.git 适配卡片管理Slice回退以及按键 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/add_card/src/AddCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/add_card/src/AddCardPresenter.cpp index 2129729c1..7da737cc0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/add_card/src/AddCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/add_card/src/AddCardPresenter.cpp @@ -27,28 +27,11 @@ namespace OHOS AddCardPresenter::~AddCardPresenter() { - // if (keyActListenr != nullptr) - // { - // delete keyActListenr; - // keyActListenr = nullptr; - // } } void AddCardPresenter::OnStart() { Presenter::OnStart(); - // if (keyActListenr == nullptr) - // { - // keyActListenr = new KeyInputListener(); - // if (keyActListenr != nullptr) - // { - // RootView::GetInstance()->SetOnKeyActListener(keyActListenr); - // } - // else - // { - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnStart: new KeyInputListener fail"); - // } - // } } AddCardPresenter *AddCardPresenter::GetInstance() @@ -68,10 +51,12 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AddCardPresenter::OnDrag"); UNUSED(view); + /*从下自上 回退*/ if ((event.GetDragDirection() == DragEvent::DIRECTION_BOTTOM_TO_TOP)) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AddCardPresenter::OnDrag ChangeSlice"); - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN); + // 回退 + NativeAbility::GetInstance().Back(); + return true; } return false; } @@ -83,6 +68,7 @@ namespace OHOS if (!MainModel::GetInstance().GetCardInfoSet(index)) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AddCardPresenter::OnClick GetCardInfoSet ture"); + // 超过最大卡片限制 if (MainModel::GetInstance().GetCardSettingCount() >= CARD_SETTING_COUNT_MAX) { cardCountEvent = true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp index 37d8ae878..32081059d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp @@ -172,6 +172,12 @@ namespace OHOS NativeAbility::GetInstance().ChangeSlice(VIEW_CHECK_INVALID, TransitionType::TRANSITION_ZOOM); } } + // 设置卡片管理进入 + else if (curViewId == MAIN_CLICK_SETCARD) + { + MainModel::GetInstance().SetFromSetCardView(true); + MainModel::GetInstance().SetFromCardId(SETCARD); + } // 如果勿扰模式是开启状态,在下拉界面点击勿扰快捷入口会关闭勿扰模式不进入勿扰视图 if (g_jumpView[curViewId] == VIEW_DNOTDISTURB && DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled() == true) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_card/src/SetMainView.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_card/src/SetMainView.cpp index cb12d9701..f0eebf282 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_card/src/SetMainView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_card/src/SetMainView.cpp @@ -1,4 +1,4 @@ -/*** +/*** * @Date: 2024-07-04 19:24:05 * @LastEditors: Caisking 3449750381@qq.com * @LastEditTime: 2024-08-02 14:31:07 @@ -29,6 +29,7 @@ #include "uicomponents/UIComponents.h" #include "MainPresenter.h" #include "SetCardPresenter.h" +#include "MainPresenterSample.h" namespace OHOS { static SetMainView *g_pSetMainView{nullptr}; @@ -63,9 +64,9 @@ namespace OHOS InitLabelExt(setLabel, 83, 330, 300, 35, "labletitle", STR_CARD_MANAGEMENT, DEFAULT_VECTOR_FONT_FILENAME, 30); Add(setLabel); // 初始化Button - InitButton(setButton, 158, 158, 150, 150, SET_CARD_MAIN); + InitButton(setButton, 158, 158, 150, 150, MAIN_CLICK_SETCARD); setButton->SetImageSrc(BUTTONENTER_IMAGE, BUTTONENTER_IMAGE); - setButton->SetOnClickListener(static_cast(SetCardPresenter::GetInstance())); + setButton->SetOnClickListener(static_cast(MainPresenterSample::GetInstance())); Add(setButton); return true; }