diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-05-27 07:23:13 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-05-27 07:23:13 +0000 |
commit | df0843e569b93e77355990f7a71fe39746b43493 (patch) | |
tree | b5fb050ecef07e3f2020513a526f6a99f46554c4 /quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java | |
parent | 4ac63b28ced5d5b09eaae39adca68377a2a7ef5b (diff) | |
parent | aea65680e6f3da83636dbc6af2ef1381de06d2a8 (diff) | |
download | android_packages_apps_Trebuchet-df0843e569b93e77355990f7a71fe39746b43493.tar.gz android_packages_apps_Trebuchet-df0843e569b93e77355990f7a71fe39746b43493.tar.bz2 android_packages_apps_Trebuchet-df0843e569b93e77355990f7a71fe39746b43493.zip |
Snap for 4807121 from aea65680e6f3da83636dbc6af2ef1381de06d2a8 to pi-release
Change-Id: Id61934dcc353f297ad35ca1fbd7ffe385a2503a3
Diffstat (limited to 'quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java')
-rw-r--r-- | quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java index a11625a34..43d982230 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java @@ -15,7 +15,13 @@ */ package com.android.launcher3.uioverrides; +import android.content.Context; +import android.content.res.Resources; +import android.graphics.Rect; + +import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; +import com.android.launcher3.R; import com.android.quickstep.QuickScrubController; import com.android.quickstep.views.RecentsView; @@ -24,6 +30,12 @@ import com.android.quickstep.views.RecentsView; */ public class FastOverviewState extends OverviewState { + private static final float MAX_PREVIEW_SCALE_UP = 1.3f; + /** + * Vertical transition of the task previews relative to the full container. + */ + public static final float OVERVIEW_TRANSLATION_FACTOR = 0.5f; + private static final int STATE_FLAGS = FLAG_DISABLE_RESTORE | FLAG_DISABLE_INTERACTION | FLAG_OVERVIEW_UI | FLAG_HIDE_BACK_BUTTON | FLAG_DISABLE_ACCESSIBILITY; @@ -45,6 +57,23 @@ public class FastOverviewState extends OverviewState { @Override public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) { - return new float[] {1f, 0.5f}; + RecentsView recentsView = launcher.getOverviewPanel(); + recentsView.getTaskSize(sTempRect); + + return new float[] {getOverviewScale(launcher.getDeviceProfile(), sTempRect, launcher), + OVERVIEW_TRANSLATION_FACTOR}; + } + + public static float getOverviewScale(DeviceProfile dp, Rect taskRect, Context context) { + if (dp.isVerticalBarLayout()) { + return 1f; + } + + Resources res = context.getResources(); + float usedHeight = taskRect.height() + res.getDimension(R.dimen.task_thumbnail_top_margin); + float usedWidth = taskRect.width() + 2 * (res.getDimension(R.dimen.recents_page_spacing) + + res.getDimension(R.dimen.quickscrub_adjacent_visible_width)); + return Math.min(Math.min(dp.availableHeightPx / usedHeight, + dp.availableWidthPx / usedWidth), MAX_PREVIEW_SCALE_UP); } } |