mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Merge "Allapps motion changes for landscape" into ub-launcher3-dorval-polish
This commit is contained in:
committed by
Android (Google) Code Review
commit
94652a207f
@@ -276,7 +276,8 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
||||
|
||||
private void updateLightStatusBar(float shift) {
|
||||
// Do not modify status bar on landscape as all apps is not full bleed.
|
||||
if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
|
||||
if (!FeatureFlags.LAUNCHER3_GRADIENT_ALL_APPS
|
||||
&& mLauncher.getDeviceProfile().isVerticalBarLayout()) {
|
||||
return;
|
||||
}
|
||||
// Use a light status bar (dark icons) if all apps is behind at least half of the status
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.view.View;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
|
||||
@@ -59,12 +60,15 @@ public class GradientView extends View {
|
||||
private final Context mAppContext;
|
||||
private final Paint mDebugPaint = DEBUG ? new Paint() : null;
|
||||
private final Interpolator mAccelerator = new AccelerateInterpolator();
|
||||
private final float mAlphaStart;
|
||||
|
||||
public GradientView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.mAppContext = context.getApplicationContext();
|
||||
this.mMaskHeight = Utilities.pxFromDp(GRADIENT_ALPHA_MASK_LENGTH_DP,
|
||||
mAppContext.getResources().getDisplayMetrics());
|
||||
this.mAlphaStart = Launcher.getLauncher(context)
|
||||
.getDeviceProfile().isVerticalBarLayout() ? 0 : 100;
|
||||
|
||||
if (sFinalGradientMask == null) {
|
||||
sFinalGradientMask = Utilities.convertToAlphaMask(
|
||||
@@ -122,9 +126,8 @@ public class GradientView extends View {
|
||||
float head = 0.29f;
|
||||
float linearProgress = head + (mProgress * (1f - head));
|
||||
float startMaskY = (1f - linearProgress) * mHeight - mMaskHeight * linearProgress;
|
||||
float startAlpha = 100;
|
||||
float interpolatedAlpha = (255 - startAlpha) * mAccelerator.getInterpolation(mProgress);
|
||||
mPaint.setAlpha((int) (startAlpha + interpolatedAlpha));
|
||||
float interpolatedAlpha = (255 - mAlphaStart) * mAccelerator.getInterpolation(mProgress);
|
||||
mPaint.setAlpha((int) (mAlphaStart + interpolatedAlpha));
|
||||
mAlphaMaskRect.set(0, startMaskY, mWidth, startMaskY + mMaskHeight);
|
||||
mFinalMaskRect.set(0, startMaskY + mMaskHeight, mWidth, mHeight);
|
||||
canvas.drawBitmap(sAlphaGradientMask, null, mAlphaMaskRect, mPaint);
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.view.View;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
|
||||
@@ -56,12 +57,15 @@ public class ScrimView extends View {
|
||||
private float mProgress;
|
||||
private final Interpolator mAccelerator = new AccelerateInterpolator();
|
||||
private final Paint mDebugPaint = DEBUG ? new Paint() : null;
|
||||
private final int mAlphaStart;
|
||||
|
||||
public ScrimView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mMaskHeight = Utilities.pxFromDp(MASK_HEIGHT_DP, getResources().getDisplayMetrics());
|
||||
mHeadStart = (int) (mMaskHeight * MASK_START_LENGTH_FACTOR);
|
||||
mPaint.setColor(SCRIM_COLOR);
|
||||
mAlphaStart = Launcher.getLauncher(context)
|
||||
.getDeviceProfile().isVerticalBarLayout() ? 0 : 55;
|
||||
|
||||
if (sFinalScrimMask == null) {
|
||||
sFinalScrimMask = Utilities.convertToAlphaMask(
|
||||
@@ -91,7 +95,8 @@ public class ScrimView extends View {
|
||||
setTranslationY(linTranslationY);
|
||||
|
||||
if (APPLY_ALPHA) {
|
||||
int alpha = 55 + (int) (200f * mAccelerator.getInterpolation(progress));
|
||||
int alpha = mAlphaStart + (int) ((255f - mAlphaStart)
|
||||
* mAccelerator.getInterpolation(progress));
|
||||
mPaint.setAlpha(alpha);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user