Don't snap to center if the scroll position doesn't change.

The underlying casue of the issue is that the RecyclerView
changes the scroll state to settling before it figures out
whether it will actually scroll by any distance.

Bug:31304796

Change-Id: I606a714de6e308bd4958ab17dc607602b88d0c4d
(cherry picked from commit 6004bb47ebf40a36ab049c79b27a7b8065db4970)
diff --git a/v7/recyclerview/src/android/support/v7/widget/SnapHelper.java b/v7/recyclerview/src/android/support/v7/widget/SnapHelper.java
index 27047a2..915556e 100644
--- a/v7/recyclerview/src/android/support/v7/widget/SnapHelper.java
+++ b/v7/recyclerview/src/android/support/v7/widget/SnapHelper.java
@@ -42,13 +42,22 @@
     // Handles the snap on scroll case.
     private final RecyclerView.OnScrollListener mScrollListener =
             new RecyclerView.OnScrollListener() {
+                boolean mScrolled = false;
+
                 @Override
                 public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
                     super.onScrollStateChanged(recyclerView, newState);
-                    if (newState == RecyclerView.SCROLL_STATE_IDLE) {
+                    if (newState == RecyclerView.SCROLL_STATE_IDLE && mScrolled) {
+                        mScrolled = false;
                         snapToTargetExistingView();
                     }
                 }
+
+                public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+                    if (dx != 0 || dy != 0) {
+                        mScrolled = true;
+                    }
+                }
             };
 
     @Override