Fix placement bug with split staging icon in RtL
Fixes a bug where switching the phone to RtL caused Overview's split staging icon to be placed incorrectly. The bug was caused by the fact that FrameLayout margins were not working consistently in RtL. This may be another bug; more investigation required (b/201920967). This fix makes it so that the icon is positioned using setX and setY rather than margins. Fixes: 227372971 Test: Manual Change-Id: I6e5371d20e8e2e4e6f41ba93d0dfa36ed085c103
This commit is contained in:
1 parent
db2c726560
commit
43c79704ed
4 files changed
+19
-22
No files matched your search
@@ -487,29 +487,29 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStagedSplitIconParams(FrameLayout.LayoutParams out, float onScreenRectCenterX,
|
||||
public void updateStagedSplitIconParams(View out, float onScreenRectCenterX,
|
||||
float onScreenRectCenterY, float fullscreenScaleX, float fullscreenScaleY,
|
||||
int drawableWidth, int drawableHeight, DeviceProfile dp,
|
||||
@StagePosition int stagePosition) {
|
||||
boolean pinToRight = stagePosition == STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
if (!dp.isLandscape) {
|
||||
float inset = dp.getInsets().top;
|
||||
out.leftMargin = Math.round(onScreenRectCenterX / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2);
|
||||
out.topMargin = Math.round((onScreenRectCenterY + (inset / 2f)) / fullscreenScaleY
|
||||
- 1.0f * drawableHeight / 2);
|
||||
out.setX(Math.round(onScreenRectCenterX / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2));
|
||||
out.setY(Math.round((onScreenRectCenterY + (inset / 2f)) / fullscreenScaleY
|
||||
- 1.0f * drawableHeight / 2));
|
||||
} else {
|
||||
if (pinToRight) {
|
||||
float inset = dp.getInsets().right;
|
||||
out.leftMargin = Math.round((onScreenRectCenterX - (inset / 2f)) / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2);
|
||||
out.setX(Math.round((onScreenRectCenterX - (inset / 2f)) / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2));
|
||||
} else {
|
||||
float inset = dp.getInsets().left;
|
||||
out.leftMargin = Math.round((onScreenRectCenterX + (inset / 2f)) / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2);
|
||||
out.setX(Math.round((onScreenRectCenterX + (inset / 2f)) / fullscreenScaleX
|
||||
- 1.0f * drawableWidth / 2));
|
||||
}
|
||||
out.topMargin = Math.round(onScreenRectCenterY / fullscreenScaleY
|
||||
- 1.0f * drawableHeight / 2);
|
||||
out.setY(Math.round(onScreenRectCenterY / fullscreenScaleY
|
||||
- 1.0f * drawableHeight / 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user