Fix the expand button changing too soon

The expand button used to change its icon right after it was clicked and
before the animation has finished. This resulted in the icon being changed too soon. This CL fixes this by waiting until the pip transition is finished

Bug: 237269877

Test: Manual
Change-Id: I46d8bc82be7db0532c51aa116ff2dbbf5e09fc68
This commit is contained in:
Ivan Makarov
2022-07-05 16:34:45 +00:00
parent f2c5ecb10c
commit 3b5654d71f
2 changed files with 4 additions and 3 deletions

View File

@@ -200,7 +200,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
void notifyPipAnimating(boolean animating) {
mPipMenuView.setEduTextActive(!animating);
if (!animating) {
mPipMenuView.onPipTransitionFinished();
mPipMenuView.onPipTransitionFinished(mTvPipBoundsState.isTvPipExpanded());
}
}
@@ -267,7 +267,6 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
void updateExpansionState() {
mPipMenuView.setExpandedModeEnabled(mTvPipBoundsState.isTvExpandedPipSupported()
&& mTvPipBoundsState.getDesiredTvExpandedAspectRatio() != 0);
mPipMenuView.setIsExpanded(mTvPipBoundsState.isTvPipExpanded());
}
private Rect calculateMenuSurfaceBounds(Rect pipBounds) {

View File

@@ -266,7 +266,7 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
}
}
void onPipTransitionFinished() {
void onPipTransitionFinished(boolean isTvPipExpanded) {
ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
"%s: onPipTransitionFinished()", TAG);
@@ -277,6 +277,8 @@ public class TvPipMenuView extends FrameLayout implements View.OnClickListener {
.setInterpolator(TvPipInterpolators.ENTER)
.start();
setIsExpanded(isTvPipExpanded);
// Update buttons.
if (mSwitchingOrientation) {
mActionButtonsContainer.animate()