Adjusting Taskbar Icons for larger display size
Bug: 323948193 Test: Manual Flag: NONE Change-Id: I0bdfcaebf3de050ac850fe42c061c82ffebdb7c2
This commit is contained in:
1 parent
9f0042b2c8
commit
e6f349b3dd
3 files changed
+85
-38
No files matched your search
@@ -32,6 +32,7 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.InputDevice;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
@@ -134,7 +135,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()) {
|
||||
if (enableTaskbarPinning() && !mActivityContext.isThreeButtonNav()) {
|
||||
DeviceProfile deviceProfile = mActivityContext.getTransientTaskbarDeviceProfile();
|
||||
actualIconSize = deviceProfile.taskbarIconSize;
|
||||
}
|
||||
@@ -472,6 +473,29 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
iconEnd = centerAlignIconEnd + offset;
|
||||
}
|
||||
|
||||
// Currently, we support only one device with display cutout and we only are concern about
|
||||
// it when the bottom rect is present and non empty
|
||||
DisplayCutout displayCutout = getDisplay().getCutout();
|
||||
if (displayCutout != null && !displayCutout.getBoundingRectBottom().isEmpty()) {
|
||||
Rect cutoutBottomRect = displayCutout.getBoundingRectBottom();
|
||||
// when cutout present at the bottom of screen align taskbar icons to cutout offset
|
||||
// if taskbar icon overlaps with cutout
|
||||
int taskbarIconLeftBound = iconEnd - spaceNeeded;
|
||||
int taskbarIconRightBound = iconEnd;
|
||||
|
||||
boolean doesTaskbarIconsOverlapWithCutout =
|
||||
taskbarIconLeftBound <= cutoutBottomRect.centerX()
|
||||
&& cutoutBottomRect.centerX() <= taskbarIconRightBound;
|
||||
|
||||
if (doesTaskbarIconsOverlapWithCutout) {
|
||||
if (!layoutRtl) {
|
||||
iconEnd = spaceNeeded + cutoutBottomRect.width();
|
||||
} else {
|
||||
iconEnd = right - cutoutBottomRect.width();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sTmpRect.set(mIconLayoutBounds);
|
||||
|
||||
// Layout the children
|
||||
|
||||
Reference in new issue
Block a user