Merge "TV PiP: fix menu buttons orientation" into udc-dev am: cb5117e0a2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22336125

Change-Id: I74d9a5948250ef1fb9e7e7cdac44ab05d244d5d4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Galia Peycheva
2023-04-04 12:49:29 +00:00
committed by Automerger Merge Worker

View File

@@ -92,7 +92,6 @@ public class TvPipMenuView extends FrameLayout implements TvPipActionsProvider.L
private @TvPipMenuController.TvPipMenuMode int mCurrentMenuMode = MODE_NO_MENU; private @TvPipMenuController.TvPipMenuMode int mCurrentMenuMode = MODE_NO_MENU;
private final Rect mCurrentPipBounds = new Rect(); private final Rect mCurrentPipBounds = new Rect();
private int mCurrentPipGravity; private int mCurrentPipGravity;
private boolean mSwitchingOrientation;
private final AccessibilityManager mA11yManager; private final AccessibilityManager mA11yManager;
private final Handler mMainHandler; private final Handler mMainHandler;
@@ -176,17 +175,12 @@ public class TvPipMenuView extends FrameLayout implements TvPipActionsProvider.L
} }
if (mCurrentMenuMode == MODE_ALL_ACTIONS_MENU) { if (mCurrentMenuMode == MODE_ALL_ACTIONS_MENU) {
mSwitchingOrientation = true; // Fade out while orientation change is ongoing and fade back in once transition is
// finished.
mActionButtonsRecyclerView.animate() mActionButtonsRecyclerView.animate()
.alpha(0) .alpha(0)
.setInterpolator(TvPipInterpolators.EXIT) .setInterpolator(TvPipInterpolators.EXIT)
.setDuration(mResizeAnimationDuration / 2) .setDuration(mResizeAnimationDuration / 2);
.withEndAction(() -> {
mButtonLayoutManager.setOrientation(vertical
? LinearLayoutManager.VERTICAL : LinearLayoutManager.HORIZONTAL);
// Only make buttons visible again in onPipTransitionFinished to keep in
// sync with PiP content alpha animation.
});
} else { } else {
mButtonLayoutManager.setOrientation(vertical mButtonLayoutManager.setOrientation(vertical
? LinearLayoutManager.VERTICAL : LinearLayoutManager.HORIZONTAL); ? LinearLayoutManager.VERTICAL : LinearLayoutManager.HORIZONTAL);
@@ -208,13 +202,16 @@ public class TvPipMenuView extends FrameLayout implements TvPipActionsProvider.L
mEduTextDrawer.init(); mEduTextDrawer.init();
} }
if (mSwitchingOrientation) { mButtonLayoutManager.setOrientation(
mCurrentPipBounds.height() > mCurrentPipBounds.width()
? LinearLayoutManager.VERTICAL : LinearLayoutManager.HORIZONTAL);
if (mCurrentMenuMode == MODE_ALL_ACTIONS_MENU
&& mActionButtonsRecyclerView.getAlpha() != 1f) {
mActionButtonsRecyclerView.animate() mActionButtonsRecyclerView.animate()
.alpha(1) .alpha(1)
.setInterpolator(TvPipInterpolators.ENTER) .setInterpolator(TvPipInterpolators.ENTER)
.setDuration(mResizeAnimationDuration / 2); .setDuration(mResizeAnimationDuration / 2);
} }
mSwitchingOrientation = false;
} }
/** /**