diff options
author | Adam Cohen <adamcohen@google.com> | 2015-05-06 18:58:31 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2015-05-06 19:05:25 -0700 |
commit | 04ac4faab0336e30f0879311432a2377e2631df1 (patch) | |
tree | 06e47ec825f18aba769059c11e967e4e731d9268 | |
parent | 5dc17084256b4004c9c3eda87b88c60314c2dc89 (diff) | |
download | android_packages_apps_Trebuchet-04ac4faab0336e30f0879311432a2377e2631df1.tar.gz android_packages_apps_Trebuchet-04ac4faab0336e30f0879311432a2377e2631df1.tar.bz2 android_packages_apps_Trebuchet-04ac4faab0336e30f0879311432a2377e2631df1.zip |
Fix build in ub-launcher3-master
-> Stop depending on new RecyclerView methods
Change-Id: Ib2c58b24e2b796e6e7b3cd5e4bb927dc3f11faf2
-rw-r--r-- | src/com/android/launcher3/AppsContainerRecyclerView.java | 24 | ||||
-rw-r--r-- | src/com/android/launcher3/widget/WidgetsContainerRecyclerView.java | 24 |
2 files changed, 34 insertions, 14 deletions
diff --git a/src/com/android/launcher3/AppsContainerRecyclerView.java b/src/com/android/launcher3/AppsContainerRecyclerView.java index da81f58a4..bf478eddd 100644 --- a/src/com/android/launcher3/AppsContainerRecyclerView.java +++ b/src/com/android/launcher3/AppsContainerRecyclerView.java @@ -30,6 +30,8 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; +import com.android.launcher3.util.Thunk; + import java.util.List; /** @@ -40,10 +42,10 @@ public class AppsContainerRecyclerView extends RecyclerView implements RecyclerView.OnItemTouchListener { private static final float FAST_SCROLL_OVERLAY_Y_OFFSET_FACTOR = 1.5f; - private static final int SCROLL_DELTA_THRESHOLD = 6; + private static final int SCROLL_DELTA_THRESHOLD = 4; /** Keeps the last known scrolling delta/velocity along y-axis. */ - private int mDy = 0; + @Thunk int mDy = 0; private float mDeltaThreshold; private AlphabeticalAppsList mApps; @@ -98,6 +100,19 @@ public class AppsContainerRecyclerView extends RecyclerView res.getDimensionPixelSize(R.dimen.apps_view_fast_scroll_scrubber_touch_inset); setFastScrollerAlpha(getFastScrollerAlpha()); mDeltaThreshold = getResources().getDisplayMetrics().density * SCROLL_DELTA_THRESHOLD; + + ScrollListener listener = new ScrollListener(); + addOnScrollListener(listener); + } + + private class ScrollListener extends RecyclerView.OnScrollListener { + public ScrollListener() { + } + + @Override + public void onScrolled(RecyclerView recyclerView, int dx, int dy) { + mDy = dy; + } } /** @@ -149,11 +164,6 @@ public class AppsContainerRecyclerView extends RecyclerView drawFastScrollerPopup(canvas); } - @Override - public void onScrolled(int dx, int dy) { - mDy = dy; - } - /** * We intercept the touch handling only to support fast scrolling when initiated from the * scroll bar. Otherwise, we fall back to the default RecyclerView touch handling. diff --git a/src/com/android/launcher3/widget/WidgetsContainerRecyclerView.java b/src/com/android/launcher3/widget/WidgetsContainerRecyclerView.java index 56791c041..f70f170ed 100644 --- a/src/com/android/launcher3/widget/WidgetsContainerRecyclerView.java +++ b/src/com/android/launcher3/widget/WidgetsContainerRecyclerView.java @@ -21,6 +21,8 @@ import android.support.v7.widget.RecyclerView; import android.util.AttributeSet; import android.view.MotionEvent; +import com.android.launcher3.util.Thunk; + /** * The widgets recycler view container. * <p> @@ -30,10 +32,10 @@ import android.view.MotionEvent; public class WidgetsContainerRecyclerView extends RecyclerView implements RecyclerView.OnItemTouchListener { - private static final int SCROLL_DELTA_THRESHOLD = 6; + private static final int SCROLL_DELTA_THRESHOLD = 4; /** Keeps the last known scrolling delta/velocity along y-axis. */ - private int mDy = 0; + @Thunk int mDy = 0; private float mDeltaThreshold; public WidgetsContainerRecyclerView(Context context) { @@ -47,6 +49,19 @@ public class WidgetsContainerRecyclerView extends RecyclerView public WidgetsContainerRecyclerView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mDeltaThreshold = getResources().getDisplayMetrics().density * SCROLL_DELTA_THRESHOLD; + + ScrollListener listener = new ScrollListener(); + addOnScrollListener(listener); + } + + private class ScrollListener extends RecyclerView.OnScrollListener { + public ScrollListener() { + } + + @Override + public void onScrolled(RecyclerView recyclerView, int dx, int dy) { + mDy = dy; + } } @Override @@ -56,11 +71,6 @@ public class WidgetsContainerRecyclerView extends RecyclerView } @Override - public void onScrolled(int dx, int dy) { - mDy = dy; - } - - @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { if ((Math.abs(mDy) < mDeltaThreshold && |