FlexibleAdapter
FlexibleAdapter copied to clipboard
How to prevent unfiltered list from being visible before filtering list on configuration change?
This issue can be seen in flexible-adapter-app
if you remove android:configChanges="orientation|screenSize"
from AndroidManifest.xml
.
When a configuration change occurs, and a filtered view is reinitialized, the unfiltered list of items is visible for a split second before the filter completes.
It seems that if I had a way to update the items in the adapter without notifyDataSetChanged
being called, this issue would go away.
e.g.
// Ca't use updateDataSet because it calls notifyDataSetChanged
// mAdapter.updateDataSet(items)
mAdapter.someMethodThatUpdatesItemsWithoutNotify(items)
mAdapter.filterItems()
// notifyDataSetChanged() in onPostFilter or here, if there is no new filter.
Is there a way to prevent this that already exists, or am I stuck with this behavior unless I set android:configChanges
?
I've tried calling filterItems
with the list of items, but this seems to cause FlexibleAdapter
to forget about any items that are filtered out.
@jonahwh, thanks for the message. Well, there's no method to set items without notify the changes. It could be an improvement, as you suggested, but I need to analyse first, it might not work!
However, I can't help now. Use the configChanges
property.