summaryrefslogtreecommitdiffstats
path: root/quickstep
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2018-01-11 10:15:03 -0800
committerSunny Goyal <sunnygoyal@google.com>2018-01-11 15:33:23 -0800
commit1a52ef57c72291a87d4ca6bb1e752fd746646991 (patch)
tree7cb910c63f4ee834823375f50045accdc4099173 /quickstep
parent9bb0d726409a62fe262798795db76d20313d5d2c (diff)
downloadandroid_packages_apps_Trebuchet-1a52ef57c72291a87d4ca6bb1e752fd746646991.tar.gz
android_packages_apps_Trebuchet-1a52ef57c72291a87d4ca6bb1e752fd746646991.tar.bz2
android_packages_apps_Trebuchet-1a52ef57c72291a87d4ca6bb1e752fd746646991.zip
Removing some dependency on Launcher UI
Change-Id: Ic1c84880cfe4daa9398b8eb27c3afc0837c5a8ca
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/OverviewState.java22
-rw-r--r--quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java19
-rw-r--r--quickstep/src/com/android/quickstep/RecentsView.java24
3 files changed, 38 insertions, 27 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
index 989803a47..2e5e75e0e 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java
@@ -18,6 +18,7 @@ package com.android.launcher3.uioverrides;
import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.ACCEL_2;
+import android.content.Context;
import android.graphics.Rect;
import android.view.View;
@@ -74,15 +75,7 @@ public class OverviewState extends LauncherState {
@Override
public float getVerticalProgress(Launcher launcher) {
- DeviceProfile grid = launcher.getDeviceProfile();
- if (!grid.isVerticalBarLayout()) {
- return 1f;
- }
-
- float total = grid.heightPx;
- float searchHeight = total - grid.availableHeightPx +
- launcher.getResources().getDimension(R.dimen.all_apps_search_box_full_height);
- return 1 - (searchHeight / total);
+ return getVerticalProgress(launcher.getDeviceProfile(), launcher);
}
@Override
@@ -125,4 +118,15 @@ public class OverviewState extends LauncherState {
return new float[] {scale, translationX, translationY};
}
+
+ public static float getVerticalProgress(DeviceProfile grid, Context context) {
+ if (!grid.isVerticalBarLayout()) {
+ return 1f;
+ }
+
+ float total = grid.heightPx;
+ float searchHeight = total - grid.availableHeightPx +
+ context.getResources().getDimension(R.dimen.all_apps_search_box_full_height);
+ return 1 - (searchHeight / total);
+ }
}
diff --git a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
index 3ca1865b0..2e251d1f6 100644
--- a/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
+++ b/quickstep/src/com/android/quickstep/NavBarSwipeInteractionHandler.java
@@ -33,14 +33,15 @@ import android.view.View;
import android.view.ViewTreeObserver.OnPreDrawListener;
import com.android.launcher3.AbstractFloatingView;
+import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Hotseat;
import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.Interpolators;
-import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.states.InternalStateHandler;
import com.android.launcher3.uioverrides.RecentsViewStateController;
import com.android.launcher3.util.TraceHelper;
@@ -112,6 +113,15 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {
mContext = context;
WindowManagerWrapper.getInstance().getStableInsets(mStableInsets);
+ DeviceProfile dp = LauncherAppState.getIDP(mContext).getDeviceProfile(mContext);
+ // TODO: If in multi window mode, dp = dp.getMultiWindowProfile()
+ dp = dp.copy(mContext);
+ // TODO: Use different insets for multi-window mode
+ dp.updateInsets(mStableInsets);
+ RecentsView.getPageRect(dp, mContext, mTargetRect);
+ mSourceRect.set(0, 0, dp.widthPx - mStableInsets.left - mStableInsets.right,
+ dp.heightPx - mStableInsets.top - mStableInsets.bottom);
+
// Build the state callback
mStateCallback = new MultiStateCallback();
mStateCallback.addCallback(STATE_LAUNCHER_READY, this::onLauncherReady);
@@ -218,13 +228,6 @@ public class NavBarSwipeInteractionHandler extends InternalStateHandler {
return;
}
- if (mTargetRect.isEmpty()) {
- RecentsView.getPageRect(mLauncher, mTargetRect);
- DragLayer dl = mLauncher.getDragLayer();
- mSourceRect.set(0, 0, dl.getWidth() - mStableInsets.left - mStableInsets.right,
- dl.getHeight() - mStableInsets.top - mStableInsets.bottom);
- }
-
float shift = mCurrentShift.value * mActivityMultiplier.value;
int hotseatSize = getHotseatSize();
diff --git a/quickstep/src/com/android/quickstep/RecentsView.java b/quickstep/src/com/android/quickstep/RecentsView.java
index e7e794f74..0ea5b7c23 100644
--- a/quickstep/src/com/android/quickstep/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/RecentsView.java
@@ -29,6 +29,7 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.dragndrop.DragLayer;
+import com.android.launcher3.uioverrides.OverviewState;
import com.android.launcher3.uioverrides.RecentsViewStateController;
import com.android.systemui.shared.recents.model.RecentsTaskLoadPlan;
import com.android.systemui.shared.recents.model.RecentsTaskLoader;
@@ -106,7 +107,8 @@ public class RecentsView extends PagedView {
protected void onFinishInflate() {
super.onFinishInflate();
- Rect padding = getPadding(Launcher.getLauncher(getContext()));
+ Rect padding =
+ getPadding(Launcher.getLauncher(getContext()).getDeviceProfile(), getContext());
setPadding(padding.left, padding.top, padding.right, padding.bottom);
mFirstTaskIndex = getPageCount();
@@ -213,8 +215,7 @@ public class RecentsView extends PagedView {
}
}
- private static Rect getPadding(Launcher launcher) {
- DeviceProfile profile = launcher.getDeviceProfile();
+ private static Rect getPadding(DeviceProfile profile, Context context) {
Rect stableInsets = new Rect();
WindowManagerWrapper.getInstance().getStableInsets(stableInsets);
Rect padding = new Rect(profile.workspacePadding);
@@ -228,7 +229,7 @@ public class RecentsView extends PagedView {
float availableWidth = taskWidth - 2 * Math.max(padding.left, padding.right);
float availableHeight = profile.availableHeightPx - padding.top - padding.bottom
- stableInsets.top
- - profile.heightPx * (1 - OVERVIEW.getVerticalProgress(launcher));
+ - profile.heightPx * (1 - OverviewState.getVerticalProgress(profile, context));
float scaledRatio = Math.min(availableWidth / taskWidth, availableHeight / taskHeight);
overviewHeight = taskHeight * scaledRatio;
@@ -247,15 +248,18 @@ public class RecentsView extends PagedView {
}
public static void getPageRect(Launcher launcher, Rect outRect) {
- DragLayer dl = launcher.getDragLayer();
- Rect targetPadding = getPadding(launcher);
- Rect insets = dl.getInsets();
+ getPageRect(launcher.getDeviceProfile(), launcher, outRect);
+ }
+
+ public static void getPageRect(DeviceProfile grid, Context context, Rect outRect) {
+ Rect targetPadding = getPadding(grid, context);
+ Rect insets = grid.getInsets();
outRect.set(
targetPadding.left + insets.left,
targetPadding.top + insets.top,
- dl.getWidth() - targetPadding.right - insets.right,
- dl.getHeight() - targetPadding.bottom - insets.bottom);
- outRect.top += launcher.getResources()
+ grid.widthPx - targetPadding.right - insets.right,
+ grid.heightPx - targetPadding.bottom - insets.bottom);
+ outRect.top += context.getResources()
.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
}