Refactored hotseat translation X logic

Made retrieval of the hotseat translation X easier to use.

Test: Manual. Set the navigation mode to 3-button. Moved the bubble bar
from one side to the other. Switched the navigation mode to gestures.
Moved the bubble bar from one side to the other again.
Bug: 373422448
Flag: EXEMPT refactoring

Change-Id: Ie69f1ecf178244008e5c752882c4b91a30928756
This commit is contained in:
mpodolian committed 2024-10-17 09:46:47 -07:00
1 parent 9c5d8a2059
commit 1d4e75c777
5 files changed
+27 -29

No files matched your search

+10 -5
View File
@@ -2355,18 +2355,23 @@ public class DeviceProfile {
/**
* Returns whether Taskbar and Hotseat should adjust horizontally on bubble bar location update.
*/
public boolean shouldAdjustHotseatOnBubblesLocationUpdate(Context context) {
public boolean shouldAdjustHotseatOnNavBarLocationUpdate(Context context) {
return enableBubbleBar()
&& enableBubbleBarInPersistentTaskBar()
&& !DisplayController.getNavigationMode(context).hasGestures;
}
/** Returns hotseat translation X for the bubble bar position. */
public int getHotseatTranslationXForBubbleBar(boolean isNavbarOnRight, boolean isRtl) {
if (isNavbarOnRight) {
return isRtl ? -navButtonsLayoutWidthPx : 0;
public int getHotseatTranslationXForNavBar(Context context, boolean isBubblesOnLeft) {
if (shouldAdjustHotseatOnNavBarLocationUpdate(context)) {
boolean isRtl = Utilities.isRtl(context.getResources());
if (isBubblesOnLeft) {
return isRtl ? -navButtonsLayoutWidthPx : 0;
} else {
return isRtl ? 0 : navButtonsLayoutWidthPx;
}
} else {
return isRtl ? 0 : navButtonsLayoutWidthPx;
return 0;
}
}