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

Expandable + filtering - crash and problems #885

Open
1 task
MFlisar opened this issue Apr 16, 2020 · 3 comments
Open
1 task

Expandable + filtering - crash and problems #885

MFlisar opened this issue Apr 16, 2020 · 3 comments

Comments

@MFlisar
Copy link
Contributor

MFlisar commented Apr 16, 2020

General problem
In general, if you use expandable items and filtering together, you always lose the expandable state during filtering. This is really a problem if you want to filter and suddenly the expanded item containing the item that you want to filter out is gone because it's parent is collapsed. Additionally expanding an item while the filter is active does not respect the current active filter either it seems, I see that always all children of an item are expanded regardless of the current filter.

Crash
A side effect of this behaviour is following crash if you collapse/expand items after filtering your views.

If desired, I can give you an example code with a little library that I'm rewritting currently in kotlin which is not far yet but can reproduce this issue easily.

Exception

kotlin.TypeCastException: null cannot be cast to non-null type kotlin.collections.List<Item>
    at com.mikepenz.fastadapter.adapters.ItemFilter.publishResults(ItemFilter.kt:104)
    at android.widget.Filter$ResultsHandler.handleMessage(Filter.java:282)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:6986)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)

Details

  •  Used library version: 5.0.0
@mikepenz
Copy link
Owner

@MFlisar the provided filter code is not optimized for cases with expandables at once. I am sure there are a few optimizations possible / needed to make ti really work well.

I am open for improvements / PRs to improve the behavior in this matter.

But it was not a priority when creating, as it is a rare and more specialized usecase.

@mikepenz mikepenz self-assigned this Apr 19, 2020
Repository owner deleted a comment from ahmedrem55538 Jun 14, 2022
@usandourkids525
Copy link

Add love for self and other's

@androidacy-user
Copy link

For us on 5.7.0, expanding an item after search causes search(filter) to stop working. No crashes, just calling filter() no longer does anything

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

No branches or pull requests

4 participants