Merge "Fix tv edu text drawer not closing completely" into udc-dev am: 17c8bbca2e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22356783 Change-Id: I8a7b2a6613481599880f7a8f23b0c3525500ea96 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
|||||||
|
|
||||||
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE;
|
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@@ -115,6 +116,10 @@ class TvPipMenuEduTextDrawer extends FrameLayout {
|
|||||||
scheduleLifecycleEvents();
|
scheduleLifecycleEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getEduTextDrawerHeight() {
|
||||||
|
return getVisibility() == GONE ? 0 : getHeight();
|
||||||
|
}
|
||||||
|
|
||||||
private void scheduleLifecycleEvents() {
|
private void scheduleLifecycleEvents() {
|
||||||
final int startScrollDelay = mContext.getResources().getInteger(
|
final int startScrollDelay = mContext.getResources().getInteger(
|
||||||
R.integer.pip_edu_text_start_scroll_delay);
|
R.integer.pip_edu_text_start_scroll_delay);
|
||||||
@@ -226,22 +231,42 @@ class TvPipMenuEduTextDrawer extends FrameLayout {
|
|||||||
.start();
|
.start();
|
||||||
|
|
||||||
// Start animation to close the drawer by animating its height to 0
|
// Start animation to close the drawer by animating its height to 0
|
||||||
final ValueAnimator heightAnimation = ValueAnimator.ofInt(getHeight(), 0);
|
final ValueAnimator heightAnimator = ValueAnimator.ofInt(getHeight(), 0);
|
||||||
heightAnimation.setDuration(eduTextSlideExitAnimationDuration);
|
heightAnimator.setDuration(eduTextSlideExitAnimationDuration);
|
||||||
heightAnimation.setInterpolator(TvPipInterpolators.BROWSE);
|
heightAnimator.setInterpolator(TvPipInterpolators.BROWSE);
|
||||||
heightAnimation.addUpdateListener(animator -> {
|
heightAnimator.addUpdateListener(animator -> {
|
||||||
final ViewGroup.LayoutParams params = getLayoutParams();
|
final ViewGroup.LayoutParams params = getLayoutParams();
|
||||||
params.height = (int) animator.getAnimatedValue();
|
params.height = (int) animator.getAnimatedValue();
|
||||||
setLayoutParams(params);
|
setLayoutParams(params);
|
||||||
if (params.height == 0) {
|
});
|
||||||
setVisibility(GONE);
|
heightAnimator.addListener(new Animator.AnimatorListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(@NonNull Animator animator) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(@NonNull Animator animator) {
|
||||||
|
onCloseEduTextAnimationEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(@NonNull Animator animator) {
|
||||||
|
onCloseEduTextAnimationEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(@NonNull Animator animator) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
heightAnimation.start();
|
heightAnimator.start();
|
||||||
|
|
||||||
mListener.onCloseEduText();
|
mListener.onCloseEduText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onCloseEduTextAnimationEnd() {
|
||||||
|
setVisibility(GONE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the educational text that will be displayed to the user. Here we replace the
|
* Creates the educational text that will be displayed to the user. Here we replace the
|
||||||
* HOME annotation in the String with an icon
|
* HOME annotation in the String with an icon
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ public class TvPipMenuView extends FrameLayout implements TvPipActionsProvider.L
|
|||||||
Rect getPipMenuContainerBounds(Rect pipBounds) {
|
Rect getPipMenuContainerBounds(Rect pipBounds) {
|
||||||
final Rect menuUiBounds = new Rect(pipBounds);
|
final Rect menuUiBounds = new Rect(pipBounds);
|
||||||
menuUiBounds.inset(-mPipMenuOuterSpace, -mPipMenuOuterSpace);
|
menuUiBounds.inset(-mPipMenuOuterSpace, -mPipMenuOuterSpace);
|
||||||
menuUiBounds.bottom += mEduTextDrawer.getHeight();
|
menuUiBounds.bottom += mEduTextDrawer.getEduTextDrawerHeight();
|
||||||
return menuUiBounds;
|
return menuUiBounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user