Comments (5)
@MRDHR released in 1.2.0-alpha03
from dpadrecyclerview.
Hi @MRDHR can you please share the full stacktrace? I'm interested in knowing if the index was greater than the adapter size or if it was negative.
from dpadrecyclerview.
Hey @MRDHR. I managed to reproduce the crash with this UI test:
@Test
fun testSelectingPositionOutOfBoundsDoesNotCrash() {
val numberOfItems = 500
launchFragment(TestAdapterConfiguration(numberOfItems = numberOfItems))
selectPosition(numberOfItems + 100, smooth = true, waitForIdle = false)
Thread.sleep(1000L)
mutateAdapter { adapter ->
adapter.setList(MutableList(numberOfItems + 10) { it })
adapter.notifyItemRangeInserted(0, 100)
}
onRecyclerView("Request layout") { recyclerView ->
recyclerView.requestLayout()
}
assertFocusAndSelection(numberOfItems + 9)
}
Please check if you're doing the following in your side:
- Using
DiffUtil
andsubmitList
to notify adapter changes correctly - Check if your
setSelectedPosition
calls are using indexes within bounds of the adapter contents
There's a PR here to address this specific crash now, but you might still hit some issues if you don't follow those 2 steps: #179
from dpadrecyclerview.
Regarding the two points you mentioned
1: I did not use DiffUtil to update data, I used replace. That is, items clear, then add all, and finally execute notifydatasetchanged
2: I can ensure that my items are not empty with setSelectedPosition.
The data updates are not very frequent, and they are not updated every 1 second.
At present, I have added the setSelectedPosition operation to be executed after recyclerview.post, and added the judgment for position>=0&&position<=items. size -1
from dpadrecyclerview.
Looking forward to your pull request being synchronized to the master and release an aar
from dpadrecyclerview.
Related Issues (20)
- Did you find a solution for the Grid focus problem? HOT 10
- Add navigation sound when searching for new view
- Add support for long text scrolling
- Scroll jumps to the top on item's layout update HOT 7
- Scroll position start question HOT 14
- Nested vertical lists HOT 1
- Vertical list with focus centered HOT 2
- Touch behavior in scrolling HOT 5
- help HOT 2
- Focus issue after touch event
- How to implement StaggeredGridLayout? HOT 5
- Update compose integration now that view-interop is fixed
- Allow skipping layout requests during scroll
- Expose ViewHolder focus state
- Add support for custom parent alignment based on ViewHolder position
- Add support for linear circular focus
- Gridrecyclerview with height 0.5 of the screen height - alignment problem (last row cut off) HOT 14
- First item of first row is smaller then all the others HOT 4
- Fast scrolling - loosing focus when having images from an url in the items HOT 21
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dpadrecyclerview.