mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Implement non-disappearing View for split staging instructions
The instructions for how to perform a splitscreen operation, previously conveyed through a disappearing Toast, are now conveyed through a custom View object. Fixes: 219987907 Test: Manual Change-Id: Iff2bb6e334e0325e8a091d76a5f9b8767071365f
This commit is contained in:
@@ -19,6 +19,7 @@ package com.android.launcher3.touch;
|
||||
import static android.view.Gravity.BOTTOM;
|
||||
import static android.view.Gravity.CENTER_VERTICAL;
|
||||
import static android.view.Gravity.END;
|
||||
import static android.view.Gravity.LEFT;
|
||||
import static android.view.Gravity.START;
|
||||
import static android.view.Gravity.TOP;
|
||||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
@@ -424,6 +425,28 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
|
||||
- 1.0f * drawableHeight / 2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSplitInstructionsParams(View out, DeviceProfile dp, int splitInstructionsHeight,
|
||||
int splitInstructionsWidth, int threeButtonNavShift) {
|
||||
out.setPivotX(0);
|
||||
out.setPivotY(0);
|
||||
out.setRotation(getDegreesRotated());
|
||||
int distanceToEdge = out.getResources().getDimensionPixelSize(
|
||||
R.dimen.split_instructions_bottom_margin_phone_landscape);
|
||||
// Adjust for any insets on the left edge
|
||||
int insetCorrectionX = dp.getInsets().left;
|
||||
// Center the view in case of unbalanced insets on top or bottom of screen
|
||||
int insetCorrectionY = (dp.getInsets().bottom - dp.getInsets().top) / 2;
|
||||
out.setTranslationX(splitInstructionsHeight + distanceToEdge - insetCorrectionX);
|
||||
out.setTranslationY(((splitInstructionsHeight - splitInstructionsWidth) / 2f)
|
||||
+ insetCorrectionY);
|
||||
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) out.getLayoutParams();
|
||||
// Setting gravity to LEFT instead of the lint-recommended START because we always want this
|
||||
// view to be screen-left when phone is in landscape, regardless of the RtL setting.
|
||||
lp.gravity = LEFT | CENTER_VERTICAL;
|
||||
out.setLayoutParams(lp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFinalSplitPlaceholderBounds(int splitDividerSize, DeviceProfile dp,
|
||||
@StagePosition int stagePosition, Rect out1, Rect out2) {
|
||||
|
||||
Reference in New Issue
Block a user