Add new show/hide anim duration for TV volume ui

Bug: 167732325
Test: m && flash && verify
Change-Id: I62f147ee48911b2daab79d75f1c2a8bd9e2e42b7
This commit is contained in:
Galia Peycheva
2020-09-22 17:01:14 +02:00
parent b1af5d91b9
commit ab1b941fd0
3 changed files with 25 additions and 9 deletions

View File

@@ -48,4 +48,10 @@
<!-- Change the volume row tint when it is inactive, i.e. when it is being dismissed -->
<bool name="config_changeVolumeRowTintWhenInactive">false</bool>
<!-- The duraction of the show animation for the volume dialog in milliseconds -->
<integer name="config_dialogShowAnimationDurationMs">600</integer>
<!-- The duraction of the hide animation for the volume dialog in milliseconds -->
<integer name="config_dialogHideAnimationDurationMs">400</integer>
</resources>

View File

@@ -565,4 +565,10 @@
<!-- Change the volume row tint when it is inactive, i.e. when it is being dismissed -->
<bool name="config_changeVolumeRowTintWhenInactive">true</bool>
<!-- The duraction of the show animation for the volume dialog in milliseconds -->
<integer name="config_dialogShowAnimationDurationMs">300</integer>
<!-- The duraction of the hide animation for the volume dialog in milliseconds -->
<integer name="config_dialogHideAnimationDurationMs">250</integer>
</resources>

View File

@@ -122,8 +122,11 @@ public class VolumeDialogImpl implements VolumeDialog,
static final int DIALOG_SAFETYWARNING_TIMEOUT_MILLIS = 5000;
static final int DIALOG_ODI_CAPTIONS_TOOLTIP_TIMEOUT_MILLIS = 5000;
static final int DIALOG_HOVERING_TIMEOUT_MILLIS = 16000;
static final int DIALOG_SHOW_ANIMATION_DURATION = 300;
static final int DIALOG_HIDE_ANIMATION_DURATION = 250;
private final int mDialogShowAnimationDurationMs;
private final int mDialogHideAnimationDurationMs;
private final boolean mShowLowMediaVolumeIcon;
private final boolean mChangeVolumeRowTintWhenInactive;
private final Context mContext;
private final H mHandler = new H();
@@ -154,9 +157,6 @@ public class VolumeDialogImpl implements VolumeDialog,
private boolean mShowing;
private boolean mShowA11yStream;
private final boolean mShowLowMediaVolumeIcon;
private final boolean mChangeVolumeRowTintWhenInactive;
private int mActiveStream;
private int mPrevActiveStream;
private boolean mAutomute = VolumePrefs.DEFAULT_ENABLE_AUTOMUTE;
@@ -186,6 +186,10 @@ public class VolumeDialogImpl implements VolumeDialog,
mContext.getResources().getBoolean(R.bool.config_showLowMediaVolumeIcon);
mChangeVolumeRowTintWhenInactive =
mContext.getResources().getBoolean(R.bool.config_changeVolumeRowTintWhenInactive);
mDialogShowAnimationDurationMs =
mContext.getResources().getInteger(R.integer.config_dialogShowAnimationDurationMs);
mDialogHideAnimationDurationMs =
mContext.getResources().getInteger(R.integer.config_dialogHideAnimationDurationMs);
}
@Override
@@ -275,7 +279,7 @@ public class VolumeDialogImpl implements VolumeDialog,
mDialogView.animate()
.alpha(1)
.translationX(0)
.setDuration(DIALOG_SHOW_ANIMATION_DURATION)
.setDuration(mDialogShowAnimationDurationMs)
.setInterpolator(new SystemUIInterpolators.LogDecelerateInterpolator())
.withEndAction(() -> {
if (!Prefs.getBoolean(mContext, Prefs.Key.TOUCHED_RINGER_TOGGLE, false)) {
@@ -595,7 +599,7 @@ public class VolumeDialogImpl implements VolumeDialog,
mODICaptionsTooltipView.setAlpha(0.f);
mODICaptionsTooltipView.animate()
.alpha(1.f)
.setStartDelay(DIALOG_SHOW_ANIMATION_DURATION)
.setStartDelay(mDialogShowAnimationDurationMs)
.withEndAction(() -> {
if (D.BUG) Log.d(TAG, "tool:checkODICaptionsTooltip() putBoolean true");
Prefs.putBoolean(mContext,
@@ -617,7 +621,7 @@ public class VolumeDialogImpl implements VolumeDialog,
mODICaptionsTooltipView.animate()
.alpha(0.f)
.setStartDelay(0)
.setDuration(DIALOG_HIDE_ANIMATION_DURATION)
.setDuration(mDialogHideAnimationDurationMs)
.withEndAction(() -> mODICaptionsTooltipView.setVisibility(INVISIBLE))
.start();
}
@@ -796,7 +800,7 @@ public class VolumeDialogImpl implements VolumeDialog,
mDialogView.setAlpha(1);
ViewPropertyAnimator animator = mDialogView.animate()
.alpha(0)
.setDuration(DIALOG_HIDE_ANIMATION_DURATION)
.setDuration(mDialogHideAnimationDurationMs)
.setInterpolator(new SystemUIInterpolators.LogAccelerateInterpolator())
.withEndAction(() -> mHandler.postDelayed(() -> {
mDialog.dismiss();