mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Fixing custom content screen not aligned properly in landscape
Bug: 26413100 Change-Id: I1a111c9d2b0dfdfbc3cbd566e5784a1ed2bb6719
This commit is contained in:
@@ -14,6 +14,7 @@ public class LauncherRootView extends InsettableFrameLayout {
|
||||
|
||||
private final Paint mOpaquePaint;
|
||||
private boolean mDrawRightInsetBar;
|
||||
private int mRightInsetBarWidth;
|
||||
|
||||
private View mAlignedView;
|
||||
|
||||
@@ -41,9 +42,10 @@ public class LauncherRootView extends InsettableFrameLayout {
|
||||
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 @@ public class LauncherRootView extends InsettableFrameLayout {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -819,7 +819,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
||||
childWidthMode = MeasureSpec.EXACTLY;
|
||||
childHeightMode = MeasureSpec.EXACTLY;
|
||||
|
||||
childWidth = getViewportWidth() - mInsets.left - mInsets.right;
|
||||
childWidth = getViewportWidth();
|
||||
childHeight = getViewportHeight();
|
||||
}
|
||||
if (referenceChildWidth == 0) {
|
||||
|
||||
Reference in New Issue
Block a user