Merge "Migrate AnimatableClockView to SystemUISharedLib" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
842e2c7ab1
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.keyguard
|
package com.android.systemui.animation
|
||||||
|
|
||||||
import android.graphics.fonts.Font
|
import android.graphics.fonts.Font
|
||||||
import android.graphics.fonts.FontVariationAxis
|
import android.graphics.fonts.FontVariationAxis
|
||||||
@@ -61,7 +61,7 @@ class FontInterpolator {
|
|||||||
var index: Int,
|
var index: Int,
|
||||||
val sortedAxes: MutableList<FontVariationAxis>
|
val sortedAxes: MutableList<FontVariationAxis>
|
||||||
) {
|
) {
|
||||||
constructor(font: Font, axes: List<FontVariationAxis>):
|
constructor(font: Font, axes: List<FontVariationAxis>) :
|
||||||
this(font.sourceIdentifier,
|
this(font.sourceIdentifier,
|
||||||
font.ttcIndex,
|
font.ttcIndex,
|
||||||
axes.toMutableList().apply { sortBy { it.tag } }
|
axes.toMutableList().apply { sortBy { it.tag } }
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.keyguard
|
package com.android.systemui.animation
|
||||||
|
|
||||||
import android.animation.Animator
|
import android.animation.Animator
|
||||||
import android.animation.AnimatorListenerAdapter
|
import android.animation.AnimatorListenerAdapter
|
||||||
@@ -61,8 +61,8 @@ class TextAnimator(
|
|||||||
private val invalidateCallback: () -> Unit
|
private val invalidateCallback: () -> Unit
|
||||||
) {
|
) {
|
||||||
// Following two members are for mutable for testing purposes.
|
// Following two members are for mutable for testing purposes.
|
||||||
internal var textInterpolator: TextInterpolator = TextInterpolator(layout)
|
public var textInterpolator: TextInterpolator = TextInterpolator(layout)
|
||||||
internal var animator: ValueAnimator = ValueAnimator.ofFloat(1f).apply {
|
public var animator: ValueAnimator = ValueAnimator.ofFloat(1f).apply {
|
||||||
duration = DEFAULT_ANIMATION_DURATION
|
duration = DEFAULT_ANIMATION_DURATION
|
||||||
addUpdateListener {
|
addUpdateListener {
|
||||||
textInterpolator.progress = it.animatedValue as Float
|
textInterpolator.progress = it.animatedValue as Float
|
||||||
@@ -279,4 +279,4 @@ private fun <V> SparseArray<V>.getOrElse(key: Int, defaultValue: () -> V): V {
|
|||||||
put(key, v)
|
put(key, v)
|
||||||
}
|
}
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.keyguard
|
package com.android.systemui.animation
|
||||||
|
|
||||||
import android.graphics.Canvas
|
import android.graphics.Canvas
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:paddingStart="@dimen/clock_padding_start">
|
android:paddingStart="@dimen/clock_padding_start">
|
||||||
<com.android.keyguard.AnimatableClockView
|
<com.android.systemui.shared.clocks.AnimatableClockView
|
||||||
android:id="@+id/animatable_clock_view"
|
android:id="@+id/animatable_clock_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/keyguard_slice_view"
|
android:layout_below="@id/keyguard_slice_view"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
<com.android.keyguard.AnimatableClockView
|
<com.android.systemui.shared.clocks.AnimatableClockView
|
||||||
android:id="@+id/animatable_clock_view_large"
|
android:id="@+id/animatable_clock_view_large"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -41,10 +41,4 @@
|
|||||||
<attr name="passwordStyle" format="reference" />
|
<attr name="passwordStyle" format="reference" />
|
||||||
|
|
||||||
<attr name="numPadKeyStyle" format="reference" />
|
<attr name="numPadKeyStyle" format="reference" />
|
||||||
|
|
||||||
<declare-styleable name="AnimatableClockView">
|
|
||||||
<attr name="dozeWeight" format="integer" />
|
|
||||||
<attr name="lockScreenWeight" format="integer" />
|
|
||||||
<attr name="chargeAnimationDelay" format="integer" />
|
|
||||||
</declare-styleable>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -23,11 +23,5 @@
|
|||||||
<!-- Skeleton string format for displaying the date shorter. -->
|
<!-- Skeleton string format for displaying the date shorter. -->
|
||||||
<string name="abbrev_month_day_no_year">MMMd</string>
|
<string name="abbrev_month_day_no_year">MMMd</string>
|
||||||
|
|
||||||
<!-- Skeleton string format for displaying the time in 12-hour format. -->
|
|
||||||
<string name="clock_12hr_format">hm</string>
|
|
||||||
|
|
||||||
<!-- Skeleton string format for displaying the time in 24-hour format. -->
|
|
||||||
<string name="clock_24hr_format">Hm</string>
|
|
||||||
|
|
||||||
<string name="num_pad_key_ratio">1</string>
|
<string name="num_pad_key_ratio">1</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ android_library {
|
|||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"PluginCoreLib",
|
"PluginCoreLib",
|
||||||
|
"SystemUIAnimationLib",
|
||||||
"SystemUIUnfoldLib",
|
"SystemUIUnfoldLib",
|
||||||
"androidx.dynamicanimation_dynamicanimation",
|
"androidx.dynamicanimation_dynamicanimation",
|
||||||
"androidx.concurrent_concurrent-futures",
|
"androidx.concurrent_concurrent-futures",
|
||||||
|
|||||||
28
packages/SystemUI/shared/res/values/attrs.xml
Normal file
28
packages/SystemUI/shared/res/values/attrs.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2022 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Formatting note: terminate all comments with a period, to avoid breaking
|
||||||
|
the documentation output. To suppress comment lines from the documentation
|
||||||
|
output, insert an eat-comment element after the comment lines.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="AnimatableClockView">
|
||||||
|
<attr name="dozeWeight" format="integer" />
|
||||||
|
<attr name="lockScreenWeight" format="integer" />
|
||||||
|
<attr name="chargeAnimationDelay" format="integer" />
|
||||||
|
</declare-styleable>
|
||||||
|
</resources>
|
||||||
23
packages/SystemUI/shared/res/values/donottranslate.xml
Normal file
23
packages/SystemUI/shared/res/values/donottranslate.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2022 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<!-- Skeleton string format for displaying the time in 12-hour format. -->
|
||||||
|
<string name="clock_12hr_format">hm</string>
|
||||||
|
|
||||||
|
<!-- Skeleton string format for displaying the time in 24-hour format. -->
|
||||||
|
<string name="clock_24hr_format">Hm</string>
|
||||||
|
</resources>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.keyguard
|
package com.android.systemui.shared.clocks
|
||||||
|
|
||||||
import android.animation.TimeInterpolator
|
import android.animation.TimeInterpolator
|
||||||
import android.annotation.ColorInt
|
import android.annotation.ColorInt
|
||||||
@@ -26,9 +26,10 @@ import android.text.TextUtils
|
|||||||
import android.text.format.DateFormat
|
import android.text.format.DateFormat
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.android.systemui.R
|
import com.android.systemui.animation.GlyphCallback
|
||||||
import com.android.systemui.animation.Interpolators
|
import com.android.systemui.animation.Interpolators
|
||||||
import com.android.systemui.statusbar.notification.stack.StackStateAnimator
|
import com.android.systemui.animation.TextAnimator
|
||||||
|
import com.android.systemui.shared.R
|
||||||
import java.io.PrintWriter
|
import java.io.PrintWriter
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
@@ -38,13 +39,13 @@ import java.util.TimeZone
|
|||||||
* Displays the time with the hour positioned above the minutes. (ie: 09 above 30 is 9:30)
|
* Displays the time with the hour positioned above the minutes. (ie: 09 above 30 is 9:30)
|
||||||
* The time's text color is a gradient that changes its colors based on its controller.
|
* The time's text color is a gradient that changes its colors based on its controller.
|
||||||
*/
|
*/
|
||||||
|
@SuppressLint("AppCompatCustomView")
|
||||||
class AnimatableClockView @JvmOverloads constructor(
|
class AnimatableClockView @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
attrs: AttributeSet? = null,
|
attrs: AttributeSet? = null,
|
||||||
defStyleAttr: Int = 0,
|
defStyleAttr: Int = 0,
|
||||||
defStyleRes: Int = 0
|
defStyleRes: Int = 0
|
||||||
) : TextView(context, attrs, defStyleAttr, defStyleRes) {
|
) : TextView(context, attrs, defStyleAttr, defStyleRes) {
|
||||||
private val tag = "AnimatableClockView"
|
|
||||||
|
|
||||||
private var lastMeasureCall: CharSequence = ""
|
private var lastMeasureCall: CharSequence = ""
|
||||||
|
|
||||||
@@ -193,7 +194,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun animateFoldAppear() {
|
fun animateFoldAppear(animate: Boolean = true) {
|
||||||
if (textAnimator == null) {
|
if (textAnimator == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -210,22 +211,22 @@ class AnimatableClockView @JvmOverloads constructor(
|
|||||||
weight = dozingWeightInternal,
|
weight = dozingWeightInternal,
|
||||||
textSize = -1f,
|
textSize = -1f,
|
||||||
color = dozingColor,
|
color = dozingColor,
|
||||||
animate = true,
|
animate = animate,
|
||||||
interpolator = Interpolators.EMPHASIZED_DECELERATE,
|
interpolator = Interpolators.EMPHASIZED_DECELERATE,
|
||||||
duration = StackStateAnimator.ANIMATION_DURATION_FOLD_TO_AOD.toLong(),
|
duration = ANIMATION_DURATION_FOLD_TO_AOD.toLong(),
|
||||||
delay = 0,
|
delay = 0,
|
||||||
onAnimationEnd = null
|
onAnimationEnd = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun animateCharge(dozeStateGetter: DozeStateGetter) {
|
fun animateCharge(isDozing: () -> Boolean) {
|
||||||
if (textAnimator == null || textAnimator!!.isRunning()) {
|
if (textAnimator == null || textAnimator!!.isRunning()) {
|
||||||
// Skip charge animation if dozing animation is already playing.
|
// Skip charge animation if dozing animation is already playing.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val startAnimPhase2 = Runnable {
|
val startAnimPhase2 = Runnable {
|
||||||
setTextStyle(
|
setTextStyle(
|
||||||
weight = if (dozeStateGetter.isDozing) dozingWeight else lockScreenWeight,
|
weight = if (isDozing()) dozingWeight else lockScreenWeight,
|
||||||
textSize = -1f,
|
textSize = -1f,
|
||||||
color = null,
|
color = null,
|
||||||
animate = true,
|
animate = true,
|
||||||
@@ -235,7 +236,7 @@ class AnimatableClockView @JvmOverloads constructor(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
setTextStyle(
|
setTextStyle(
|
||||||
weight = if (dozeStateGetter.isDozing) lockScreenWeight else dozingWeight,
|
weight = if (isDozing()) lockScreenWeight else dozingWeight,
|
||||||
textSize = -1f,
|
textSize = -1f,
|
||||||
color = null,
|
color = null,
|
||||||
animate = true,
|
animate = true,
|
||||||
@@ -385,14 +386,14 @@ class AnimatableClockView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DozeStateGetter {
|
companion object {
|
||||||
val isDozing: Boolean
|
private val TAG = AnimatableClockView::class.simpleName
|
||||||
|
const val ANIMATION_DURATION_FOLD_TO_AOD: Int = 600
|
||||||
|
private const val DOUBLE_LINE_FORMAT_12_HOUR = "hh\nmm"
|
||||||
|
private const val DOUBLE_LINE_FORMAT_24_HOUR = "HH\nmm"
|
||||||
|
private const val DOZE_ANIM_DURATION: Long = 300
|
||||||
|
private const val APPEAR_ANIM_DURATION: Long = 350
|
||||||
|
private const val CHARGE_ANIM_DURATION_PHASE_0: Long = 500
|
||||||
|
private const val CHARGE_ANIM_DURATION_PHASE_1: Long = 1000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val DOUBLE_LINE_FORMAT_12_HOUR = "hh\nmm"
|
|
||||||
private const val DOUBLE_LINE_FORMAT_24_HOUR = "HH\nmm"
|
|
||||||
private const val DOZE_ANIM_DURATION: Long = 300
|
|
||||||
private const val APPEAR_ANIM_DURATION: Long = 350
|
|
||||||
private const val CHARGE_ANIM_DURATION_PHASE_0: Long = 500
|
|
||||||
private const val CHARGE_ANIM_DURATION_PHASE_1: Long = 1000
|
|
||||||
@@ -32,6 +32,7 @@ import com.android.systemui.R;
|
|||||||
import com.android.systemui.broadcast.BroadcastDispatcher;
|
import com.android.systemui.broadcast.BroadcastDispatcher;
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
import com.android.systemui.dagger.qualifiers.Main;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
|
import com.android.systemui.shared.clocks.AnimatableClockView;
|
||||||
import com.android.systemui.statusbar.policy.BatteryController;
|
import com.android.systemui.statusbar.policy.BatteryController;
|
||||||
import com.android.systemui.util.ViewController;
|
import com.android.systemui.util.ViewController;
|
||||||
|
|
||||||
@@ -134,6 +135,21 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
|
|||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTimeFormatChanged(String timeFormat) {
|
||||||
|
mView.refreshFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTimeZoneChanged(TimeZone timeZone) {
|
||||||
|
mView.onTimeZoneChanged(timeZone);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserSwitchComplete(int userId) {
|
||||||
|
mView.refreshFormat();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -186,7 +202,7 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
|
|||||||
/** Animate the clock appearance when a foldable device goes from fully-open/half-open state to
|
/** Animate the clock appearance when a foldable device goes from fully-open/half-open state to
|
||||||
* fully folded state and it goes to sleep (always on display screen) */
|
* fully folded state and it goes to sleep (always on display screen) */
|
||||||
public void animateFoldAppear() {
|
public void animateFoldAppear() {
|
||||||
mView.animateFoldAppear();
|
mView.animateFoldAppear(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -196,20 +212,6 @@ public class AnimatableClockController extends ViewController<AnimatableClockVie
|
|||||||
mView.refreshTime();
|
mView.refreshTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the timezone for the view.
|
|
||||||
*/
|
|
||||||
public void onTimeZoneChanged(TimeZone timeZone) {
|
|
||||||
mView.onTimeZoneChanged(timeZone);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Trigger a time format update
|
|
||||||
*/
|
|
||||||
public void refreshFormat() {
|
|
||||||
mView.refreshFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return locallly stored dozing state.
|
* Return locallly stored dozing state.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.android.keyguard.dagger.KeyguardStatusViewScope;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.animation.Interpolators;
|
import com.android.systemui.animation.Interpolators;
|
||||||
import com.android.systemui.plugins.ClockPlugin;
|
import com.android.systemui.plugins.ClockPlugin;
|
||||||
|
import com.android.systemui.shared.clocks.AnimatableClockView;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
|
|||||||
@@ -398,17 +398,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
|||||||
|
|
||||||
void updateTimeZone(TimeZone timeZone) {
|
void updateTimeZone(TimeZone timeZone) {
|
||||||
mView.onTimeZoneChanged(timeZone);
|
mView.onTimeZoneChanged(timeZone);
|
||||||
if (mClockViewController != null) {
|
|
||||||
mClockViewController.onTimeZoneChanged(timeZone);
|
|
||||||
mLargeClockViewController.onTimeZoneChanged(timeZone);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void refreshFormat() {
|
|
||||||
if (mClockViewController != null) {
|
|
||||||
mClockViewController.refreshFormat();
|
|
||||||
mLargeClockViewController.refreshFormat();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -239,11 +239,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
|||||||
refreshTime();
|
refreshTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTimeFormatChanged(String timeFormat) {
|
|
||||||
mKeyguardClockSwitchController.refreshFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTimeZoneChanged(TimeZone timeZone) {
|
public void onTimeZoneChanged(TimeZone timeZone) {
|
||||||
mKeyguardClockSwitchController.updateTimeZone(timeZone);
|
mKeyguardClockSwitchController.updateTimeZone(timeZone);
|
||||||
@@ -256,11 +251,6 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
|
|||||||
refreshTime();
|
refreshTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUserSwitchComplete(int userId) {
|
|
||||||
mKeyguardClockSwitchController.refreshFormat();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import android.view.View;
|
|||||||
import com.android.keyguard.KeyguardSliceView;
|
import com.android.keyguard.KeyguardSliceView;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.animation.Interpolators;
|
import com.android.systemui.animation.Interpolators;
|
||||||
|
import com.android.systemui.shared.clocks.AnimatableClockView;
|
||||||
import com.android.systemui.statusbar.NotificationShelf;
|
import com.android.systemui.statusbar.NotificationShelf;
|
||||||
import com.android.systemui.statusbar.StatusBarIconView;
|
import com.android.systemui.statusbar.StatusBarIconView;
|
||||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||||
@@ -52,7 +53,8 @@ public class StackStateAnimator {
|
|||||||
public static final int ANIMATION_DURATION_CLOSE_REMOTE_INPUT = 150;
|
public static final int ANIMATION_DURATION_CLOSE_REMOTE_INPUT = 150;
|
||||||
public static final int ANIMATION_DURATION_HEADS_UP_APPEAR = 400;
|
public static final int ANIMATION_DURATION_HEADS_UP_APPEAR = 400;
|
||||||
public static final int ANIMATION_DURATION_HEADS_UP_DISAPPEAR = 400;
|
public static final int ANIMATION_DURATION_HEADS_UP_DISAPPEAR = 400;
|
||||||
public static final int ANIMATION_DURATION_FOLD_TO_AOD = 600;
|
public static final int ANIMATION_DURATION_FOLD_TO_AOD =
|
||||||
|
AnimatableClockView.ANIMATION_DURATION_FOLD_TO_AOD;
|
||||||
public static final int ANIMATION_DURATION_PULSE_APPEAR =
|
public static final int ANIMATION_DURATION_PULSE_APPEAR =
|
||||||
KeyguardSliceView.DEFAULT_ANIM_DURATION;
|
KeyguardSliceView.DEFAULT_ANIM_DURATION;
|
||||||
public static final int ANIMATION_DURATION_BLOCKING_HELPER_FADE = 240;
|
public static final int ANIMATION_DURATION_BLOCKING_HELPER_FADE = 240;
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ import com.android.systemui.dump.DumpManager;
|
|||||||
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
|
import com.android.systemui.keyguard.KeyguardUnlockAnimationController;
|
||||||
import com.android.systemui.plugins.ClockPlugin;
|
import com.android.systemui.plugins.ClockPlugin;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
|
import com.android.systemui.shared.clocks.AnimatableClockView;
|
||||||
import com.android.systemui.statusbar.StatusBarState;
|
import com.android.systemui.statusbar.StatusBarState;
|
||||||
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController;
|
import com.android.systemui.statusbar.lockscreen.LockscreenSmartspaceController;
|
||||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import android.widget.TextClock;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.plugins.ClockPlugin;
|
import com.android.systemui.plugins.ClockPlugin;
|
||||||
|
import com.android.systemui.shared.clocks.AnimatableClockView;
|
||||||
import com.android.systemui.statusbar.StatusBarState;
|
import com.android.systemui.statusbar.StatusBarState;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|||||||
@@ -88,28 +88,6 @@ public class KeyguardStatusViewControllerTest extends SysuiTestCase {
|
|||||||
verify(mKeyguardClockSwitchController).refresh();
|
verify(mKeyguardClockSwitchController).refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void timeFormatUpdateNotifiesClockSwitchController() {
|
|
||||||
mController.onViewAttached();
|
|
||||||
|
|
||||||
verify(mKeyguardUpdateMonitor).registerCallback(
|
|
||||||
mKeyguardUpdateMonitorCallbackCaptor.capture());
|
|
||||||
|
|
||||||
mKeyguardUpdateMonitorCallbackCaptor.getValue().onTimeFormatChanged("");
|
|
||||||
verify(mKeyguardClockSwitchController).refreshFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void userChangeNotifiesClockSwitchController() {
|
|
||||||
mController.onViewAttached();
|
|
||||||
|
|
||||||
verify(mKeyguardUpdateMonitor).registerCallback(
|
|
||||||
mKeyguardUpdateMonitorCallbackCaptor.capture());
|
|
||||||
|
|
||||||
mKeyguardUpdateMonitorCallbackCaptor.getValue().onUserSwitchComplete(0);
|
|
||||||
verify(mKeyguardClockSwitchController).refreshFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setTranslationYExcludingMedia_forwardsCallToView() {
|
public void setTranslationYExcludingMedia_forwardsCallToView() {
|
||||||
float translationY = 123f;
|
float translationY = 123f;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.keyguard
|
package com.android.systemui.animation
|
||||||
|
|
||||||
import android.graphics.Paint
|
import android.graphics.Paint
|
||||||
import android.graphics.fonts.Font
|
import android.graphics.fonts.Font
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.keyguard
|
package com.android.systemui.animation
|
||||||
|
|
||||||
import android.animation.AnimatorListenerAdapter
|
import android.animation.AnimatorListenerAdapter
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
@@ -26,18 +26,17 @@ import android.text.TextPaint
|
|||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import kotlin.math.ceil
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.ArgumentCaptor
|
import org.mockito.ArgumentCaptor
|
||||||
import org.mockito.Mockito.`when`
|
|
||||||
import org.mockito.Mockito.eq
|
import org.mockito.Mockito.eq
|
||||||
import org.mockito.Mockito.inOrder
|
import org.mockito.Mockito.inOrder
|
||||||
import org.mockito.Mockito.mock
|
import org.mockito.Mockito.mock
|
||||||
import org.mockito.Mockito.never
|
import org.mockito.Mockito.never
|
||||||
import org.mockito.Mockito.times
|
import org.mockito.Mockito.times
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
|
import org.mockito.Mockito.`when`
|
||||||
import kotlin.math.ceil
|
|
||||||
|
|
||||||
private val PAINT = TextPaint().apply {
|
private val PAINT = TextPaint().apply {
|
||||||
textSize = 32f
|
textSize = 32f
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.android.keyguard
|
package com.android.systemui.animation
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Canvas
|
import android.graphics.Canvas
|
||||||
@@ -31,10 +31,10 @@ import android.text.TextPaint
|
|||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.Test
|
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
import org.junit.Test
|
||||||
|
import org.junit.runner.RunWith
|
||||||
|
|
||||||
private const val TEXT = "Hello, World."
|
private const val TEXT = "Hello, World."
|
||||||
private const val BIDI_TEXT = "abc\u05D0\u05D1\u05D2"
|
private const val BIDI_TEXT = "abc\u05D0\u05D1\u05D2"
|
||||||
@@ -323,4 +323,4 @@ private fun Layout.toBitmap(width: Int, height: Int) =
|
|||||||
Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888).also { draw(Canvas(it)) }!!
|
Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888).also { draw(Canvas(it)) }!!
|
||||||
|
|
||||||
private fun TextInterpolator.toBitmap(width: Int, height: Int) =
|
private fun TextInterpolator.toBitmap(width: Int, height: Int) =
|
||||||
Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888).also { draw(Canvas(it)) }
|
Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888).also { draw(Canvas(it)) }
|
||||||
@@ -34,12 +34,12 @@ import android.view.View;
|
|||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import com.android.keyguard.AnimatableClockController;
|
import com.android.keyguard.AnimatableClockController;
|
||||||
import com.android.keyguard.AnimatableClockView;
|
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||||
import com.android.settingslib.Utils;
|
import com.android.settingslib.Utils;
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.broadcast.BroadcastDispatcher;
|
import com.android.systemui.broadcast.BroadcastDispatcher;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
|
import com.android.systemui.shared.clocks.AnimatableClockView;
|
||||||
import com.android.systemui.statusbar.policy.BatteryController;
|
import com.android.systemui.statusbar.policy.BatteryController;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
|||||||
Reference in New Issue
Block a user