Create new DeviceProfile when in multi window mode.

This is just a first pass to help make the codebase ready for MW mode.
ie. won't see the effects of this unless resizeableActivity is set to true
in the Android Manifest.

Also allows long clicks from edge when in MW mode.

Bug: 32176631
Change-Id: I48e5cb3bd15e70627d9bf007d93bc731612fba2e
This commit is contained in:
Jon Miranda committed 2016-11-01 09:00:20 -07:00
1 parent 2962d52dee
commit cc42c5bd10
2 files changed
+31 -8

No files matched your search

@@ -205,6 +205,13 @@ public class DeviceProfile {
computeAllAppsButtonSize(context);
}
DeviceProfile getMultiWindowProfile(Context context, Point mwSize) {
// In multi-window mode, we can have widthPx = availableWidthPx
// and heightPx = availableHeightPx because Launcher uses the InvariantDeviceProfiles'
// widthPx and heightPx values where it's needed.
return new DeviceProfile(context, inv, mwSize, mwSize, mwSize.x, mwSize.y, isLandscape);
}
public void addLauncherLayoutChangedListener(LauncherLayoutChangeListener listener) {
if (!mListeners.contains(listener)) {
mListeners.add(listener);
@@ -599,4 +606,11 @@ public class DeviceProfile {
hotseatBarHeightPx + hotseatLandGutterPx + mInsets.left) / 2;
return new int[]{ padding, padding };
}
public boolean shouldIgnoreLongPressToOverview(float touchX, float edgeThreshold) {
boolean inMultiWindowMode = this != inv.landscapeProfile && this != inv.portraitProfile;
boolean touchedLhsEdge = mInsets.left == 0 && touchX < edgeThreshold;
boolean touchedRhsEdge = mInsets.right == 0 && touchX > (widthPx - edgeThreshold);
return !inMultiWindowMode && (touchedLhsEdge || touchedRhsEdge);
}
}