Merge "Removing support for fake landscape" into ub-launcher3-master
This commit is contained in:
commit
34a9d75238
24 files changed
+64
-642
No files matched your search
@@ -88,9 +88,7 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
super.onCreate(savedInstanceState);
|
||||
mSystemActions = new SystemActions(this);
|
||||
|
||||
SysUINavigationMode.Mode mode = SysUINavigationMode.INSTANCE.get(this)
|
||||
.addModeChangeListener(this);
|
||||
getRotationHelper().setRotationHadDifferentUI(mode != Mode.NO_BUTTON);
|
||||
SysUINavigationMode.INSTANCE.get(this).addModeChangeListener(this);
|
||||
|
||||
if (!getSharedPrefs().getBoolean(HOME_BOUNCE_SEEN, false)) {
|
||||
getStateManager().addStateListener(new LauncherStateManager.StateListener() {
|
||||
@@ -141,7 +139,6 @@ public abstract class BaseQuickstepLauncher extends Launcher
|
||||
@Override
|
||||
public void onNavigationModeChanged(Mode newMode) {
|
||||
getDragLayer().recreateControllers();
|
||||
getRotationHelper().setRotationHadDifferentUI(newMode != Mode.NO_BUTTON);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,12 +17,8 @@ package com.android.quickstep.util;
|
||||
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.view.Gravity;
|
||||
import android.view.Surface;
|
||||
|
||||
import com.android.launcher3.graphics.RotationMode;
|
||||
import com.android.launcher3.util.DefaultDisplay;
|
||||
import com.android.quickstep.SysUINavigationMode;
|
||||
|
||||
@@ -31,79 +27,6 @@ import com.android.quickstep.SysUINavigationMode;
|
||||
*/
|
||||
public class NavBarPosition {
|
||||
|
||||
public static final RotationMode ROTATION_LANDSCAPE = new RotationMode(-90) {
|
||||
@Override
|
||||
public void mapRect(int left, int top, int right, int bottom, Rect out) {
|
||||
out.left = top;
|
||||
out.top = right;
|
||||
out.right = bottom;
|
||||
out.bottom = left;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapInsets(Context context, Rect insets, Rect out) {
|
||||
// If there is a display cutout, the top insets in portrait would also include the
|
||||
// cutout, which we will get as the left inset in landscape. Using the max of left and
|
||||
// top allows us to cover both cases (with or without cutout).
|
||||
if (SysUINavigationMode.getMode(context) == NO_BUTTON) {
|
||||
out.top = Math.max(insets.top, insets.left);
|
||||
out.bottom = Math.max(insets.right, insets.bottom);
|
||||
out.left = out.right = 0;
|
||||
} else {
|
||||
out.top = Math.max(insets.top, insets.left);
|
||||
out.bottom = insets.right;
|
||||
out.left = insets.bottom;
|
||||
out.right = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public static final RotationMode ROTATION_SEASCAPE = new RotationMode(90) {
|
||||
@Override
|
||||
public void mapRect(int left, int top, int right, int bottom, Rect out) {
|
||||
out.left = bottom;
|
||||
out.top = left;
|
||||
out.right = top;
|
||||
out.bottom = right;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapInsets(Context context, Rect insets, Rect out) {
|
||||
if (SysUINavigationMode.getMode(context) == NO_BUTTON) {
|
||||
out.top = Math.max(insets.top, insets.right);
|
||||
out.bottom = Math.max(insets.left, insets.bottom);
|
||||
out.left = out.right = 0;
|
||||
} else {
|
||||
out.top = Math.max(insets.top, insets.right);
|
||||
out.bottom = insets.left;
|
||||
out.right = insets.bottom;
|
||||
out.left = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int toNaturalGravity(int absoluteGravity) {
|
||||
int horizontalGravity = absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK;
|
||||
int verticalGravity = absoluteGravity & Gravity.VERTICAL_GRAVITY_MASK;
|
||||
|
||||
if (horizontalGravity == Gravity.RIGHT) {
|
||||
horizontalGravity = Gravity.LEFT;
|
||||
} else if (horizontalGravity == Gravity.LEFT) {
|
||||
horizontalGravity = Gravity.RIGHT;
|
||||
}
|
||||
|
||||
if (verticalGravity == Gravity.TOP) {
|
||||
verticalGravity = Gravity.BOTTOM;
|
||||
} else if (verticalGravity == Gravity.BOTTOM) {
|
||||
verticalGravity = Gravity.TOP;
|
||||
}
|
||||
|
||||
return ((absoluteGravity & ~Gravity.HORIZONTAL_GRAVITY_MASK)
|
||||
& ~Gravity.VERTICAL_GRAVITY_MASK)
|
||||
| horizontalGravity | verticalGravity;
|
||||
}
|
||||
};
|
||||
|
||||
private final SysUINavigationMode.Mode mMode;
|
||||
private final int mDisplayRotation;
|
||||
|
||||
@@ -120,8 +43,7 @@ public class NavBarPosition {
|
||||
return mMode != NO_BUTTON && mDisplayRotation == Surface.ROTATION_270;
|
||||
}
|
||||
|
||||
public RotationMode getRotationMode() {
|
||||
return isLeftEdge() ? ROTATION_SEASCAPE
|
||||
: (isRightEdge() ? ROTATION_LANDSCAPE : RotationMode.NORMAL);
|
||||
public float getRotation() {
|
||||
return isLeftEdge() ? 90 : (isRightEdge() ? -90 : 0);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user