Align 3 button nav with hotseat

* Animate translationY alongside icons
* When device rotates on home, update
translationY
* Add padding to contextual buttons to center
it

Bug: 189807374
Change-Id: I149ef25df570fb1fd385f1da960c827105ff975d
This commit is contained in:
Vinit Nayak
2021-10-12 21:41:13 -07:00
parent 60c64adeed
commit 74b25ca266
7 changed files with 48 additions and 15 deletions

View File

@@ -95,6 +95,9 @@ public class NavbarButtonsViewController {
private final ViewGroup mEndContextualContainer;
private final ViewGroup mStartContextualContainer;
private final AnimatedFloat mTaskbarNavButtonTranslationY = new AnimatedFloat(
this::updateNavButtonTranslationY);
// Initialized in init.
private TaskbarControllers mControllers;
private View mA11yButton;
@@ -133,8 +136,7 @@ public class NavbarButtonsViewController {
mControllers.navButtonController, R.id.ime_switcher);
mPropertyHolders.add(new StatePropertyHolder(imeSwitcherButton,
flags -> ((flags & MASK_IME_SWITCHER_VISIBLE) == MASK_IME_SWITCHER_VISIBLE)
&& ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)
&& ((flags & FLAG_A11Y_VISIBLE) == 0)));
&& ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)));
mPropertyHolders.add(new StatePropertyHolder(
mControllers.taskbarViewController.getTaskbarIconAlpha()
@@ -305,6 +307,11 @@ public class NavbarButtonsViewController {
}
}
/** Use to set the translationY for the all nav+contextual buttons */
public AnimatedFloat getTaskbarNavButtonTranslationY() {
return mTaskbarNavButtonTranslationY;
}
/**
* Does not call {@link #applyState()}. Don't forget to!
*/
@@ -323,6 +330,10 @@ public class NavbarButtonsViewController {
}
}
private void updateNavButtonTranslationY() {
mNavButtonsView.setTranslationY(mTaskbarNavButtonTranslationY.value);
}
private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
ViewGroup parent, TaskbarNavButtonController navButtonController, @IdRes int id) {
return addButton(drawableId, buttonType, parent, navButtonController, id,