# SmartSwipe **Repository Path**: chinasoft5_ohos/SmartSwipe ## Basic Information - **Project Name**: SmartSwipe - **Description**: 智能侧滑,弹性侧滑、滑动抽屉、下拉刷新、侧滑返回以及侧滑删除功能。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: https://gitee.com/chinasoft5_ohos/SmartSwipe - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-08-19 - **Last Updated**: 2021-11-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README SmartSwipe ==================== ### 项目介绍 + 项目名称:SmartSwipe + 所属系列:openharmony的第三方组件适配移植 + 功能:智能侧滑,弹性侧滑、滑动抽屉、下拉刷新、侧滑返回以及侧滑删除功能。 + 项目移植状态:主功能完成 + 调用差异:未实现功能(1.开门式封面 , 2.百叶窗式封面) + 开发版本:sdk6,DevEco Studio2.2 Beta1 + 基线版本: Release v1.1.2 ### 效果演示 ![](https://images.gitee.com/uploads/images/2021/0819/154802_da25ee09_8941935.gif) ### 安装教程 **1)** 在项目根目录下的build.gradle文件中, ``` allprojects { repositories { maven { url 'https://s01.oss.sonatype.org/content/repositories/releases/' } } } ``` **2)** 在entry模块的build.gradle文件中, ``` dependencies { implementation('com.gitee.chinasoft_ohos:smart-swipe:1.0.0') implementation('com.gitee.chinasoft_ohos:smart-swipe-refresh-ext:1.0.0') ...... } ``` 在sdk6,DevEco Studio2.2 Beta1下项目可直接运行 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, 并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下 ### 使用说明 初始化SmartSwipeRefresh SwipeConsumer。 ```java SmartSwipeRefresh smartSwipeRefresh = SmartSwipeRefresh.scaleMode(findComponentById(ResourceTable.Id_container_refresh), false) .setDataLoader(dataLoader); SwipeConsumer consumer = smartSwipeRefresh.getSwipeConsumer().as(SlidingConsumer.class) .setDrawerExpandable(false) .setEdgeAffinity(true) .addConsumer(new StretchConsumer()) .enableVertical(); consumer.getWrapper().setTag("DrawerConsumerAbility"); DrawerConsumer mDrawerConsumer = new DrawerConsumer() //horizontal menu .setHorizontalDrawerView(horizontalMenuWrapper) //top menu .setTopDrawerView(topMenuWrapper) //bottom menu .setBottomDrawerView(bottomMenuWrapper) // .showScrimAndShadowOutsideContentView() //set the translucent color of scrim (default is 0:transparent) .setScrimColor(0x7F000000) //set the shadow color follow the drawer while swiping (default is 0:transparent) .setShadowColor(0x80000000) .setShadowSize(SmartSwipe.dp2px(10, this)) .addListener(listener) //set edge size to swipe to 20dp (default is 0: whole range of the contentView bounds) .setEdgeSize(SmartSwipe.dp2px(20, this)) .as(DrawerConsumer.class); SlidingConsumer mSlidingConsumer = new SlidingConsumer() .setDrawerExpandable(true) //horizontal menu .setHorizontalDrawerView(horizontalMenuWrapper) //top menu .setTopDrawerView(topMenuWrapper) //bottom menu .setBottomDrawerView(bottomMenuWrapper) .showScrimAndShadowOutsideContentView() //set the translucent color of scrim (default is 0:transparent) .setScrimColor(0x7F000000) .setShadowSize(SmartSwipe.dp2px(10, this)) .setShadowColor(0x80000000) .addListener(listener) //set edge size to swipe to 20dp (default is 0: whole range of the contentView bounds) .setEdgeSize(SmartSwipe.dp2px(20, this)) .as(SlidingConsumer.class); ``` 添加 SimpleSwipeListener。 ```java consumer.addListener(new SimpleSwipeListener() { @Override public void onSwipeOpened(SmartSwipeWrapper wrapper, SwipeConsumer consumer, int direction) { adapter.removeItem(getPosition()); } }); ``` ### 测试信息 CodeCheck代码测试无异常 CloudTest代码测试无异常 病毒安全检测通过 当前版本demo功能与原组件基本无差异 ### 版本迭代 - 1.0.0 - 0.0.1-SNAPSHOT ### 版权和许可信息 Apache-2.0 License