Backed out changeset 33e39362305b (bug 1258450)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Wed, 30 Mar 2016 14:02:22 +0200
changeset 290877 1994ad414e8e8f669d4d9c364fd66b759882df59
parent 290876 624f831dddda364aa846d4f717c55ad908faada4
child 290878 5a2629dce8a7f9b50c34efeb80d23a1e075774d7
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1258450
milestone48.0a1
backs out33e39362305beb355699cbd88cefe4a37354136c
Backed out changeset 33e39362305b (bug 1258450)
mobile/android/base/java/org/mozilla/gecko/widget/SwipeDismissListViewTouchListener.java
mobile/android/base/resources/values/ids.xml
--- a/mobile/android/base/java/org/mozilla/gecko/widget/SwipeDismissListViewTouchListener.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/SwipeDismissListViewTouchListener.java
@@ -11,29 +11,33 @@
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 
 package org.mozilla.gecko.widget;
 
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
 import android.graphics.Rect;
 import android.view.MotionEvent;
 import android.view.VelocityTracker;
 import android.view.View;
 import android.view.ViewConfiguration;
 import android.view.ViewGroup;
 import android.widget.AbsListView;
 import android.widget.AbsListView.RecyclerListener;
 import android.widget.ListView;
 
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ValueAnimator;
+import android.view.ViewPropertyAnimator;
+
+import org.mozilla.gecko.R;
+
 /**
  * This code is based off of Jake Wharton's NOA port (https://github.com/JakeWharton/SwipeToDismissNOA)
  * of Roman Nurik's SwipeToDismiss library. It has been modified for better support with async
  * adapters.
  *
  * A {@link android.view.View.OnTouchListener} that makes the list items in a {@link ListView}
  * dismissable. {@link ListView} is given special treatment because by default it handles touches
  * for its list items... i.e. it's in charge of drawing the pressed state (the list selector),
@@ -65,18 +69,16 @@ import android.widget.ListView;
  * </pre>
  *
  * <p>For a generalized {@link android.view.View.OnTouchListener} that makes any view dismissable,
  * see {@link SwipeDismissTouchListener}.</p>
  *
  * @see SwipeDismissTouchListener
  */
 public class SwipeDismissListViewTouchListener implements View.OnTouchListener {
-    private static final int TAG_ORIGINAL_HEIGHT = SwipeDismissListViewTouchListener.class.hashCode();
-
     // Cached ViewConfiguration and system-wide constant values
     private final int mSlop;
     private final int mMinFlingVelocity;
     private final int mMaxFlingVelocity;
     private final long mAnimationTime;
 
     // Fixed properties
     private final ListView mListView;
@@ -160,27 +162,27 @@ public class SwipeDismissListViewTouchLi
     /**
      * Returns a {@link android.widget.AbsListView.RecyclerListener} to be added to the
      * {@link ListView} using {@link ListView#setRecyclerListener(RecyclerListener)}.
      */
     public AbsListView.RecyclerListener makeRecyclerListener() {
         return new AbsListView.RecyclerListener() {
             @Override
             public void onMovedToScrapHeap(View view) {
-                final Object tag = view.getTag(TAG_ORIGINAL_HEIGHT);
+                final Object tag = view.getTag(R.id.original_height);
 
                 // To reset the view to the correct height after its animation, the view's height
                 // is stored in its tag. Reset the view here.
                 if (tag instanceof Integer) {
                     view.setAlpha(1f);
                     view.setTranslationX(0);
                     final ViewGroup.LayoutParams lp = view.getLayoutParams();
                     lp.height = (int) tag;
                     view.setLayoutParams(lp);
-                    view.setTag(TAG_ORIGINAL_HEIGHT, null);
+                    view.setTag(R.id.original_height, null);
                 }
             }
         };
     }
 
     @Override
     public boolean onTouch(View view, MotionEvent motionEvent) {
         if (mViewWidth < 2) {
@@ -329,17 +331,17 @@ public class SwipeDismissListViewTouchLi
         animator.addListener(new AnimatorListenerAdapter() {
             @Override
             public void onAnimationEnd(Animator animation) {
                 // Since the view is still a part of the ListView, we can't reset the animated
                 // properties yet; otherwise, the view would briefly reappear. Store the original
                 // height in the view's tag to flag it for the recycler. This is racy since the user
                 // could scroll the dismissed view off the screen, then back on the screen, before
                 // it's removed from the adapter, causing the dismissed view to briefly reappear.
-                dismissView.setTag(TAG_ORIGINAL_HEIGHT, originalHeight);
+                dismissView.setTag(R.id.original_height, originalHeight);
 
                 mCallback.onDismiss(mListView, dismissPosition);
                 mDismissing = false;
             }
         });
 
         animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
             @Override
--- a/mobile/android/base/resources/values/ids.xml
+++ b/mobile/android/base/resources/values/ids.xml
@@ -3,16 +3,17 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <resources>
 
     <item type="id" name="tabQueueNotification"/>
     <item type="id" name="tabQueueSettingsNotification" />
     <item type="id" name="guestNotification"/>
+    <item type="id" name="original_height"/>
     <item type="id" name="menu_items"/>
     <item type="id" name="menu_margin"/>
     <item type="id" name="recycler_view_click_support" />
     <item type="id" name="range_list"/>
     <item type="id" name="pref_header_general"/>
     <item type="id" name="pref_header_privacy"/>
     <item type="id" name="pref_header_search"/>
     <item type="id" name="updateServicePermissionNotification" />