Never scale navbar scrim in all apps and widget picker
The navbar scrim is scaled during the predictive back animation. This should be prevented since the navbar itself does not change it's position or scale. Bug: 373544911 Test: Manual, i.e. verifying that the navbar scrim remains in its original position during the predictive back animation (with 3-button-nav) on phones and tablets Flag: com.android.window.flags.predictive_back_three_button_nav Change-Id: Iaffd31de5493dea8c856ad3d5b441cca066bbad8
This commit is contained in:
1 parent
bda5d70e03
commit
c87d41f369
2 files changed
+32
-4
No files matched your search
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user