Merge "Only inset IME by 48dp instead of 60dp when taskbar is present" into sc-v2-dev am: 5692501806 am: 1b578f3b71

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16433862

Change-Id: Idc3d1364d374fb33e5845f249be80ba3408c9b0c
This commit is contained in:
TreeHugger Robot
2021-12-10 00:24:54 +00:00
committed by Automerger Merge Worker
3 changed files with 47 additions and 13 deletions

View File

@@ -106,6 +106,9 @@ public class NavbarButtonsViewController {
private final AnimatedFloat mTaskbarNavButtonTranslationY = new AnimatedFloat(
this::updateNavButtonTranslationY);
private final AnimatedFloat mTaskbarNavButtonTranslationYForIme = new AnimatedFloat(
this::updateNavButtonTranslationY);
// Only applies to mTaskbarNavButtonTranslationY
private final AnimatedFloat mNavButtonTranslationYMultiplier = new AnimatedFloat(
this::updateNavButtonTranslationY);
private final AnimatedFloat mTaskbarNavButtonDarkIntensity = new AnimatedFloat(
@@ -162,14 +165,26 @@ public class NavbarButtonsViewController {
.getKeyguardBgTaskbar(),
flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, AnimatedFloat.VALUE, 1, 0));
// Make sure to remove nav bar buttons translation when notification shade is expanded.
mPropertyHolders.add(new StatePropertyHolder(mNavButtonTranslationYMultiplier,
flags -> (flags & FLAG_NOTIFICATION_SHADE_EXPANDED) != 0, AnimatedFloat.VALUE,
0, 1));
// Force nav buttons (specifically back button) to be visible during setup wizard.
boolean isInSetup = !mContext.isUserSetupComplete();
if (isThreeButtonNav || isInSetup) {
boolean alwaysShowButtons = isThreeButtonNav || isInSetup;
// Make sure to remove nav bar buttons translation when notification shade is expanded or
// IME is showing (add separate translation for IME).
int flagsToRemoveTranslation = FLAG_NOTIFICATION_SHADE_EXPANDED | FLAG_IME_VISIBLE;
mPropertyHolders.add(new StatePropertyHolder(mNavButtonTranslationYMultiplier,
flags -> (flags & flagsToRemoveTranslation) != 0, AnimatedFloat.VALUE,
0, 1));
// Center nav buttons in new height for IME.
float transForIme = (mContext.getDeviceProfile().taskbarSize
- mContext.getTaskbarHeightForIme()) / 2f;
// For gesture nav, nav buttons only show for IME anyway so keep them translated down.
float defaultButtonTransY = alwaysShowButtons ? 0 : transForIme;
mPropertyHolders.add(new StatePropertyHolder(mTaskbarNavButtonTranslationYForIme,
flags -> (flags & FLAG_IME_VISIBLE) != 0, AnimatedFloat.VALUE, transForIme,
defaultButtonTransY));
if (alwaysShowButtons) {
initButtons(mNavButtonContainer, mEndContextualContainer,
mControllers.navButtonController);
@@ -408,8 +423,10 @@ public class NavbarButtonsViewController {
}
private void updateNavButtonTranslationY() {
mNavButtonsView.setTranslationY(mTaskbarNavButtonTranslationY.value
* mNavButtonTranslationYMultiplier.value);
float normalTranslationY = mTaskbarNavButtonTranslationY.value
* mNavButtonTranslationYMultiplier.value;
float otherTranslationY = mTaskbarNavButtonTranslationYForIme.value;
mNavButtonsView.setTranslationY(normalTranslationY + otherTranslationY);
}
private void updateNavButtonDarkIntensity() {