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
This commit is contained in:
committed by
Android (Google) Code Review
commit
e0b95fbe37
@@ -27,6 +27,7 @@ import static android.media.AudioManager.STREAM_RING;
|
||||
import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||
import static android.view.View.ACCESSIBILITY_LIVE_REGION_POLITE;
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.INVISIBLE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
|
||||
@@ -228,9 +229,10 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
|
||||
mDialog.setContentView(R.layout.volume_dialog);
|
||||
mDialogView = mDialog.findViewById(R.id.volume_dialog);
|
||||
mDialogView.setAlpha(0);
|
||||
mDialog.setCanceledOnTouchOutside(true);
|
||||
mDialog.setOnShowListener(dialog -> {
|
||||
if (!isLandscape()) mDialogView.setTranslationX(mDialogView.getWidth() / 2);
|
||||
if (!isLandscape()) mDialogView.setTranslationX(mDialogView.getWidth() / 2.0f);
|
||||
mDialogView.setAlpha(0);
|
||||
mDialogView.animate()
|
||||
.alpha(1)
|
||||
@@ -528,7 +530,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
if (!mHasSeenODICaptionsTooltip && !fromDismiss && mODICaptionsTooltipViewStub != null) {
|
||||
mController.getCaptionsComponentState(true);
|
||||
} else {
|
||||
if (mHasSeenODICaptionsTooltip && mODICaptionsTooltipView != null) {
|
||||
if (mHasSeenODICaptionsTooltip && fromDismiss && mODICaptionsTooltipView != null) {
|
||||
hideCaptionsTooltip();
|
||||
}
|
||||
}
|
||||
@@ -565,13 +567,14 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
}
|
||||
|
||||
private void hideCaptionsTooltip() {
|
||||
if (mODICaptionsTooltipView != null) {
|
||||
if (mODICaptionsTooltipView != null && mODICaptionsTooltipView.getVisibility() == VISIBLE) {
|
||||
mODICaptionsTooltipView.animate().cancel();
|
||||
mODICaptionsTooltipView.setAlpha(1.f);
|
||||
mODICaptionsTooltipView.animate()
|
||||
.alpha(0.f)
|
||||
.setStartDelay(0)
|
||||
.setDuration(DIALOG_HIDE_ANIMATION_DURATION)
|
||||
.withEndAction(() -> mODICaptionsTooltipView.setVisibility(INVISIBLE))
|
||||
.start();
|
||||
}
|
||||
}
|
||||
@@ -677,7 +680,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
}
|
||||
|
||||
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.DISMISS);
|
||||
rescheduleTimeoutH();
|
||||
@@ -750,7 +753,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
mDialog.dismiss();
|
||||
tryToRemoveCaptionsTooltip();
|
||||
}, 50));
|
||||
if (!isLandscape()) animator.translationX(mDialogView.getWidth() / 2);
|
||||
if (!isLandscape()) animator.translationX(mDialogView.getWidth() / 2.0f);
|
||||
animator.start();
|
||||
checkODICaptionsTooltip(true);
|
||||
mController.notifyVisible(false);
|
||||
|
||||
Reference in New Issue
Block a user