Fix issue that old search results list show up momentarily
After exiting the search, we clear the search results and hide the results lists (because that recycler view shouldn't be accessible after it). However, it often doesn't get chance to layout the empty data. So, the next time we show the search results list again with new data, it first animates to clear the old results and then animates in the new ones. In this fix, [demo](http://screencast/cast/NDg5OTg2NzIyMTU1NzI0OHxhMTk0NzEzZS1hYw), we swap the adapter to remove any old views, because old search results aren't valid anymore. Spoke with yigit who worked on RV in past and they suggested swapAdapter was fine for this. Other options explored: 1. set item animator = null; so, it doesn't animate flushing out old results -> but we want animations 2. delay the visibility update to let layout happen -> but, if we are hiding the section, why wait making the other UI updates until layout? Bug: 274051332 Flag: N/A Test: Manual Change-Id: I9f9c5a67b47b5415b2d9e4caa23fd4b6daf7cdea (cherry picked from commit 809e1a8e)
Loading
Please register or sign in to comment