summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorLucas Dupin <dupin@google.com>2018-05-23 20:15:19 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-05-23 20:15:19 +0000
commit3116918bf0457f8eb36d37dea0d0e8802bd38b3d (patch)
tree946977f7c606137fce299d3a7a43b9445409a162 /packages/SystemUI/src
parentf021d88cd85a6a10e6f89465ee319702bc71a885 (diff)
parent3978e6e6ee0852aad0dc62d6abee27568ac9c0d2 (diff)
Merge "Only animate when the slice is actually animating" into pi-dev
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java16
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java12
2 files changed, 14 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
index 97cf1e51e1df..52e1c167ffc8 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java
@@ -84,10 +84,9 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe
private LiveData<Slice> mLiveData;
private int mIconSize;
/**
- * Listener called whenever the view contents change.
- * Boolean will be true when the change happens animated.
+ * Runnable called whenever the view contents change.
*/
- private Consumer<Boolean> mContentChangeListener;
+ private Runnable mContentChangeListener;
private boolean mHasHeader;
private Slice mSlice;
private boolean mPulsing;
@@ -150,7 +149,9 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe
if (mPulsing || mSlice == null) {
mTitle.setVisibility(GONE);
mRow.setVisibility(GONE);
- mContentChangeListener.accept(getLayoutTransition() != null);
+ if (mContentChangeListener != null) {
+ mContentChangeListener.run();
+ }
return;
}
@@ -223,7 +224,7 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe
}
if (mContentChangeListener != null) {
- mContentChangeListener.accept(getLayoutTransition() != null);
+ mContentChangeListener.run();
}
}
@@ -310,11 +311,10 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe
}
/**
- * Listener that gets invoked every time the title or the row visibility changes.
- * Parameter will be {@code true} whenever the change happens animated.
+ * Runnable that gets invoked every time the title or the row visibility changes.
* @param contentChangeListener The listener.
*/
- public void setContentChangeListener(Consumer<Boolean> contentChangeListener) {
+ public void setContentChangeListener(Runnable contentChangeListener) {
mContentChangeListener = contentChangeListener;
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index 758a1b44b927..976b45424502 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -76,7 +76,6 @@ public class KeyguardStatusView extends GridLayout implements
private float mDarkAmount = 0;
private int mTextColor;
private float mWidgetPadding;
- private boolean mAnimateLayout;
private int mLastLayoutHeight;
private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() {
@@ -185,7 +184,7 @@ public class KeyguardStatusView extends GridLayout implements
mClockView.addOnLayoutChangeListener(this);
mClockSeparator.addOnLayoutChangeListener(this);
mKeyguardSlice.setContentChangeListener(this::onSliceContentChanged);
- onSliceContentChanged(false /* animated */);
+ onSliceContentChanged();
boolean shouldMarquee = KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive();
setEnableMarquee(shouldMarquee);
@@ -199,8 +198,7 @@ public class KeyguardStatusView extends GridLayout implements
mClockView.setElegantTextHeight(false);
}
- private void onSliceContentChanged(boolean animated) {
- mAnimateLayout = animated;
+ private void onSliceContentChanged() {
boolean smallClock = mKeyguardSlice.hasHeader() || mPulsing;
float clockScale = smallClock ? mSmallClockScale : 1;
@@ -228,10 +226,12 @@ public class KeyguardStatusView extends GridLayout implements
long duration = KeyguardSliceView.DEFAULT_ANIM_DURATION;
long delay = smallClock ? 0 : duration / 4;
+ boolean shouldAnimate = mKeyguardSlice.getLayoutTransition() != null
+ && mKeyguardSlice.getLayoutTransition().isRunning();
if (view == mClockView) {
float clockScale = smallClock ? mSmallClockScale : 1;
Paint.Style style = smallClock ? Paint.Style.FILL_AND_STROKE : Paint.Style.FILL;
- if (mAnimateLayout) {
+ if (shouldAnimate) {
mClockView.setY(oldTop + heightOffset);
mClockView.animate().cancel();
mClockView.animate()
@@ -257,7 +257,7 @@ public class KeyguardStatusView extends GridLayout implements
} else if (view == mClockSeparator) {
boolean hasSeparator = hasHeader && !mPulsing;
float alpha = hasSeparator ? 1 : 0;
- if (mAnimateLayout) {
+ if (shouldAnimate) {
boolean isAwake = mDarkAmount != 0;
mClockSeparator.setY(oldTop + heightOffset);
mClockSeparator.animate().cancel();