[fenix] Issue https://github.com/mozilla-mobile/fenix/issues/21236: Fixes empty tray...
commit357271ef840450fa2d781501495e7625da0d60bd
authorJonathan Almeida <jalmeida@mozilla.com>
Fri, 17 Sep 2021 16:38:45 +0000 (17 12:38 -0400)
committerJonathan Almeida <git@jonalmeida.com>
Fri, 17 Sep 2021 17:48:08 +0000 (17 13:48 -0400)
tree1e095d956ebaff415606f58416c9626757f77840
parent9a5ae78acfc543366ae2ddac7cf282ae0501ca8e
[fenix] Issue https://github.com/mozilla-mobile/fenix/issues/21236: Fixes empty tray visibility logic

This is a bug we noticed after landing search term grouping.

An adapter can submit an empty list of items to the `ConcatAdapter`
early. This has the side-effect of triggering our `observeFirstInsert`
too soon and therefore updating the visibility to show the empty tray
placeholder and never switches back.

Our solution is to keep a constant observer on the adapter so we can
perform the visibility check on every insert/remove.

Co-authored-by: Roger Yang <royang@mozilla.com>
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/TrayPagerAdapter.kt
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/viewholders/AbstractBrowserPageViewHolder.kt
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/viewholders/AbstractPageViewHolder.kt
mobile/android/fenix/app/src/main/java/org/mozilla/fenix/tabstray/viewholders/SyncedTabsPageViewHolder.kt
mobile/android/fenix/app/src/test/java/org/mozilla/fenix/tabstray/viewholders/AbstractBrowserPageViewHolderTest.kt