3 button nav is laid out correctly.
Updated logic of laying out the 3 nav buttons container. Also updated placement of the hotseat, so it is not shifted on the phone. Test: Manual. Fold and unfold felix with and without bubbles. Reboot the devices and perform the same test. Fixes: 370773620 Flag: com.android.wm.shell.enable_bubble_bar Change-Id: I7d5ba51f7ded275f7456a8690d04001b9651f6c5
This commit is contained in:
@@ -406,6 +406,12 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
}
|
||||
};
|
||||
mSeparateWindowParent.recreateControllers();
|
||||
if (BubbleBarController.isBubbleBarEnabled()) {
|
||||
mNavButtonsView.addOnLayoutChangeListener(
|
||||
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) ->
|
||||
onLayoutsUpdated()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void initButtons(ViewGroup navContainer, ViewGroup endContainer,
|
||||
@@ -1180,15 +1186,20 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
/** Adjusts navigation buttons layout accordingly to the bubble bar position. */
|
||||
@Override
|
||||
public void onBubbleBarLocationUpdated(BubbleBarLocation location) {
|
||||
cancelExistingNavBarAnimation();
|
||||
mBubbleBarTargetLocation = location;
|
||||
boolean locationUpdated = location != mBubbleBarTargetLocation;
|
||||
if (locationUpdated) {
|
||||
cancelExistingNavBarAnimation();
|
||||
} else {
|
||||
endExistingAnimation();
|
||||
}
|
||||
mNavButtonContainer.setTranslationX(getNavBarTranslationX(location));
|
||||
mNavButtonContainer.setAlpha(1);
|
||||
mBubbleBarTargetLocation = location;
|
||||
}
|
||||
|
||||
/** Animates navigation buttons accordingly to the bubble bar position. */
|
||||
@Override
|
||||
public void onBubbleBarLocationAnimated(BubbleBarLocation location) {
|
||||
if (location == mBubbleBarTargetLocation) return;
|
||||
cancelExistingNavBarAnimation();
|
||||
mBubbleBarTargetLocation = location;
|
||||
int finalX = getNavBarTranslationX(location);
|
||||
@@ -1199,6 +1210,13 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
mNavBarLocationAnimator.start();
|
||||
}
|
||||
|
||||
private void endExistingAnimation() {
|
||||
if (mNavBarLocationAnimator != null) {
|
||||
mNavBarLocationAnimator.end();
|
||||
mNavBarLocationAnimator = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void cancelExistingNavBarAnimation() {
|
||||
if (mNavBarLocationAnimator != null) {
|
||||
mNavBarLocationAnimator.cancel();
|
||||
@@ -1240,12 +1258,18 @@ public class NavbarButtonsViewController implements TaskbarControllers.LoggableT
|
||||
}
|
||||
|
||||
/** Adjusts the navigation buttons layout position according to the bubble bar location. */
|
||||
public void onTaskbarLayoutChanged() {
|
||||
if (mControllers.taskbarViewController.getIconLayoutBounds().isEmpty()) return;
|
||||
public void onLayoutsUpdated() {
|
||||
// no need to do anything if on phone, or if taskbar or navbar views were not placed on
|
||||
// screen.
|
||||
if (mContext.getDeviceProfile().isPhone
|
||||
|| mControllers.taskbarViewController.getIconLayoutBounds().isEmpty()
|
||||
|| mNavButtonsView.getWidth() == 0) {
|
||||
return;
|
||||
}
|
||||
if (enableBubbleBarInPersistentTaskBar()
|
||||
&& mControllers.bubbleControllers.isPresent()) {
|
||||
if (mBubbleBarTargetLocation == null) {
|
||||
// only set bubble bar location if it was not set before, e.g. at device boot
|
||||
// only set bubble bar location if it was not set before
|
||||
mBubbleBarTargetLocation = mControllers.bubbleControllers.get()
|
||||
.bubbleBarViewController.getBubbleBarLocation();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user