Merge "Never scale navbar scrim in all apps and widget picker" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
cd46d978bd
@@ -28,6 +28,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.ScrollableLayoutManager.PREDICTIVE_BACK_MIN_SCALE;
|
||||
import static com.android.launcher3.views.RecyclerViewFastScroller.FastScrollerLocation.ALL_APPS_SCROLLER;
|
||||
import static com.android.window.flags.Flags.predictiveBackThreeButtonNav;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
@@ -1173,8 +1174,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
super.dispatchDraw(canvas);
|
||||
|
||||
if (mNavBarScrimHeight > 0) {
|
||||
canvas.drawRect(0, getHeight() - mNavBarScrimHeight, getWidth(), getHeight(),
|
||||
mNavBarScrimPaint);
|
||||
float left = (getWidth() - getWidth() / getScaleX()) / 2;
|
||||
float top = getHeight() / 2f + (getHeight() / 2f - mNavBarScrimHeight) / getScaleY();
|
||||
canvas.drawRect(left, top, getWidth() / getScaleX(),
|
||||
top + mNavBarScrimHeight / getScaleY(), mNavBarScrimPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1340,6 +1343,17 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
invalidateHeader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleY(float scaleY) {
|
||||
super.setScaleY(scaleY);
|
||||
if (predictiveBackThreeButtonNav() && mNavBarScrimHeight > 0) {
|
||||
// Call invalidate to prevent navbar scrim from scaling. The navbar scrim is drawn
|
||||
// directly onto the canvas. To prevent it from being scaled with the canvas, there's a
|
||||
// counter scale applied in dispatchDraw.
|
||||
invalidate(20, getHeight() - mNavBarScrimHeight, getWidth(), getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set {@link Animator.AnimatorListener} on {@link mAllAppsTransitionController} to observe
|
||||
* animation of backing out of all apps search view to all apps view.
|
||||
|
||||
@@ -20,6 +20,7 @@ import static com.android.launcher3.Flags.enableWidgetTapToAdd;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_ADD_BUTTON_TAP;
|
||||
import static com.android.window.flags.Flags.predictiveBackThreeButtonNav;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
@@ -127,6 +128,17 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity>
|
||||
setupNavBarColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setScaleY(float scaleY) {
|
||||
super.setScaleY(scaleY);
|
||||
if (predictiveBackThreeButtonNav() && mNavBarScrimHeight > 0) {
|
||||
// Call invalidate to prevent navbar scrim from scaling. The navbar scrim is drawn
|
||||
// directly onto the canvas. To prevent it from being scaled with the canvas, there's a
|
||||
// counter scale applied in dispatchDraw.
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onClick(View v) {
|
||||
WidgetCell wc;
|
||||
@@ -318,8 +330,10 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity>
|
||||
super.dispatchDraw(canvas);
|
||||
|
||||
if (mNavBarScrimHeight > 0) {
|
||||
canvas.drawRect(0, getHeight() - mNavBarScrimHeight, getWidth(), getHeight(),
|
||||
mNavBarScrimPaint);
|
||||
float left = (getWidth() - getWidth() / getScaleX()) / 2;
|
||||
float top = getHeight() / 2f + (getHeight() / 2f - mNavBarScrimHeight) / getScaleY();
|
||||
canvas.drawRect(left, top, getWidth() / getScaleX(),
|
||||
top + mNavBarScrimHeight / getScaleY(), mNavBarScrimPaint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user