Layout freeform display taskbar using actual icon sizes
The taskbar shown on freeform display taskbar when
enable_desktop_taskbar_on_freeform_displays feature is enabled is
expected to remain in persistent taskbar state (and never
transition to transient taskbar). Given that transitions to transient
taskbar is not expected, use actual peristent taskbar sizing to layout
the taskbar in this case (similar to three-button navigation taskbar).
Bug: 390665752
Flag: com.android.window.flags.enable_desktop_taskbar_on_freeform_displays
Test: manual on desktop device - keep opening apps in desktop mode, and
verify that taskbar does not enter overflow based on transient
taskbar icon dimensions (i.e. that taskbar keeps filling up until
it hits intended horizontal margins)
Change-Id: If6cdadccf0fe4da1462b437a13def78f6050e3bb
This commit is contained in:
@@ -160,7 +160,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
|
||||
int actualMargin = resources.getDimensionPixelSize(R.dimen.taskbar_icon_spacing);
|
||||
int actualIconSize = mActivityContext.getDeviceProfile().taskbarIconSize;
|
||||
if (enableTaskbarPinning() && !mActivityContext.isThreeButtonNav()) {
|
||||
if (enableTaskbarPinning() && canTransitionToTransientTaskbar()) {
|
||||
DeviceProfile deviceProfile = mActivityContext.getTransientTaskbarDeviceProfile();
|
||||
actualIconSize = deviceProfile.taskbarIconSize;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
// All apps icon takes less space compared to normal icon size, reserve space for the icon
|
||||
// separately.
|
||||
boolean forceTransientTaskbarSize =
|
||||
enableTaskbarPinning() && !mActivityContext.isThreeButtonNav();
|
||||
enableTaskbarPinning() && canTransitionToTransientTaskbar();
|
||||
availableWidth -= iconSize - (int) getResources().getDimension(
|
||||
mAllAppsButtonContainer.getAllAppsButtonTranslationXOffset(
|
||||
forceTransientTaskbarSize || mActivityContext.isTransientTaskbar()));
|
||||
@@ -244,6 +244,15 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
return Math.floorDiv(availableWidth, iconSize) + additionalIcons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the taskbar in the state context supports transition to a transient taskbar (e.g.
|
||||
* using a popup menu).
|
||||
*/
|
||||
boolean canTransitionToTransientTaskbar() {
|
||||
return !mActivityContext.isThreeButtonNav()
|
||||
&& !mActivityContext.showDesktopTaskbarForFreeformDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculates the max number of icons the taskbar view can show without entering overflow.
|
||||
* Returns whether the max number of icons changed and the change affects the number of icons
|
||||
|
||||
@@ -563,7 +563,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
sizeDiffTranslationRange *= -1;
|
||||
}
|
||||
|
||||
if (mActivity.isThreeButtonNav()) {
|
||||
if (!mTaskbarView.canTransitionToTransientTaskbar()) {
|
||||
mTaskbarView.getAllAppsButtonContainer()
|
||||
.setTranslationXForTaskbarAllAppsIcon(allAppIconTranslateRange);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user