Add new show/hide anim duration for TV volume ui
Bug: 167732325
Test: m && flash && verify
Change-Id: I62f147ee48911b2daab79d75f1c2a8bd9e2e42b7
diff --git a/packages/SystemUI/res/values-television/config.xml b/packages/SystemUI/res/values-television/config.xml
index 29c3ad4..015ac90 100644
--- a/packages/SystemUI/res/values-television/config.xml
+++ b/packages/SystemUI/res/values-television/config.xml
@@ -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>
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 446ed3e..d63724d 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -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>
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 43754a2..9a0f040 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -122,8 +122,11 @@
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 @@
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 @@
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 @@
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 @@
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 @@
mODICaptionsTooltipView.animate()
.alpha(0.f)
.setStartDelay(0)
- .setDuration(DIALOG_HIDE_ANIMATION_DURATION)
+ .setDuration(mDialogHideAnimationDurationMs)
.withEndAction(() -> mODICaptionsTooltipView.setVisibility(INVISIBLE))
.start();
}
@@ -796,7 +800,7 @@
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();