DragSelectRecyclerView | TouchListener that can be | RecyclerView library
kandi X-RAY | DragSelectRecyclerView Summary
kandi X-RAY | DragSelectRecyclerView Summary
It's a simple one class TouchListener that can be attached to any RecyclerView and handles multi selection in google photos style via long pressing on an item and moving the finger up/down to select more items (it even scrolls if you reach the edges of the RecyclerView).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handle touch event
- Resets the state of this RecyclerView
- Notify the current select range change
- Process auto scroll
- Initializes the RecyclerView
- Start the drag selection
- Set a listener for the selected items
- Called when an options item is selected
- Update selection listener
- Sets the mode of the selection
- Handle select change
- Update the checked selection state
- Intercept the touch event
- Set selection start
- Scroll by distance
- Called when the selection is finished
DragSelectRecyclerView Key Features
DragSelectRecyclerView Examples and Code Snippets
Community Discussions
Trending Discussions on DragSelectRecyclerView
QUESTION
I am currently trying to achieve an app to edit weekly timeframes. Like mechanical timers for sockets, but in my case for every weekday.
The granularity is in the first place secondary (i guess it will be 15 or 30min).
My approach was a RecyclerView
with GridLayoutManager
and an ArrayAdapter
with Items for every Cell.
To select more cells you can longpress a cell and drag over others. To achieve this I used the Listeners of the following Library DragSelectRecyclerView.
It works pretty well and you can select the items quite good but especially on the emulator or older phones its very slow and laggy. In the debug logcat you can see also that the Choreographer has to skip many frames at rendering the View and on selection of multiple cells.
Is there an better approach to achieve such an behavior. Or is there any big mistake in the code which is very slow and crappy?
EDIT:
after changing notifyItemChanged(pos);
to notifyItemRangeChanged(pos, pos);
its way less laggy but still not performing as well as it should.
I also removed everything that was responsible for autoscrolling (which was a feature of the library i mentioned above) to make the code simpler.
Here the source of my Fragment
ANSWER
Answered 2017-Nov-07 at 14:57I wouldn't use notifyItemRangeChanged(pos, pos);
, notifyDataSetChanged()
etc. on each selection process.
Why won't you like this;
1.Took your recyclerview references in its adapter like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install DragSelectRecyclerView
You can use DragSelectRecyclerView like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the DragSelectRecyclerView component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page