Skip to content

Commit c1bf40f

Browse files
Winson ChungAndroid (Google) Code Review
authored andcommitted
Merge "Fixing transition animation in landscape on tablets (Bug 16867731)" into lmp-dev
2 parents 7f708ec + 242bbb8 commit c1bf40f

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

packages/SystemUI/res/values-sw720dp/config.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,8 @@
3939
<!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow
4040
card. -->
4141
<integer name="keyguard_max_notification_count">5</integer>
42+
43+
<!-- Transposes the recents layout in landscape. -->
44+
<bool name="recents_transpose_layout_with_orientation">false</bool>
4245
</resources>
4346

packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public class RecentsConfiguration {
3737
static RecentsConfiguration sInstance;
3838
static int sPrevConfigurationHashCode;
3939

40-
DisplayMetrics mDisplayMetrics;
41-
4240
/** Animations */
4341
public float animationPxMovementPerSecond;
4442

@@ -156,14 +154,22 @@ void update(Context context) {
156154
SharedPreferences settings = context.getSharedPreferences(context.getPackageName(), 0);
157155
Resources res = context.getResources();
158156
DisplayMetrics dm = res.getDisplayMetrics();
159-
mDisplayMetrics = dm;
160157

161158
// Debug mode
162159
debugModeEnabled = settings.getBoolean(Constants.Values.App.Key_DebugModeEnabled, false);
163160
if (debugModeEnabled) {
164161
Console.Enabled = true;
165162
}
166163

164+
// Layout
165+
isLandscape = res.getConfiguration().orientation ==
166+
Configuration.ORIENTATION_LANDSCAPE;
167+
transposeRecentsLayoutWithOrientation =
168+
res.getBoolean(R.bool.recents_transpose_layout_with_orientation);
169+
170+
// Insets
171+
displayRect.set(0, 0, dm.widthPixels, dm.heightPixels);
172+
167173
// Animations
168174
animationPxMovementPerSecond =
169175
res.getDimensionPixelSize(R.dimen.recents_animation_movement_in_dps_per_second);
@@ -174,15 +180,6 @@ void update(Context context) {
174180
filteringNewViewsAnimDuration =
175181
res.getInteger(R.integer.recents_filter_animate_new_views_duration);
176182

177-
// Insets
178-
displayRect.set(0, 0, dm.widthPixels, dm.heightPixels);
179-
180-
// Layout
181-
isLandscape = res.getConfiguration().orientation ==
182-
Configuration.ORIENTATION_LANDSCAPE;
183-
transposeRecentsLayoutWithOrientation =
184-
res.getBoolean(R.bool.recents_transpose_layout_with_orientation);
185-
186183
// Search Bar
187184
searchBarSpaceHeightPx = res.getDimensionPixelSize(R.dimen.recents_search_bar_space_height);
188185
searchBarAppWidgetId = settings.getInt(Constants.Values.App.Key_SearchAppWidgetId, -1);

packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewLayoutAlgorithm.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)