Android motion scan RecyclerView
Easy to use swipe gestures for Android RecyclerView.
1. Introduction
Implementing an easy to use and highly customizable scanable for android RecyclerView.
- Support for left and right scrolling for all RecyclerView
- Define the colors as background for each direction of finger movement.
- Define symbols for each direction of impact.
- Defining texts next to symbols
2. Planned
- The actions are performed only when the colored button is clicked, which is cut off during the scan, not immediately after.
- More than one action for each direction of motion (more than one button is displayed)
3. Setting
3.1. Add a JitPack to your project
Cradle:
- Add it to the root build.gradle at the end of the repositories:
all projects {
repositories {
…
maven { url ‘https://jitpack.io’ }
}
}
Dependencies {
implementation of ‘com.github.WilliBoelke:simple-recycler-view-swipe-gestures:v1.1’
}
Maven:
- Add the JitPack repository to your pom.xml.
jitpack.io
https://jitpack.io
- Add the dependencies to your pom.xml.
com.github.WilliBoelke
Simple Circuit View Wind Gestures
v1.1
Or find other versions here:
JitPack-SompleSwipeGestures.
3.2 Import SwipeGestureManager
In your activity, add
import SwipeGestures.SwipeGestureManager ;
4. Use of
4.1 Implementing SwipeCallbackLeft and/or SwipeCallbackLeft:
Use the interfaces in your activities.
Here you place the code that will be executed when the Recycle element is deleted.
private SwipeGestureManager.SwipeCallbackLeftCallback leftCallback = new SwipeCallbackLeft()
{
@Override
public void onLeftSwipe(int position)
{
// your code here
}
}
4.2 Initialize SwipeGestureManager in your activity:
recycling SwipeGestureManager agentSwipeGestures = new SwipeGestureManager(rightSwipe, leftSwipe) ;
If you only need a scanable, you can implement and pass one of the interfaces:
SwipeGestureManager recycle agentSwipeGestures = new SwipeGestureManager(rightFailure) ;
4.3 Color setting:
Use the adjustment tool to adjust the color:
resyclerAdapterGestures.setFontColorDrawable(new ColorDrawable(Color.RED)) ;
You can set a different color for the two directions.
The standard colours are red and green.
Colours
Blue | yellow |
---|---|
4.4 Symbols defined:
Optionally, you can use icons that are displayed during deletion.
recycleAdapterSwipeGestures.setIconRight(ContextCompat.getDrawable(this, R.drawable.your_icon)) ;
This works again for both actions.
you can also change the size of the symbols with
RecirculatorAdapter WipePadGestures.setIconMultiUltiplier(2) ;
4.5 Text
You can define the text (internal or with icon), the text can be modified via parameters
.
recirculatorAdapterWipe.setTextLeft(Left);
recirculatorAdapterWipe.setTextRight(RIGHT) ;
Text Structure :
//Set text size
recycleAdapterSwipeGestures.setTextSize(60) ;
//Set text color
recycle agentSwipeGestures.setTextColor(Color.BLACK) ;
The texts can also be set up separately with the typewriters as follows:
//Set text size
recyAdapterSwipeGestures.setTextSize(60, 100)
//Set text color
recycleSwipeGestures.setTextColor(Color.BLACK, Color.YELLOW) ;
Text | Text |
---|---|
Text on the right | Small |
Colour of text and symbols | Text only. |
4.6 Join RechylerViewAdapter
You must assign scan motions to the RecyclerView adapter with the ItemTouchHelper
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(recyclingerAdapterSwipeGestures);
itemTouchHelper.attachToRecyclerView(recyclingerView) ;
And that’s it.
You can find an example implementation in MainActivity
GitHub
https://github.com/WilliBoelke/simple-recycler-view-swipe-gestures
Related Tags:
android-recyclerview partial swiperecyclerview on swipe listenerandroid recyclerview itemtouchhelper exampleitemtouchhelper recyclerview androidandroid recyclerview swipe to show buttonswipe left and right in recyclerview android,People also search for,Privacy settings,How Search works,android recyclerview swipe to show button,android-recyclerview partial swipe,swipe left and right in recyclerview android,swipe to show delete button android recyclerview github,android custom swipe view with recyclerview,recyclerview on swipe listener,android recyclerview itemtouchhelper example,itemtouchhelper recyclerview android