Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0b95fbe authored by Anthony Tripaldi's avatar Anthony Tripaldi Committed by Android (Google) Code Review
Browse files

Merge "Fix bug with blinking caption tooltip on rocker click. Also clean up...

Merge "Fix bug with blinking caption tooltip on rocker click. Also clean up some older code that flashed the dialog on screen initially and triggered dismiss too often." into qt-dev
parents 9a5f74f0 1bb7a3ce
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ import static android.media.AudioManager.STREAM_RING;
import static android.media.AudioManager.STREAM_VOICE_CALL;
import static android.media.AudioManager.STREAM_VOICE_CALL;
import static android.view.View.ACCESSIBILITY_LIVE_REGION_POLITE;
import static android.view.View.ACCESSIBILITY_LIVE_REGION_POLITE;
import static android.view.View.GONE;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static android.view.View.VISIBLE;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;


@@ -228,9 +229,10 @@ public class VolumeDialogImpl implements VolumeDialog,


        mDialog.setContentView(R.layout.volume_dialog);
        mDialog.setContentView(R.layout.volume_dialog);
        mDialogView = mDialog.findViewById(R.id.volume_dialog);
        mDialogView = mDialog.findViewById(R.id.volume_dialog);
        mDialogView.setAlpha(0);
        mDialog.setCanceledOnTouchOutside(true);
        mDialog.setCanceledOnTouchOutside(true);
        mDialog.setOnShowListener(dialog -> {
        mDialog.setOnShowListener(dialog -> {
            if (!isLandscape()) mDialogView.setTranslationX(mDialogView.getWidth() / 2);
            if (!isLandscape()) mDialogView.setTranslationX(mDialogView.getWidth() / 2.0f);
            mDialogView.setAlpha(0);
            mDialogView.setAlpha(0);
            mDialogView.animate()
            mDialogView.animate()
                    .alpha(1)
                    .alpha(1)
@@ -528,7 +530,7 @@ public class VolumeDialogImpl implements VolumeDialog,
        if (!mHasSeenODICaptionsTooltip && !fromDismiss && mODICaptionsTooltipViewStub != null) {
        if (!mHasSeenODICaptionsTooltip && !fromDismiss && mODICaptionsTooltipViewStub != null) {
            mController.getCaptionsComponentState(true);
            mController.getCaptionsComponentState(true);
        } else {
        } else {
            if (mHasSeenODICaptionsTooltip && mODICaptionsTooltipView != null) {
            if (mHasSeenODICaptionsTooltip && fromDismiss && mODICaptionsTooltipView != null) {
                hideCaptionsTooltip();
                hideCaptionsTooltip();
            }
            }
        }
        }
@@ -565,13 +567,14 @@ public class VolumeDialogImpl implements VolumeDialog,
    }
    }


    private void hideCaptionsTooltip() {
    private void hideCaptionsTooltip() {
        if (mODICaptionsTooltipView != null) {
        if (mODICaptionsTooltipView != null && mODICaptionsTooltipView.getVisibility() == VISIBLE) {
            mODICaptionsTooltipView.animate().cancel();
            mODICaptionsTooltipView.animate().cancel();
            mODICaptionsTooltipView.setAlpha(1.f);
            mODICaptionsTooltipView.setAlpha(1.f);
            mODICaptionsTooltipView.animate()
            mODICaptionsTooltipView.animate()
                    .alpha(0.f)
                    .alpha(0.f)
                    .setStartDelay(0)
                    .setStartDelay(0)
                    .setDuration(DIALOG_HIDE_ANIMATION_DURATION)
                    .setDuration(DIALOG_HIDE_ANIMATION_DURATION)
                    .withEndAction(() -> mODICaptionsTooltipView.setVisibility(INVISIBLE))
                    .start();
                    .start();
        }
        }
    }
    }
@@ -677,7 +680,7 @@ public class VolumeDialogImpl implements VolumeDialog,
    }
    }


    private void showH(int reason) {
    private void showH(int reason) {
        if (D.BUG) Log.d(TAG, "showH r=" + Events.DISMISS_REASONS[reason]);
        if (D.BUG) Log.d(TAG, "showH r=" + Events.SHOW_REASONS[reason]);
        mHandler.removeMessages(H.SHOW);
        mHandler.removeMessages(H.SHOW);
        mHandler.removeMessages(H.DISMISS);
        mHandler.removeMessages(H.DISMISS);
        rescheduleTimeoutH();
        rescheduleTimeoutH();
@@ -750,7 +753,7 @@ public class VolumeDialogImpl implements VolumeDialog,
                    mDialog.dismiss();
                    mDialog.dismiss();
                    tryToRemoveCaptionsTooltip();
                    tryToRemoveCaptionsTooltip();
                }, 50));
                }, 50));
        if (!isLandscape()) animator.translationX(mDialogView.getWidth() / 2);
        if (!isLandscape()) animator.translationX(mDialogView.getWidth() / 2.0f);
        animator.start();
        animator.start();
        checkODICaptionsTooltip(true);
        checkODICaptionsTooltip(true);
        mController.notifyVisible(false);
        mController.notifyVisible(false);