diff options
author | Lucas Dupin <dupin@google.com> | 2018-05-22 18:08:35 -0700 |
---|---|---|
committer | Lucas Dupin <dupin@google.com> | 2018-05-22 19:13:51 -0700 |
commit | 3978e6e6ee0852aad0dc62d6abee27568ac9c0d2 (patch) | |
tree | ba40b340f95ccf9a6c2db61d63bb1dc17ad9506f /packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java | |
parent | b4ef94d1a9316eccb31f1993bae8af0019cdd345 (diff) |
Only animate when the slice is actually animating
It's not correct to always animate if there is a layout transition.
The transition might not be triggered when the view is invisible
for example. It's necessary to check if we have pending/running
animations.
Change-Id: I75dbc9f8a152a162a3c77c9b316f653e665b8842
Fixes: 79773596
Test: manual
Test: atest packages/SystemUI/tests/src/com/android/keyguard/KeyguardSliceViewTest.java
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java index f066e3401752..c0b10e29618e 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java @@ -83,10 +83,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; @@ -149,7 +148,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; } @@ -221,7 +222,7 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe } if (mContentChangeListener != null) { - mContentChangeListener.accept(getLayoutTransition() != null); + mContentChangeListener.run(); } } @@ -308,11 +309,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; } |