Fixing custom content screen not aligned properly in landscape
am: ecdc24f6f6
* commit 'ecdc24f6f667319db56a16dd7d1efda16dfe662e':
Fixing custom content screen not aligned properly in landscape
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index 71ccd85..55a512f 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -14,6 +14,7 @@
private final Paint mOpaquePaint;
private boolean mDrawRightInsetBar;
+ private int mRightInsetBarWidth;
private View mAlignedView;
@@ -41,9 +42,10 @@
mDrawRightInsetBar = insets.right > 0 &&
(!Utilities.ATLEAST_MARSHMALLOW ||
getContext().getSystemService(ActivityManager.class).isLowRamDevice());
+ mRightInsetBarWidth = insets.right;
setInsets(mDrawRightInsetBar ? new Rect(0, insets.top, 0, insets.bottom) : insets);
- if (mAlignedView != null) {
+ if (mAlignedView != null && mDrawRightInsetBar) {
// Apply margins on aligned view to handle left/right insets.
MarginLayoutParams lp = (MarginLayoutParams) mAlignedView.getLayoutParams();
if (lp.leftMargin != insets.left || lp.rightMargin != insets.right) {
@@ -63,7 +65,7 @@
// If the right inset is opaque, draw a black rectangle to ensure that is stays opaque.
if (mDrawRightInsetBar) {
int width = getWidth();
- canvas.drawRect(width - mInsets.right, 0, width, getHeight(), mOpaquePaint);
+ canvas.drawRect(width - mRightInsetBarWidth, 0, width, getHeight(), mOpaquePaint);
}
}
}
\ No newline at end of file
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index d0f15c6..d4cacea 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -798,7 +798,7 @@
childWidthMode = MeasureSpec.EXACTLY;
childHeightMode = MeasureSpec.EXACTLY;
- childWidth = getViewportWidth() - mInsets.left - mInsets.right;
+ childWidth = getViewportWidth();
childHeight = getViewportHeight();
}
if (referenceChildWidth == 0) {