Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinearLayoutManager tends to crash when new image inserted #216

Open
Bela-Szilagyi opened this issue Oct 6, 2022 · 3 comments
Open

LinearLayoutManager tends to crash when new image inserted #216

Bela-Szilagyi opened this issue Oct 6, 2022 · 3 comments

Comments

@Bela-Szilagyi
Copy link

I can catch the exception using this wrapper, and then everything goes fine, but it is not the properr way...
class LlmWrapper(context: Context) : LinearLayoutManager(context) {
override fun onLayoutChildren(recycler: RecyclerView.Recycler?, state: RecyclerView.State?) {
Log.i("olc", state.toString())
try {
super.onLayoutChildren(recycler, state)
} catch (e: Exception) {
Log.e("olc", "$e.localizedMessage")
}
}
}

@AndreasKl
Copy link

AndreasKl commented Nov 9, 2022

I was also able to reproduce this issue. To mitigate this issue I downgrading firebase UI components to 7.2.0

    implementation 'com.firebaseui:firebase-ui-auth:7.2.0'
    implementation 'com.firebaseui:firebase-ui-database:7.2.0'

@landov
Copy link

landov commented Mar 7, 2023

I also experience this with version 8.0.2.

@Aniokrait
Copy link

I also ran into the same issue with version 8.0.2.
This commit removed notifyDataSetChanged() from FirebaseRecyclerAdapter, so the process of notifying the adapter about changes is now gone. This is the cause of RecyclerView and java.lang.IndexOutOfBoundsException: Inconsistency detected.
Text submissions are reflected in the RecyclerView without any problems, however, images don’t work well because adapter.stopListening() is called during image selection at onPause.

A simple solution is to add the following code to FriendlyMessageAdapter:

override fun stopListening() {
    super.stopListening()
    notifyDataSetChanged()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants