From 418d443d2fdf4bade836eef35ec6732ae07a73fe Mon Sep 17 00:00:00 2001 From: Mario Bertschler Date: Wed, 24 May 2017 17:56:56 +0000 Subject: [PATCH] Revert "Allapps motion changes for landscape" This reverts commit d15dccf10eec367e38b8723c409909a29307057a. Change-Id: I04c06d419bc636929259bc5f4fdce982d97ef33f --- res/layout/gradient_scrim.xml | 3 +- .../android/launcher3/graphics/ScrimView.java | 49 ++----------------- 2 files changed, 6 insertions(+), 46 deletions(-) diff --git a/res/layout/gradient_scrim.xml b/res/layout/gradient_scrim.xml index 15516b0284..c40c5fc0c8 100644 --- a/res/layout/gradient_scrim.xml +++ b/res/layout/gradient_scrim.xml @@ -26,5 +26,6 @@ android:id="@+id/scrim_bg" android:layout_width="match_parent" android:layout_height="match_parent" - android:visibility="gone"/> + android:visibility="gone" + app:layout_ignoreInsets="true"/> \ No newline at end of file diff --git a/src/com/android/launcher3/graphics/ScrimView.java b/src/com/android/launcher3/graphics/ScrimView.java index c102cabb12..feb3f030f0 100644 --- a/src/com/android/launcher3/graphics/ScrimView.java +++ b/src/com/android/launcher3/graphics/ScrimView.java @@ -29,12 +29,10 @@ import android.view.View; import android.view.animation.AccelerateInterpolator; import android.view.animation.Interpolator; -import com.android.launcher3.DeviceProfile; -import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.Utilities; -public class ScrimView extends View implements DeviceProfile.LauncherLayoutChangeListener { +public class ScrimView extends View { private static final boolean DEBUG = false; @@ -59,10 +57,6 @@ public class ScrimView extends View implements DeviceProfile.LauncherLayoutChang private final Interpolator mAccelerator = new AccelerateInterpolator(); private final Paint mDebugPaint = DEBUG ? new Paint() : null; - private int mPaddingLeft; - private int mPaddingRight; - private int mAlphaStart; - public ScrimView(Context context, AttributeSet attrs) { super(context, attrs); mMaskHeight = Utilities.pxFromDp(MASK_HEIGHT_DP, getResources().getDisplayMetrics()); @@ -80,21 +74,6 @@ public class ScrimView extends View implements DeviceProfile.LauncherLayoutChang } } - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - updatePaddingAndAlphaStart(); - Launcher.getLauncher(getContext()).getDeviceProfile() - .addLauncherLayoutChangedListener(this); - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - Launcher.getLauncher(getContext()).getDeviceProfile() - .removeLauncherLayoutChangedListener(this); - } - @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); @@ -112,8 +91,7 @@ public class ScrimView extends View implements DeviceProfile.LauncherLayoutChang setTranslationY(linTranslationY); if (APPLY_ALPHA) { - int alpha = mAlphaStart + (int) ((255f - mAlphaStart) - * mAccelerator.getInterpolation(progress)); + int alpha = 55 + (int) (200f * mAccelerator.getInterpolation(progress)); mPaint.setAlpha(alpha); invalidate(); } @@ -121,8 +99,8 @@ public class ScrimView extends View implements DeviceProfile.LauncherLayoutChang @Override protected void onDraw(Canvas canvas) { - mAlphaMaskRect.set(mPaddingLeft, 0, getWidth() - mPaddingRight, mMaskHeight); - mFinalMaskRect.set(mPaddingLeft, mMaskHeight, getWidth() - mPaddingRight, getHeight()); + mAlphaMaskRect.set(0, 0, getWidth(), mMaskHeight); + mFinalMaskRect.set(0, mMaskHeight, getWidth(), getHeight()); canvas.drawBitmap(sAlphaScrimMask, null, mAlphaMaskRect, mPaint); canvas.drawBitmap(sFinalScrimMask, null, mFinalMaskRect, mPaint); @@ -133,23 +111,4 @@ public class ScrimView extends View implements DeviceProfile.LauncherLayoutChang } } - @Override - public void onLauncherLayoutChanged() { - updatePaddingAndAlphaStart(); - invalidate(); - } - - private void updatePaddingAndAlphaStart() { - DeviceProfile grid = Launcher.getLauncher(getContext()).getDeviceProfile(); - if (grid.isVerticalBarLayout()) { - int[] padding = grid.getContainerPadding(); - mPaddingLeft = padding[0] + grid.edgeMarginPx; - mPaddingRight = padding[1] + grid.edgeMarginPx; - mAlphaStart = 0; - } else { - mPaddingLeft = 0; - mPaddingRight = 0; - mAlphaStart = 55; - } - } }