summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/BaseRecyclerView.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-06-12 14:18:55 -0700
committerWinson Chung <winsonc@google.com>2015-06-16 00:55:02 +0000
commitfbc5b18626ae2e158e39c59606455124cfa8127d (patch)
treeaa4ccb95ad93e5cd9143bb4a84713b032d0a0dd5 /src/com/android/launcher3/BaseRecyclerView.java
parentc332934e27527107c7f9c50ba6b7af93979b8126 (diff)
downloadandroid_packages_apps_Trebuchet-fbc5b18626ae2e158e39c59606455124cfa8127d.tar.gz
android_packages_apps_Trebuchet-fbc5b18626ae2e158e39c59606455124cfa8127d.tar.bz2
android_packages_apps_Trebuchet-fbc5b18626ae2e158e39c59606455124cfa8127d.zip
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
Diffstat (limited to 'src/com/android/launcher3/BaseRecyclerView.java')
-rw-r--r--src/com/android/launcher3/BaseRecyclerView.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/com/android/launcher3/BaseRecyclerView.java b/src/com/android/launcher3/BaseRecyclerView.java
index 6dd029f17..140c28c0c 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 @@ public class BaseRecyclerView extends RecyclerView
/**
* 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) {