Loading src/com/android/launcher3/allapps/AllAppsContainerView.java +0 −31 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.InsetDrawable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.Selection; import android.text.SpannableStringBuilder; import android.util.AttributeSet; Loading Loading @@ -227,7 +226,6 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc mAppsRecyclerView.setHasFixedSize(true); if (FeatureFlags.LAUNCHER3_PHYSICS) { mAppsRecyclerView.setSpringAnimationHandler(mSpringAnimationHandler); mAppsRecyclerView.addOnScrollListener(new SpringMotionOnScrollListener()); } mSearchContainer = findViewById(R.id.search_container_all_apps); Loading Loading @@ -403,33 +401,4 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc public SpringAnimationHandler getSpringAnimationHandler() { return mSpringAnimationHandler; } public class SpringMotionOnScrollListener extends RecyclerView.OnScrollListener { private int mScrollState = RecyclerView.SCROLL_STATE_IDLE; @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (mScrollState == RecyclerView.SCROLL_STATE_DRAGGING || (dx == 0 && dy == 0)) { if (mSpringAnimationHandler.isRunning()){ mSpringAnimationHandler.skipToEnd(); } return; } // We only start the spring animation when we fling and hit the top/bottom, to ensure // that all of the animations start at the same time. if (dy < 0 && !mAppsRecyclerView.canScrollVertically(-1)) { mSpringAnimationHandler.animateToFinalPosition(0, 1); } else if (dy > 0 && !mAppsRecyclerView.canScrollVertically(1)) { mSpringAnimationHandler.animateToFinalPosition(0, -1); } } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); mScrollState = newState; } } } src/com/android/launcher3/allapps/AllAppsRecyclerView.java +23 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,10 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine } public void setSpringAnimationHandler(SpringAnimationHandler springAnimationHandler) { if (FeatureFlags.LAUNCHER3_PHYSICS) { mSpringAnimationHandler = springAnimationHandler; addOnScrollListener(new SpringMotionOnScrollListener()); } } @Override Loading Loading @@ -486,6 +489,25 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine y + mEmptySearchBackground.getIntrinsicHeight()); } private class SpringMotionOnScrollListener extends RecyclerView.OnScrollListener { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (mOverScrollHelper.isInOverScroll()) { // OverScroll will handle animating the springs. return; } // We only start the spring animation when we hit the top/bottom, to ensure // that all of the animations start at the same time. if (dy < 0 && !canScrollVertically(-1)) { mSpringAnimationHandler.animateToFinalPosition(0, 1); } else if (dy > 0 && !canScrollVertically(1)) { mSpringAnimationHandler.animateToFinalPosition(0, -1); } } } private class OverScrollHelper implements SwipeDetector.Listener { private static final float MAX_RELEASE_VELOCITY = 5000; // px / s Loading Loading
src/com/android/launcher3/allapps/AllAppsContainerView.java +0 −31 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.InsetDrawable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.text.Selection; import android.text.SpannableStringBuilder; import android.util.AttributeSet; Loading Loading @@ -227,7 +226,6 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc mAppsRecyclerView.setHasFixedSize(true); if (FeatureFlags.LAUNCHER3_PHYSICS) { mAppsRecyclerView.setSpringAnimationHandler(mSpringAnimationHandler); mAppsRecyclerView.addOnScrollListener(new SpringMotionOnScrollListener()); } mSearchContainer = findViewById(R.id.search_container_all_apps); Loading Loading @@ -403,33 +401,4 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc public SpringAnimationHandler getSpringAnimationHandler() { return mSpringAnimationHandler; } public class SpringMotionOnScrollListener extends RecyclerView.OnScrollListener { private int mScrollState = RecyclerView.SCROLL_STATE_IDLE; @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (mScrollState == RecyclerView.SCROLL_STATE_DRAGGING || (dx == 0 && dy == 0)) { if (mSpringAnimationHandler.isRunning()){ mSpringAnimationHandler.skipToEnd(); } return; } // We only start the spring animation when we fling and hit the top/bottom, to ensure // that all of the animations start at the same time. if (dy < 0 && !mAppsRecyclerView.canScrollVertically(-1)) { mSpringAnimationHandler.animateToFinalPosition(0, 1); } else if (dy > 0 && !mAppsRecyclerView.canScrollVertically(1)) { mSpringAnimationHandler.animateToFinalPosition(0, -1); } } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); mScrollState = newState; } } }
src/com/android/launcher3/allapps/AllAppsRecyclerView.java +23 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,10 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine } public void setSpringAnimationHandler(SpringAnimationHandler springAnimationHandler) { if (FeatureFlags.LAUNCHER3_PHYSICS) { mSpringAnimationHandler = springAnimationHandler; addOnScrollListener(new SpringMotionOnScrollListener()); } } @Override Loading Loading @@ -486,6 +489,25 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine y + mEmptySearchBackground.getIntrinsicHeight()); } private class SpringMotionOnScrollListener extends RecyclerView.OnScrollListener { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (mOverScrollHelper.isInOverScroll()) { // OverScroll will handle animating the springs. return; } // We only start the spring animation when we hit the top/bottom, to ensure // that all of the animations start at the same time. if (dy < 0 && !canScrollVertically(-1)) { mSpringAnimationHandler.animateToFinalPosition(0, 1); } else if (dy > 0 && !canScrollVertically(1)) { mSpringAnimationHandler.animateToFinalPosition(0, -1); } } } private class OverScrollHelper implements SwipeDetector.Listener { private static final float MAX_RELEASE_VELOCITY = 5000; // px / s Loading