Refactored section names to only draw when there is space.
- This CL removes all space for section names in both phones
and tablets. And when there are no section names, the layout
will automatically fully merge the sections.
Bug: 20222023
Change-Id: Ic7c751d86f095e5cbd690bfd4f94bb5b00ff8ae4
diff --git a/src/com/android/launcher3/BaseRecyclerView.java b/src/com/android/launcher3/BaseRecyclerView.java
index 6dd029f..140c28c 100644
--- a/src/com/android/launcher3/BaseRecyclerView.java
+++ b/src/com/android/launcher3/BaseRecyclerView.java
@@ -16,6 +16,8 @@
package com.android.launcher3;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Resources;
@@ -315,13 +317,38 @@
/**
* Animates the visibility of the fast scroller popup.
*/
- private void animateFastScrollerVisibility(boolean visible) {
+ private void animateFastScrollerVisibility(final boolean visible) {
ObjectAnimator anim = ObjectAnimator.ofFloat(this, "fastScrollerAlpha", visible ? 1f : 0f);
anim.setDuration(visible ? 200 : 150);
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ if (visible) {
+ onFastScrollingStart();
+ }
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ if (!visible) {
+ onFastScrollingEnd();
+ }
+ }
+ });
anim.start();
}
/**
+ * To be overridden by subclasses.
+ */
+ protected void onFastScrollingStart() {}
+
+ /**
+ * To be overridden by subclasses.
+ */
+ protected void onFastScrollingEnd() {}
+
+ /**
* Invalidates the fast scroller popup.
*/
protected void invalidateFastScroller(Rect bounds) {