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
Running Settings Robolectric tests
The full suite
$ croot
$ make RunSettingsRoboTests
Running a single test class
$ croot
$ make RunSettingsRoboTests ROBOTEST_FILTER=<ClassName>
For example:
make RunSettingsRoboTests ROBOTEST_FILTER=CodeInspectionTest
You can also use partial class name in ROBOTEST_FILTER. If the partial class name matches multiple file names, all of them will be executed.