!48580 修复仓颉list_item异常

Merge pull request !48580 from 闻涛/feature_fix_cj_listitem
This commit is contained in:
openharmony_ci 2024-11-16 11:02:13 +00:00 committed by Gitee
commit 1b7bb18d9c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 12 additions and 5 deletions

View File

@ -67,15 +67,22 @@ void FfiOHOSAceFrameworkListItemSetOnSelect(void (*callback)(bool flag))
ListItemModel::GetInstance()->SetSelectCallback(CJLambda::Create(callback));
}
void FfiOHOSAceFrameworkListItemSetSwipeAction(void (*startBuilder)(), void (*endBuilder)(),
void (*onIndexChange)(int32_t index), int32_t edgeEffect)
void FfiOHOSAceFrameworkListItemSetSwipeAction(void (*startBuilder)(), void (*endBuilder)(), int32_t edgeEffect)
{
if (!Utils::CheckParamsValid(edgeEffect, SWIPE_EDGE_EFFECT.size())) {
LOGE("invalid value for font swipeEdgeAction");
return;
}
ListItemModel::GetInstance()->SetDeleteArea(
CJLambda::Create(endBuilder), nullptr, nullptr, nullptr, nullptr,
Dimension(0, DimensionUnit::VP), false, nullptr);
ListItemModel::GetInstance()->SetDeleteArea(
CJLambda::Create(startBuilder), nullptr, nullptr, nullptr, nullptr,
Dimension(0, DimensionUnit::VP), true, nullptr);
ListItemModel::GetInstance()->SetSwiperAction(
CJLambda::Create(startBuilder), CJLambda::Create(endBuilder),
CJLambda::Create(onIndexChange), SWIPE_EDGE_EFFECT[edgeEffect]);
nullptr, nullptr, nullptr, SWIPE_EDGE_EFFECT[edgeEffect]);
}
}

View File

@ -28,7 +28,7 @@ CJ_EXPORT void FfiOHOSAceFrameworkListItemSetEditable(bool flag);
CJ_EXPORT void FfiOHOSAceFrameworkListItemSetSelectable(bool flag);
CJ_EXPORT void FfiOHOSAceFrameworkListItemSetOnSelect(void (*callback)(bool flag));
CJ_EXPORT void FfiOHOSAceFrameworkListItemSetSwipeAction(
void (*startBuilder)(), void (*endBuilder)(), void (*onIndexChange)(int32_t index), int32_t edgeEffect);
void (*startBuilder)(), void (*endBuilder)(), int32_t edgeEffect);
}
#endif // OHOS_ACE_FRAMEWORK_CJ_FLEX_FFI_H