Merge "Update dream IN transition." into tm-qpr-dev am: a1e82f2ba5
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20728043 Change-Id: I3912b5658989e49dd78933ebfd035cbe13c3a84c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -773,15 +773,11 @@
|
|||||||
<integer name="complicationFadeOutDelayMs">200</integer>
|
<integer name="complicationFadeOutDelayMs">200</integer>
|
||||||
|
|
||||||
<!-- Duration in milliseconds of the dream in un-blur animation. -->
|
<!-- Duration in milliseconds of the dream in un-blur animation. -->
|
||||||
<integer name="config_dreamOverlayInBlurDurationMs">249</integer>
|
<integer name="config_dreamOverlayInBlurDurationMs">250</integer>
|
||||||
<!-- Delay in milliseconds of the dream in un-blur animation. -->
|
|
||||||
<integer name="config_dreamOverlayInBlurDelayMs">133</integer>
|
|
||||||
<!-- Duration in milliseconds of the dream in complications fade-in animation. -->
|
<!-- Duration in milliseconds of the dream in complications fade-in animation. -->
|
||||||
<integer name="config_dreamOverlayInComplicationsDurationMs">282</integer>
|
<integer name="config_dreamOverlayInComplicationsDurationMs">250</integer>
|
||||||
<!-- Delay in milliseconds of the dream in top complications fade-in animation. -->
|
<!-- Duration in milliseconds of the y-translation animation when entering a dream -->
|
||||||
<integer name="config_dreamOverlayInTopComplicationsDelayMs">216</integer>
|
<integer name="config_dreamOverlayInTranslationYDurationMs">917</integer>
|
||||||
<!-- Delay in milliseconds of the dream in bottom complications fade-in animation. -->
|
|
||||||
<integer name="config_dreamOverlayInBottomComplicationsDelayMs">299</integer>
|
|
||||||
|
|
||||||
<!-- Icons that don't show in a collapsed non-keyguard statusbar -->
|
<!-- Icons that don't show in a collapsed non-keyguard statusbar -->
|
||||||
<string-array name="config_collapsed_statusbar_icon_blocklist" translatable="false">
|
<string-array name="config_collapsed_statusbar_icon_blocklist" translatable="false">
|
||||||
|
|||||||
@@ -1507,6 +1507,8 @@
|
|||||||
<dimen name="dream_overlay_status_bar_extra_margin">8dp</dimen>
|
<dimen name="dream_overlay_status_bar_extra_margin">8dp</dimen>
|
||||||
|
|
||||||
<!-- Dream overlay complications related dimensions -->
|
<!-- Dream overlay complications related dimensions -->
|
||||||
|
<!-- The blur radius applied to the dream overlay when entering and exiting dreams -->
|
||||||
|
<dimen name="dream_overlay_anim_blur_radius">50dp</dimen>
|
||||||
<dimen name="dream_overlay_complication_clock_time_text_size">86dp</dimen>
|
<dimen name="dream_overlay_complication_clock_time_text_size">86dp</dimen>
|
||||||
<dimen name="dream_overlay_complication_clock_time_translation_y">28dp</dimen>
|
<dimen name="dream_overlay_complication_clock_time_translation_y">28dp</dimen>
|
||||||
<dimen name="dream_overlay_complication_home_controls_padding">28dp</dimen>
|
<dimen name="dream_overlay_complication_home_controls_padding">28dp</dimen>
|
||||||
@@ -1560,6 +1562,7 @@
|
|||||||
<dimen name="dream_overlay_complication_margin">0dp</dimen>
|
<dimen name="dream_overlay_complication_margin">0dp</dimen>
|
||||||
|
|
||||||
<dimen name="dream_overlay_y_offset">80dp</dimen>
|
<dimen name="dream_overlay_y_offset">80dp</dimen>
|
||||||
|
<dimen name="dream_overlay_entry_y_offset">40dp</dimen>
|
||||||
<dimen name="dream_overlay_exit_y_offset">40dp</dimen>
|
<dimen name="dream_overlay_exit_y_offset">40dp</dimen>
|
||||||
|
|
||||||
<dimen name="status_view_margin_horizontal">0dp</dimen>
|
<dimen name="status_view_margin_horizontal">0dp</dimen>
|
||||||
|
|||||||
@@ -21,11 +21,12 @@ import android.animation.AnimatorSet
|
|||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.animation.Interpolator
|
import android.view.animation.Interpolator
|
||||||
import androidx.annotation.FloatRange
|
|
||||||
import androidx.core.animation.doOnEnd
|
import androidx.core.animation.doOnEnd
|
||||||
import com.android.systemui.animation.Interpolators
|
import com.android.systemui.animation.Interpolators
|
||||||
import com.android.systemui.dreams.complication.ComplicationHostViewController
|
import com.android.systemui.dreams.complication.ComplicationHostViewController
|
||||||
import com.android.systemui.dreams.complication.ComplicationLayoutParams
|
import com.android.systemui.dreams.complication.ComplicationLayoutParams
|
||||||
|
import com.android.systemui.dreams.complication.ComplicationLayoutParams.POSITION_BOTTOM
|
||||||
|
import com.android.systemui.dreams.complication.ComplicationLayoutParams.POSITION_TOP
|
||||||
import com.android.systemui.dreams.complication.ComplicationLayoutParams.Position
|
import com.android.systemui.dreams.complication.ComplicationLayoutParams.Position
|
||||||
import com.android.systemui.dreams.dagger.DreamOverlayModule
|
import com.android.systemui.dreams.dagger.DreamOverlayModule
|
||||||
import com.android.systemui.statusbar.BlurUtils
|
import com.android.systemui.statusbar.BlurUtils
|
||||||
@@ -41,16 +42,15 @@ constructor(
|
|||||||
private val mComplicationHostViewController: ComplicationHostViewController,
|
private val mComplicationHostViewController: ComplicationHostViewController,
|
||||||
private val mStatusBarViewController: DreamOverlayStatusBarViewController,
|
private val mStatusBarViewController: DreamOverlayStatusBarViewController,
|
||||||
private val mOverlayStateController: DreamOverlayStateController,
|
private val mOverlayStateController: DreamOverlayStateController,
|
||||||
|
@Named(DreamOverlayModule.DREAM_BLUR_RADIUS) private val mDreamBlurRadius: Int,
|
||||||
@Named(DreamOverlayModule.DREAM_IN_BLUR_ANIMATION_DURATION)
|
@Named(DreamOverlayModule.DREAM_IN_BLUR_ANIMATION_DURATION)
|
||||||
private val mDreamInBlurAnimDurationMs: Long,
|
private val mDreamInBlurAnimDurationMs: Long,
|
||||||
@Named(DreamOverlayModule.DREAM_IN_BLUR_ANIMATION_DELAY)
|
|
||||||
private val mDreamInBlurAnimDelayMs: Long,
|
|
||||||
@Named(DreamOverlayModule.DREAM_IN_COMPLICATIONS_ANIMATION_DURATION)
|
@Named(DreamOverlayModule.DREAM_IN_COMPLICATIONS_ANIMATION_DURATION)
|
||||||
private val mDreamInComplicationsAnimDurationMs: Long,
|
private val mDreamInComplicationsAnimDurationMs: Long,
|
||||||
@Named(DreamOverlayModule.DREAM_IN_TOP_COMPLICATIONS_ANIMATION_DELAY)
|
@Named(DreamOverlayModule.DREAM_IN_TRANSLATION_Y_DISTANCE)
|
||||||
private val mDreamInTopComplicationsAnimDelayMs: Long,
|
private val mDreamInTranslationYDistance: Int,
|
||||||
@Named(DreamOverlayModule.DREAM_IN_BOTTOM_COMPLICATIONS_ANIMATION_DELAY)
|
@Named(DreamOverlayModule.DREAM_IN_TRANSLATION_Y_DURATION)
|
||||||
private val mDreamInBottomComplicationsAnimDelayMs: Long,
|
private val mDreamInTranslationYDurationMs: Long,
|
||||||
@Named(DreamOverlayModule.DREAM_OUT_TRANSLATION_Y_DISTANCE)
|
@Named(DreamOverlayModule.DREAM_OUT_TRANSLATION_Y_DISTANCE)
|
||||||
private val mDreamOutTranslationYDistance: Int,
|
private val mDreamOutTranslationYDistance: Int,
|
||||||
@Named(DreamOverlayModule.DREAM_OUT_TRANSLATION_Y_DURATION)
|
@Named(DreamOverlayModule.DREAM_OUT_TRANSLATION_Y_DURATION)
|
||||||
@@ -74,7 +74,7 @@ constructor(
|
|||||||
*/
|
*/
|
||||||
private var mCurrentAlphaAtPosition = mutableMapOf<Int, Float>()
|
private var mCurrentAlphaAtPosition = mutableMapOf<Int, Float>()
|
||||||
|
|
||||||
@FloatRange(from = 0.0, to = 1.0) private var mBlurProgress: Float = 0f
|
private var mCurrentBlurRadius: Float = 0f
|
||||||
|
|
||||||
/** Starts the dream content and dream overlay entry animations. */
|
/** Starts the dream content and dream overlay entry animations. */
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
@@ -86,25 +86,23 @@ constructor(
|
|||||||
playTogether(
|
playTogether(
|
||||||
blurAnimator(
|
blurAnimator(
|
||||||
view = view,
|
view = view,
|
||||||
from = 1f,
|
fromBlurRadius = mDreamBlurRadius.toFloat(),
|
||||||
to = 0f,
|
toBlurRadius = 0f,
|
||||||
durationMs = mDreamInBlurAnimDurationMs,
|
durationMs = mDreamInBlurAnimDurationMs,
|
||||||
delayMs = mDreamInBlurAnimDelayMs
|
interpolator = Interpolators.EMPHASIZED_DECELERATE
|
||||||
),
|
),
|
||||||
alphaAnimator(
|
alphaAnimator(
|
||||||
from = 0f,
|
from = 0f,
|
||||||
to = 1f,
|
to = 1f,
|
||||||
durationMs = mDreamInComplicationsAnimDurationMs,
|
durationMs = mDreamInComplicationsAnimDurationMs,
|
||||||
delayMs = mDreamInTopComplicationsAnimDelayMs,
|
interpolator = Interpolators.LINEAR
|
||||||
position = ComplicationLayoutParams.POSITION_TOP
|
),
|
||||||
|
translationYAnimator(
|
||||||
|
from = mDreamInTranslationYDistance.toFloat(),
|
||||||
|
to = 0f,
|
||||||
|
durationMs = mDreamInTranslationYDurationMs,
|
||||||
|
interpolator = Interpolators.EMPHASIZED_DECELERATE
|
||||||
),
|
),
|
||||||
alphaAnimator(
|
|
||||||
from = 0f,
|
|
||||||
to = 1f,
|
|
||||||
durationMs = mDreamInComplicationsAnimDurationMs,
|
|
||||||
delayMs = mDreamInBottomComplicationsAnimDelayMs,
|
|
||||||
position = ComplicationLayoutParams.POSITION_BOTTOM
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
doOnEnd {
|
doOnEnd {
|
||||||
mAnimator = null
|
mAnimator = null
|
||||||
@@ -130,47 +128,48 @@ constructor(
|
|||||||
view = view,
|
view = view,
|
||||||
// Start the blurring wherever the entry animation ended, in
|
// Start the blurring wherever the entry animation ended, in
|
||||||
// case it was cancelled early.
|
// case it was cancelled early.
|
||||||
from = mBlurProgress,
|
fromBlurRadius = mCurrentBlurRadius,
|
||||||
to = 1f,
|
toBlurRadius = mDreamBlurRadius.toFloat(),
|
||||||
durationMs = mDreamOutBlurDurationMs
|
durationMs = mDreamOutBlurDurationMs,
|
||||||
|
interpolator = Interpolators.EMPHASIZED_ACCELERATE
|
||||||
),
|
),
|
||||||
translationYAnimator(
|
translationYAnimator(
|
||||||
from = 0f,
|
from = 0f,
|
||||||
to = mDreamOutTranslationYDistance.toFloat(),
|
to = mDreamOutTranslationYDistance.toFloat(),
|
||||||
durationMs = mDreamOutTranslationYDurationMs,
|
durationMs = mDreamOutTranslationYDurationMs,
|
||||||
delayMs = mDreamOutTranslationYDelayBottomMs,
|
delayMs = mDreamOutTranslationYDelayBottomMs,
|
||||||
position = ComplicationLayoutParams.POSITION_BOTTOM,
|
positions = POSITION_BOTTOM,
|
||||||
animInterpolator = Interpolators.EMPHASIZED_ACCELERATE
|
interpolator = Interpolators.EMPHASIZED_ACCELERATE
|
||||||
),
|
),
|
||||||
translationYAnimator(
|
translationYAnimator(
|
||||||
from = 0f,
|
from = 0f,
|
||||||
to = mDreamOutTranslationYDistance.toFloat(),
|
to = mDreamOutTranslationYDistance.toFloat(),
|
||||||
durationMs = mDreamOutTranslationYDurationMs,
|
durationMs = mDreamOutTranslationYDurationMs,
|
||||||
delayMs = mDreamOutTranslationYDelayTopMs,
|
delayMs = mDreamOutTranslationYDelayTopMs,
|
||||||
position = ComplicationLayoutParams.POSITION_TOP,
|
positions = POSITION_TOP,
|
||||||
animInterpolator = Interpolators.EMPHASIZED_ACCELERATE
|
interpolator = Interpolators.EMPHASIZED_ACCELERATE
|
||||||
),
|
),
|
||||||
alphaAnimator(
|
alphaAnimator(
|
||||||
from =
|
from =
|
||||||
mCurrentAlphaAtPosition.getOrDefault(
|
mCurrentAlphaAtPosition.getOrDefault(
|
||||||
key = ComplicationLayoutParams.POSITION_BOTTOM,
|
key = POSITION_BOTTOM,
|
||||||
defaultValue = 1f
|
defaultValue = 1f
|
||||||
),
|
),
|
||||||
to = 0f,
|
to = 0f,
|
||||||
durationMs = mDreamOutAlphaDurationMs,
|
durationMs = mDreamOutAlphaDurationMs,
|
||||||
delayMs = mDreamOutAlphaDelayBottomMs,
|
delayMs = mDreamOutAlphaDelayBottomMs,
|
||||||
position = ComplicationLayoutParams.POSITION_BOTTOM
|
positions = POSITION_BOTTOM
|
||||||
),
|
),
|
||||||
alphaAnimator(
|
alphaAnimator(
|
||||||
from =
|
from =
|
||||||
mCurrentAlphaAtPosition.getOrDefault(
|
mCurrentAlphaAtPosition.getOrDefault(
|
||||||
key = ComplicationLayoutParams.POSITION_TOP,
|
key = POSITION_TOP,
|
||||||
defaultValue = 1f
|
defaultValue = 1f
|
||||||
),
|
),
|
||||||
to = 0f,
|
to = 0f,
|
||||||
durationMs = mDreamOutAlphaDurationMs,
|
durationMs = mDreamOutAlphaDurationMs,
|
||||||
delayMs = mDreamOutAlphaDelayTopMs,
|
delayMs = mDreamOutAlphaDelayTopMs,
|
||||||
position = ComplicationLayoutParams.POSITION_TOP
|
positions = POSITION_TOP
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
doOnEnd {
|
doOnEnd {
|
||||||
@@ -194,20 +193,21 @@ constructor(
|
|||||||
|
|
||||||
private fun blurAnimator(
|
private fun blurAnimator(
|
||||||
view: View,
|
view: View,
|
||||||
from: Float,
|
fromBlurRadius: Float,
|
||||||
to: Float,
|
toBlurRadius: Float,
|
||||||
durationMs: Long,
|
durationMs: Long,
|
||||||
delayMs: Long = 0
|
delayMs: Long = 0,
|
||||||
|
interpolator: Interpolator = Interpolators.LINEAR
|
||||||
): Animator {
|
): Animator {
|
||||||
return ValueAnimator.ofFloat(from, to).apply {
|
return ValueAnimator.ofFloat(fromBlurRadius, toBlurRadius).apply {
|
||||||
duration = durationMs
|
duration = durationMs
|
||||||
startDelay = delayMs
|
startDelay = delayMs
|
||||||
interpolator = Interpolators.LINEAR
|
this.interpolator = interpolator
|
||||||
addUpdateListener { animator: ValueAnimator ->
|
addUpdateListener { animator: ValueAnimator ->
|
||||||
mBlurProgress = animator.animatedValue as Float
|
mCurrentBlurRadius = animator.animatedValue as Float
|
||||||
mBlurUtils.applyBlur(
|
mBlurUtils.applyBlur(
|
||||||
viewRootImpl = view.viewRootImpl,
|
viewRootImpl = view.viewRootImpl,
|
||||||
radius = mBlurUtils.blurRadiusOfRatio(mBlurProgress).toInt(),
|
radius = mCurrentBlurRadius.toInt(),
|
||||||
opaque = false
|
opaque = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -218,18 +218,24 @@ constructor(
|
|||||||
from: Float,
|
from: Float,
|
||||||
to: Float,
|
to: Float,
|
||||||
durationMs: Long,
|
durationMs: Long,
|
||||||
delayMs: Long,
|
delayMs: Long = 0,
|
||||||
@Position position: Int
|
@Position positions: Int = POSITION_TOP or POSITION_BOTTOM,
|
||||||
|
interpolator: Interpolator = Interpolators.LINEAR
|
||||||
): Animator {
|
): Animator {
|
||||||
return ValueAnimator.ofFloat(from, to).apply {
|
return ValueAnimator.ofFloat(from, to).apply {
|
||||||
duration = durationMs
|
duration = durationMs
|
||||||
startDelay = delayMs
|
startDelay = delayMs
|
||||||
interpolator = Interpolators.LINEAR
|
this.interpolator = interpolator
|
||||||
addUpdateListener { va: ValueAnimator ->
|
addUpdateListener { va: ValueAnimator ->
|
||||||
setElementsAlphaAtPosition(
|
ComplicationLayoutParams.iteratePositions(
|
||||||
alpha = va.animatedValue as Float,
|
{ position: Int ->
|
||||||
position = position,
|
setElementsAlphaAtPosition(
|
||||||
fadingOut = to < from
|
alpha = va.animatedValue as Float,
|
||||||
|
position = position,
|
||||||
|
fadingOut = to < from
|
||||||
|
)
|
||||||
|
},
|
||||||
|
positions
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,16 +245,21 @@ constructor(
|
|||||||
from: Float,
|
from: Float,
|
||||||
to: Float,
|
to: Float,
|
||||||
durationMs: Long,
|
durationMs: Long,
|
||||||
delayMs: Long,
|
delayMs: Long = 0,
|
||||||
@Position position: Int,
|
@Position positions: Int = POSITION_TOP or POSITION_BOTTOM,
|
||||||
animInterpolator: Interpolator
|
interpolator: Interpolator = Interpolators.LINEAR
|
||||||
): Animator {
|
): Animator {
|
||||||
return ValueAnimator.ofFloat(from, to).apply {
|
return ValueAnimator.ofFloat(from, to).apply {
|
||||||
duration = durationMs
|
duration = durationMs
|
||||||
startDelay = delayMs
|
startDelay = delayMs
|
||||||
interpolator = animInterpolator
|
this.interpolator = interpolator
|
||||||
addUpdateListener { va: ValueAnimator ->
|
addUpdateListener { va: ValueAnimator ->
|
||||||
setElementsTranslationYAtPosition(va.animatedValue as Float, position)
|
ComplicationLayoutParams.iteratePositions(
|
||||||
|
{ position: Int ->
|
||||||
|
setElementsTranslationYAtPosition(va.animatedValue as Float, position)
|
||||||
|
},
|
||||||
|
positions
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,7 +274,7 @@ constructor(
|
|||||||
CrossFadeHelper.fadeIn(view, alpha, /* remap= */ false)
|
CrossFadeHelper.fadeIn(view, alpha, /* remap= */ false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (position == ComplicationLayoutParams.POSITION_TOP) {
|
if (position == POSITION_TOP) {
|
||||||
mStatusBarViewController.setFadeAmount(alpha, fadingOut)
|
mStatusBarViewController.setFadeAmount(alpha, fadingOut)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +284,7 @@ constructor(
|
|||||||
mComplicationHostViewController.getViewsAtPosition(position).forEach { v ->
|
mComplicationHostViewController.getViewsAtPosition(position).forEach { v ->
|
||||||
v.translationY = translationY
|
v.translationY = translationY
|
||||||
}
|
}
|
||||||
if (position == ComplicationLayoutParams.POSITION_TOP) {
|
if (position == POSITION_TOP) {
|
||||||
mStatusBarViewController.setTranslationY(translationY)
|
mStatusBarViewController.setTranslationY(translationY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,9 +251,17 @@ public class ComplicationLayoutParams extends ViewGroup.LayoutParams {
|
|||||||
* position specified for this {@link ComplicationLayoutParams}.
|
* position specified for this {@link ComplicationLayoutParams}.
|
||||||
*/
|
*/
|
||||||
public void iteratePositions(Consumer<Integer> consumer) {
|
public void iteratePositions(Consumer<Integer> consumer) {
|
||||||
|
iteratePositions(consumer, mPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterates over the defined positions and invokes the specified {@link Consumer} for each
|
||||||
|
* position specified by the given {@code position}.
|
||||||
|
*/
|
||||||
|
public static void iteratePositions(Consumer<Integer> consumer, @Position int position) {
|
||||||
for (int currentPosition = FIRST_POSITION; currentPosition <= LAST_POSITION;
|
for (int currentPosition = FIRST_POSITION; currentPosition <= LAST_POSITION;
|
||||||
currentPosition <<= 1) {
|
currentPosition <<= 1) {
|
||||||
if ((mPosition & currentPosition) == currentPosition) {
|
if ((position & currentPosition) == currentPosition) {
|
||||||
consumer.accept(currentPosition);
|
consumer.accept(currentPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ public abstract class DreamOverlayModule {
|
|||||||
public static final String BURN_IN_PROTECTION_UPDATE_INTERVAL =
|
public static final String BURN_IN_PROTECTION_UPDATE_INTERVAL =
|
||||||
"burn_in_protection_update_interval";
|
"burn_in_protection_update_interval";
|
||||||
public static final String MILLIS_UNTIL_FULL_JITTER = "millis_until_full_jitter";
|
public static final String MILLIS_UNTIL_FULL_JITTER = "millis_until_full_jitter";
|
||||||
|
public static final String DREAM_BLUR_RADIUS = "DREAM_BLUR_RADIUS";
|
||||||
public static final String DREAM_IN_BLUR_ANIMATION_DURATION = "dream_in_blur_anim_duration";
|
public static final String DREAM_IN_BLUR_ANIMATION_DURATION = "dream_in_blur_anim_duration";
|
||||||
public static final String DREAM_IN_BLUR_ANIMATION_DELAY = "dream_in_blur_anim_delay";
|
|
||||||
public static final String DREAM_IN_COMPLICATIONS_ANIMATION_DURATION =
|
public static final String DREAM_IN_COMPLICATIONS_ANIMATION_DURATION =
|
||||||
"dream_in_complications_anim_duration";
|
"dream_in_complications_anim_duration";
|
||||||
public static final String DREAM_IN_TOP_COMPLICATIONS_ANIMATION_DELAY =
|
public static final String DREAM_IN_TRANSLATION_Y_DISTANCE =
|
||||||
"dream_in_top_complications_anim_delay";
|
"dream_in_complications_translation_y";
|
||||||
public static final String DREAM_IN_BOTTOM_COMPLICATIONS_ANIMATION_DELAY =
|
public static final String DREAM_IN_TRANSLATION_Y_DURATION =
|
||||||
"dream_in_bottom_complications_anim_delay";
|
"dream_in_complications_translation_y_duration";
|
||||||
public static final String DREAM_OUT_TRANSLATION_Y_DISTANCE =
|
public static final String DREAM_OUT_TRANSLATION_Y_DISTANCE =
|
||||||
"dream_out_complications_translation_y";
|
"dream_out_complications_translation_y";
|
||||||
public static final String DREAM_OUT_TRANSLATION_Y_DURATION =
|
public static final String DREAM_OUT_TRANSLATION_Y_DURATION =
|
||||||
@@ -138,6 +138,15 @@ public abstract class DreamOverlayModule {
|
|||||||
return resources.getInteger(R.integer.config_dreamOverlayMillisUntilFullJitter);
|
return resources.getInteger(R.integer.config_dreamOverlayMillisUntilFullJitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The blur radius applied to the dream overlay at dream entry and exit.
|
||||||
|
*/
|
||||||
|
@Provides
|
||||||
|
@Named(DREAM_BLUR_RADIUS)
|
||||||
|
static int providesDreamBlurRadius(@Main Resources resources) {
|
||||||
|
return resources.getDimensionPixelSize(R.dimen.dream_overlay_anim_blur_radius);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duration in milliseconds of the dream in un-blur animation.
|
* Duration in milliseconds of the dream in un-blur animation.
|
||||||
*/
|
*/
|
||||||
@@ -147,15 +156,6 @@ public abstract class DreamOverlayModule {
|
|||||||
return (long) resources.getInteger(R.integer.config_dreamOverlayInBlurDurationMs);
|
return (long) resources.getInteger(R.integer.config_dreamOverlayInBlurDurationMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delay in milliseconds of the dream in un-blur animation.
|
|
||||||
*/
|
|
||||||
@Provides
|
|
||||||
@Named(DREAM_IN_BLUR_ANIMATION_DELAY)
|
|
||||||
static long providesDreamInBlurAnimationDelay(@Main Resources resources) {
|
|
||||||
return (long) resources.getInteger(R.integer.config_dreamOverlayInBlurDelayMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duration in milliseconds of the dream in complications fade-in animation.
|
* Duration in milliseconds of the dream in complications fade-in animation.
|
||||||
*/
|
*/
|
||||||
@@ -166,22 +166,23 @@ public abstract class DreamOverlayModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay in milliseconds of the dream in top complications fade-in animation.
|
* Provides the number of pixels to translate complications when entering a dream.
|
||||||
*/
|
*/
|
||||||
@Provides
|
@Provides
|
||||||
@Named(DREAM_IN_TOP_COMPLICATIONS_ANIMATION_DELAY)
|
@Named(DREAM_IN_TRANSLATION_Y_DISTANCE)
|
||||||
static long providesDreamInTopComplicationsAnimationDelay(@Main Resources resources) {
|
@DreamOverlayComponent.DreamOverlayScope
|
||||||
return (long) resources.getInteger(R.integer.config_dreamOverlayInTopComplicationsDelayMs);
|
static int providesDreamInComplicationsTranslationY(@Main Resources resources) {
|
||||||
|
return resources.getDimensionPixelSize(R.dimen.dream_overlay_entry_y_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay in milliseconds of the dream in bottom complications fade-in animation.
|
* Provides the duration in ms of the y-translation when dream enters.
|
||||||
*/
|
*/
|
||||||
@Provides
|
@Provides
|
||||||
@Named(DREAM_IN_BOTTOM_COMPLICATIONS_ANIMATION_DELAY)
|
@Named(DREAM_IN_TRANSLATION_Y_DURATION)
|
||||||
static long providesDreamInBottomComplicationsAnimationDelay(@Main Resources resources) {
|
@DreamOverlayComponent.DreamOverlayScope
|
||||||
return (long) resources.getInteger(
|
static long providesDreamInComplicationsTranslationYDuration(@Main Resources resources) {
|
||||||
R.integer.config_dreamOverlayInBottomComplicationsDelayMs);
|
return (long) resources.getInteger(R.integer.config_dreamOverlayInTranslationYDurationMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ import org.mockito.MockitoAnnotations
|
|||||||
class DreamOverlayAnimationsControllerTest : SysuiTestCase() {
|
class DreamOverlayAnimationsControllerTest : SysuiTestCase() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private const val DREAM_BLUR_RADIUS = 50
|
||||||
private const val DREAM_IN_BLUR_ANIMATION_DURATION = 1L
|
private const val DREAM_IN_BLUR_ANIMATION_DURATION = 1L
|
||||||
private const val DREAM_IN_BLUR_ANIMATION_DELAY = 2L
|
|
||||||
private const val DREAM_IN_COMPLICATIONS_ANIMATION_DURATION = 3L
|
private const val DREAM_IN_COMPLICATIONS_ANIMATION_DURATION = 3L
|
||||||
private const val DREAM_IN_TOP_COMPLICATIONS_ANIMATION_DELAY = 4L
|
private const val DREAM_IN_TRANSLATION_Y_DISTANCE = 6
|
||||||
private const val DREAM_IN_BOTTOM_COMPLICATIONS_ANIMATION_DELAY = 5L
|
private const val DREAM_IN_TRANSLATION_Y_DURATION = 7L
|
||||||
private const val DREAM_OUT_TRANSLATION_Y_DISTANCE = 6
|
private const val DREAM_OUT_TRANSLATION_Y_DISTANCE = 6
|
||||||
private const val DREAM_OUT_TRANSLATION_Y_DURATION = 7L
|
private const val DREAM_OUT_TRANSLATION_Y_DURATION = 7L
|
||||||
private const val DREAM_OUT_TRANSLATION_Y_DELAY_BOTTOM = 8L
|
private const val DREAM_OUT_TRANSLATION_Y_DELAY_BOTTOM = 8L
|
||||||
@@ -54,11 +54,11 @@ class DreamOverlayAnimationsControllerTest : SysuiTestCase() {
|
|||||||
hostViewController,
|
hostViewController,
|
||||||
statusBarViewController,
|
statusBarViewController,
|
||||||
stateController,
|
stateController,
|
||||||
|
DREAM_BLUR_RADIUS,
|
||||||
DREAM_IN_BLUR_ANIMATION_DURATION,
|
DREAM_IN_BLUR_ANIMATION_DURATION,
|
||||||
DREAM_IN_BLUR_ANIMATION_DELAY,
|
|
||||||
DREAM_IN_COMPLICATIONS_ANIMATION_DURATION,
|
DREAM_IN_COMPLICATIONS_ANIMATION_DURATION,
|
||||||
DREAM_IN_TOP_COMPLICATIONS_ANIMATION_DELAY,
|
DREAM_IN_TRANSLATION_Y_DISTANCE,
|
||||||
DREAM_IN_BOTTOM_COMPLICATIONS_ANIMATION_DELAY,
|
DREAM_IN_TRANSLATION_Y_DURATION,
|
||||||
DREAM_OUT_TRANSLATION_Y_DISTANCE,
|
DREAM_OUT_TRANSLATION_Y_DISTANCE,
|
||||||
DREAM_OUT_TRANSLATION_Y_DURATION,
|
DREAM_OUT_TRANSLATION_Y_DURATION,
|
||||||
DREAM_OUT_TRANSLATION_Y_DELAY_BOTTOM,
|
DREAM_OUT_TRANSLATION_Y_DELAY_BOTTOM,
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ package com.android.systemui.dreams.complication;
|
|||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.never;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
import android.testing.AndroidTestingRunner;
|
import android.testing.AndroidTestingRunner;
|
||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
@@ -29,6 +33,7 @@ import org.junit.runner.RunWith;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
@@ -197,4 +202,19 @@ public class ComplicationLayoutParamsTest extends SysuiTestCase {
|
|||||||
assertThat(paramsWithConstraint.constraintSpecified()).isTrue();
|
assertThat(paramsWithConstraint.constraintSpecified()).isTrue();
|
||||||
assertThat(paramsWithConstraint.getConstraint()).isEqualTo(constraint);
|
assertThat(paramsWithConstraint.getConstraint()).isEqualTo(constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIteratePositions() {
|
||||||
|
final int positions = ComplicationLayoutParams.POSITION_TOP
|
||||||
|
| ComplicationLayoutParams.POSITION_START
|
||||||
|
| ComplicationLayoutParams.POSITION_END;
|
||||||
|
final Consumer<Integer> consumer = mock(Consumer.class);
|
||||||
|
|
||||||
|
ComplicationLayoutParams.iteratePositions(consumer, positions);
|
||||||
|
|
||||||
|
verify(consumer).accept(ComplicationLayoutParams.POSITION_TOP);
|
||||||
|
verify(consumer).accept(ComplicationLayoutParams.POSITION_START);
|
||||||
|
verify(consumer).accept(ComplicationLayoutParams.POSITION_END);
|
||||||
|
verify(consumer, never()).accept(ComplicationLayoutParams.POSITION_BOTTOM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user