@@ -60,8 +60,6 @@ public class TaskStackViewLayoutAlgorithm {
6060
6161 public TaskStackViewLayoutAlgorithm (RecentsConfiguration config ) {
6262 mConfig = config ;
63- mWithinAffiliationOffset = mConfig .taskBarHeight ;
64- mBetweenAffiliationOffset = 4 * mConfig .taskBarHeight ;
6563
6664 // Precompute the path
6765 initializeCurve ();
@@ -84,6 +82,11 @@ public void computeRects(int windowWidth, int windowHeight, Rect taskStackBounds
8482 int left = mStackRect .left + (mStackRect .width () - size ) / 2 ;
8583 mTaskRect .set (left , mStackRect .top ,
8684 left + size , mStackRect .top + size );
85+
86+ // Update the affiliation offsets
87+ float visibleTaskPct = 0.55f ;
88+ mWithinAffiliationOffset = mConfig .taskBarHeight ;
89+ mBetweenAffiliationOffset = (int ) (visibleTaskPct * mTaskRect .height ());
8790 }
8891
8992 /** Computes the minimum and maximum scroll progress values. This method may be called before
@@ -110,8 +113,7 @@ void computeMinMaxScroll(ArrayList<Task> tasks, boolean launchedWithAltTab) {
110113 screenYToCurveProgress (mStackVisibleRect .bottom - (mStackVisibleRect .bottom - mStackRect .bottom ));
111114
112115 // Update the task offsets
113- float pAtBackMostCardTop = screenYToCurveProgress (mStackVisibleRect .top +
114- (mStackVisibleRect .height () - taskHeight ) / 2 );
116+ float pAtBackMostCardTop = 0.5f ;
115117 float pAtFrontMostCardTop = pAtBackMostCardTop ;
116118 float pAtSecondFrontMostCardTop = pAtBackMostCardTop ;
117119 int taskCount = tasks .size ();
@@ -128,14 +130,15 @@ void computeMinMaxScroll(ArrayList<Task> tasks, boolean launchedWithAltTab) {
128130 }
129131 }
130132
131- mMinScrollP = 0f ;
132133 mMaxScrollP = pAtFrontMostCardTop - ((1f - pTaskHeightOffset - pNavBarOffset ));
134+ mMinScrollP = tasks .size () == 1 ? Math .max (mMaxScrollP , 0f ) : 0f ;
133135 if (launchedWithAltTab ) {
134136 // Center the second most task, since that will be focused first
135137 mInitialScrollP = pAtSecondFrontMostCardTop - 0.5f ;
136138 } else {
137- mInitialScrollP = pAtSecondFrontMostCardTop - (( 1f - pTaskHeightOffset - pNavBarOffset )) ;
139+ mInitialScrollP = pAtFrontMostCardTop - 0.825f ;
138140 }
141+ mInitialScrollP = Math .max (0 , mInitialScrollP );
139142 }
140143
141144 /** Update/get the transform */
0 commit comments