Predictive swipe: show extra app icons at bottom of All Apps's RecyclerViews

The maximum center scale of All Apps to Home is 90%. It means we should add 5% height to All Apps's RecyclerView to render extra app icons.

Test: manual
bug: b/264906511
Change-Id: I2e970580810220e25d7fc3a86c19abaf87ba2c6e
This commit is contained in:
Fengjiang Li
2023-01-12 10:31:24 -08:00
parent 944348a522
commit 3774824cea
3 changed files with 108 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import androidx.annotation.Px;
import androidx.core.view.accessibility.AccessibilityEventCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import androidx.core.view.accessibility.AccessibilityRecordCompat;
@@ -143,6 +144,19 @@ public class AllAppsGridAdapter<T extends Context & ActivityContext> extends
cic.isSelected()));
}
/**
* We need to extend all apps' RecyclerView's bottom by 5% of view height to ensure extra
* roll(s) of app icons is rendered at the bottom, so that they can fill the bottom gap
* created during predictive back's scale animation from all apps to home.
*/
@Override
protected void calculateExtraLayoutSpace(RecyclerView.State state, int[] extraLayoutSpace) {
super.calculateExtraLayoutSpace(state, extraLayoutSpace);
@Px int extraSpacePx = (int) (getHeight()
* (1 - AllAppsTransitionController.SWIPE_ALL_APPS_TO_HOME_MIN_SCALE) / 2);
extraLayoutSpace[1] = Math.max(extraLayoutSpace[1], extraSpacePx);
}
/**
* Returns the number of rows before {@param adapterPosition}, including this position
* which should not be counted towards the collection info.