Fix the janky transition of contextual cards.
When contextual cards are being laid out, there are two separate layout
transitions, which brings users the feeling of slowness.
In the current design, we bind slices in the adapter's
onBindViewHolder(), where slice's binding is acutally done in the
background thread and it's time consuming. So before getting the
callback from the slice framework to have actual contents, the view is
empty but the viewholder is already created. So the RecyclerView would
treat it as completed and starts to lay them out. This introduces the
first time transition. Once we get the actual slice content, the view
will be refreshed and laid out, which is the second time transition.
To tackle this, this CL caches slices that are created at pre-check
time, and use them to render before getting updated slices to fill up
the gap.
Fixes: 156372414
Test: robotest and launch settings to see the transition being smooth.
Change-Id: Ic0a27ff36f1824de499b75ec73b2635de9cbe6b5
5 files changed