diff options
| author | 2017-06-22 22:22:47 +0000 | |
|---|---|---|
| committer | 2017-06-22 22:23:02 +0000 | |
| commit | 6de0d0983078ab933fcea43e750d6d22f05bf426 (patch) | |
| tree | e964bb47ba551266a7bf8259793f9f11f47c7fdb | |
| parent | 0e7dd105d80a5186a884b906d674150efe3139ac (diff) | |
| parent | 7c8bc0f931d01fe4ec1e101dd398c918295173d3 (diff) | |
Merge "1. Replace use of java.util.HashMap with android.util.ArrayMap in SwipeHelper class 2. Make few instance variables final"
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/SwipeHelper.java | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java index 699fdef3180a..6777ea2ef877 100644 --- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java +++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java @@ -25,6 +25,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.RectF; import android.os.Handler; +import android.util.ArrayMap; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -37,8 +38,6 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.FlingAnimationUtils; -import java.util.HashMap; - public class SwipeHelper implements Gefingerpoken { static final String TAG = "com.android.systemui.SwipeHelper"; private static final boolean DEBUG = false; @@ -51,10 +50,10 @@ public class SwipeHelper implements Gefingerpoken { public static final int X = 0; public static final int Y = 1; - private float SWIPE_ESCAPE_VELOCITY = 500f; // dp/sec - private int DEFAULT_ESCAPE_ANIMATION_DURATION = 200; // ms - private int MAX_ESCAPE_ANIMATION_DURATION = 400; // ms - private int MAX_DISMISS_VELOCITY = 4000; // dp/sec + private static final float SWIPE_ESCAPE_VELOCITY = 500f; // dp/sec + private static final int DEFAULT_ESCAPE_ANIMATION_DURATION = 200; // ms + private static final int MAX_ESCAPE_ANIMATION_DURATION = 400; // ms + private static final int MAX_DISMISS_VELOCITY = 4000; // dp/sec private static final int SNAP_ANIM_LEN = SLOW_ANIMATIONS ? 1000 : 150; // ms static final float SWIPE_PROGRESS_FADE_END = 0.5f; // fraction of thumbnail width @@ -65,13 +64,13 @@ public class SwipeHelper implements Gefingerpoken { private float mMinSwipeProgress = 0f; private float mMaxSwipeProgress = 1f; - private FlingAnimationUtils mFlingAnimationUtils; + private final FlingAnimationUtils mFlingAnimationUtils; private float mPagingTouchSlop; - private Callback mCallback; - private Handler mHandler; - private int mSwipeDirection; - private VelocityTracker mVelocityTracker; - private FalsingManager mFalsingManager; + private final Callback mCallback; + private final Handler mHandler; + private final int mSwipeDirection; + private final VelocityTracker mVelocityTracker; + private final FalsingManager mFalsingManager; private float mInitialTouchPos; private float mPerpendicularInitialTouchPos; @@ -86,16 +85,16 @@ public class SwipeHelper implements Gefingerpoken { private boolean mLongPressSent; private LongPressListener mLongPressListener; private Runnable mWatchLongPress; - private long mLongPressTimeout; + private final long mLongPressTimeout; final private int[] mTmpPos = new int[2]; - private int mFalsingThreshold; + private final int mFalsingThreshold; private boolean mTouchAboveFalsingThreshold; private boolean mDisableHwLayers; - private boolean mFadeDependingOnAmountSwiped; - private Context mContext; + private final boolean mFadeDependingOnAmountSwiped; + private final Context mContext; - private HashMap<View, Animator> mDismissPendingMap = new HashMap<>(); + private final ArrayMap<View, Animator> mDismissPendingMap = new ArrayMap<>(); public SwipeHelper(int swipeDirection, Callback callback, Context context) { mContext = context; |