diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-04-30 19:38:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-04-30 19:38:27 +0000 |
commit | fbf972e026572d5a26a9d1919beb9f113a04b094 (patch) | |
tree | 98606c69306485acea56c377a08ba6ae6b3081a5 | |
parent | 8492deaa137379ce51c1b3a81d619ddd2be581d9 (diff) | |
parent | 83b4bb0421a2bb6c299dbf4b550ca9c82b587abd (diff) | |
download | android_packages_apps_Trebuchet-fbf972e026572d5a26a9d1919beb9f113a04b094.tar.gz android_packages_apps_Trebuchet-fbf972e026572d5a26a9d1919beb9f113a04b094.tar.bz2 android_packages_apps_Trebuchet-fbf972e026572d5a26a9d1919beb9f113a04b094.zip |
Merge "Making sure Clear-all button can't be clicked when transparent" into ub-launcher3-edmonton
-rw-r--r-- | quickstep/src/com/android/quickstep/views/RecentsView.java | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 51b787ba0..6159cef34 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -304,7 +304,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl private float calculateClearAllButtonAlpha() { final int childCount = getChildCount(); - if (mClearAllButton.getVisibility() != View.VISIBLE || childCount == 0) return 0; + if (mShowEmptyMessage || childCount == 0) return 0; // Current visible coordinate of the end of the oldest task. final View lastChild = getChildAt(childCount - 1); @@ -356,7 +356,9 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl private void updateClearAllButtonAlpha() { if (mClearAllButton != null) { - mClearAllButton.setAlpha(calculateClearAllButtonAlpha() * mContentAlpha); + final float alpha = calculateClearAllButtonAlpha(); + mClearAllButton.setAlpha(alpha * mContentAlpha); + mClearAllButton.setVisibility(alpha == 0 ? INVISIBLE : VISIBLE); } } @@ -1027,9 +1029,6 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl mShowEmptyMessage = isEmpty; updateEmptyStateUi(hasSizeChanged); invalidate(); - if (mClearAllButton != null) { - updateClearAllButtonVisibility(); - } } @Override @@ -1044,7 +1043,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl mEmptyTextLayout = null; mLastMeasureSize.set(getWidth(), getHeight()); } - updateClearAllButtonVisibility(); + updateClearAllButtonAlpha(); if (!mShowEmptyMessage) return; @@ -1238,14 +1237,8 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl return mIsRtl ? additionalScrollForClearAllButton() : 0; } - private void updateClearAllButtonVisibility() { - if (mClearAllButton == null) return; - mClearAllButton.setVisibility(mShowEmptyMessage ? GONE : VISIBLE); - updateClearAllButtonAlpha(); - } - public void setClearAllButton(View clearAllButton) { mClearAllButton = clearAllButton; - updateClearAllButtonVisibility(); + updateClearAllButtonAlpha(); } } |