diff options
Diffstat (limited to 'quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java')
-rw-r--r-- | quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java index 03441c87e..b601834f3 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java @@ -57,6 +57,8 @@ import com.android.quickstep.util.LayoutUtils; @TargetApi(Build.VERSION_CODES.O) public class LauncherRecentsView extends RecentsView<Launcher> implements StateListener { + private static final Rect sTempRect = new Rect(); + private final TransformParams mTransformParams = new TransformParams(); public LauncherRecentsView(Context context) { @@ -144,6 +146,25 @@ public class LauncherRecentsView extends RecentsView<Launcher> implements StateL LayoutUtils.calculateLauncherTaskSize(getContext(), dp, outRect); } + /** + * @return The translationX to apply to this view so that the first task is just offscreen. + */ + public float getOffscreenTranslationX(float recentsScale) { + float offscreenX = NORMAL.getOverviewScaleAndTranslation(mActivity).translationX; + // Offset since scale pushes tasks outwards. + getTaskSize(sTempRect); + int taskWidth = sTempRect.width(); + offscreenX += taskWidth * (recentsScale - 1) / 2; + if (mRunningTaskTileHidden) { + // The first task is hidden, so offset by its width. + offscreenX -= (taskWidth + getPageSpacing()) * recentsScale; + } + if (isRtl()) { + offscreenX = -offscreenX; + } + return offscreenX; + } + @Override protected void onTaskLaunchAnimationUpdate(float progress, TaskView tv) { if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { |