SmartSwipe 一个智能的Android侧滑处理框架,轻松实现各种侧滑效果

网友投稿 1080 2022-11-04 20:21:04

SmartSwipe 一个智能的Android侧滑处理框架,轻松实现各种侧滑效果

SmartSwipe

中文文档,更详尽

A smart swipe android library helps you make View (and Activity) swipes easier.

In addition, to facilitate the use, SmartSwipe encapsulates the following tool classes:

SmartSwipeBack: All Activities slide back in an easy way via a single line code. without any super activity class; without translucent theme; without any code into BaseActivity; without any code into xml layout files;SmartSwipeRefresh: With a single line code to achieve swipe refresh and load more. Compatible with vertical and horizontalSwipeConsumerExclusiveGroup: Manages a set of exclusive SwipeConsumers, can only open one at a time.

Demo

download demo.apk

Create a cover

Activity sliding back

All Activities slide back in an easy way via a single line code.

without any super activity class;without translucent theme;without any code into BaseActivity;without any code into xml layout files;

Usage

First add SmartSwipe to your project

implementation 'com.billy.android:smart-swipe:latestVersion'

Nested scrolling only compatible after android api above 21(android 5.0) with core library(smart-swipe)

Add extension library to compat for android support library or androidX like below:

implementation 'com.billy.android:smart-swipe:latestVersion'//compat for android support libraryimplementation 'com.billy.android:smart-swipe-support:latestVersion'

or

implementation 'com.billy.android:smart-swipe:latestVersion'//compat for android ximplementation 'com.billy.android:smart-swipe-x:latestVersion'

SmartSwipe can be used by chain programming within a single line code. The usage of API looks like follow:

SmartSwipe.wrap(...) //view or Activity .addConsumer(...) //add a SwipeConsumer .enableDirection(...) //Specifies which side of the slide the SwipeConsumer will consumes .setXxx(...) //[optional] some other Settings .addListener(...); //[optional] add listener(s) to the SwipeConsumer

Sample code:

// When view cannot scroll vertically (or scrolling to the top/bottom), // if continue to drag, the UI will show elastic stretching effect, // and smooth recovery after releaseSmartSwipe.wrap(view) .addConsumer(new StretchConsumer()) .enableVertical();

Add more than one 'SwipeConsumer' to the same View. Such as:

SmartSwipe.wrap(view) .addConsumer(new StretchConsumer()) .enableVertical() //Stretch effect at directions: top and bottom .addConsumer(new SpaceConsumer()) .enableHorizontal() //Space effect at directions: left and right ;

Click here for more details about SwipeConsumers

Activity slides back with a single line of code globally

SmartSwipeBack.activityBezierBack(application, null); //bezier shows while swipingSmartSwipeBack.activityStayBack(application, null); //Back via release velocitySmartSwipeBack.activitySlidingBack(application, null); //sliding with pre-activity relative movesSmartSwipeBack.activityDoorBack(application, null); //finish activity like doors openSmartSwipeBack.activityShuttersBack(application, null); //finish activity like shutters open

Click here For more Details

Add swipe refresh to a View via a single line code

//the second parameter within xxxMode:// false: works vertically(swipe down to refresh and swipe up to load more)// true: works horizontally(swipe right to refresh and swipe right to load more) SmartSwipeRefresh.drawerMode(view, false).setDataLoader(loader);SmartSwipeRefresh.behindMode(view, false).setDataLoader(loader);SmartSwipeRefresh.scaleMode(view, false).setDataLoader(loader);SmartSwipeRefresh.translateMode(view, false).setDataLoader(loader);

You can use default headers and footers, and you can also customize your own.

here is the first one(Based on Ifxcyr/ArrowDrawable):

Click here For more Details

SmartSwipe features:

support for 4 directions swipe( left/top/right/bottom)supports adding multiple SwipeConsumers to the same View(/Activity)supports nested usagesupport to use for list items in ListView and RecyclerView and the list itselfcompat for NestedScroll (android support library and androidX)A dozen of built-in SwipeConsumers effects

Thanks

Simon-Leeeeeeeee/SLWidgetikew0ng/SwipeBackLayoutBlankj/SwipePanelqinci/AndroidSlideBackscwang90/SmartRefreshLayouthttps://thiswaifudoesnotexist.net/https://iconfont.cn/https://m.sc.enterdesk.com/sucai/477026.htmlAnliaLee/FallingViewjd-alexander/LikeButtonIfxcyr/ArrowDrawable

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Spring 加载 Application Context五种方式小结
下一篇:Kitura 一个高性能和简单易用的web框架来构建现代Swift应用
相关文章