am 2d454315: am 0db9d46c: Merge "Lowering the threshold for flinging on larger devices. (Bug 6575670)" into jb-dev
* commit '2d45431516a65d7c74a84d86d585d1dab0883aed': Lowering the threshold for flinging on larger devices. (Bug 6575670)
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
<integer name="hotseat_cell_count">7</integer>
|
||||
<integer name="hotseat_all_apps_index">3</integer>
|
||||
|
||||
<!-- DragController -->
|
||||
<integer name="config_flingToDeleteMinVelocity">-1000</integer>
|
||||
|
||||
<!-- Folders -->
|
||||
<!-- Folder max bounds and max number of items. Note: folder_max_count_x * folder_max_count_y
|
||||
>= folder_max_num_items. When these are set to -1, they are automatically determined. -->
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
<bool name="is_large_screen">false</bool>
|
||||
<bool name="allow_rotation">false</bool>
|
||||
|
||||
<!-- DragController -->
|
||||
<integer name="config_flingToDeleteMinVelocity">-1500</integer>
|
||||
|
||||
<!-- AllApps/Customize/AppsCustomize -->
|
||||
<!-- The alpha of the AppsCustomize bg in spring loaded mode -->
|
||||
<integer name="config_appsCustomizeSpringLoadedBgAlpha">45</integer>
|
||||
|
||||
@@ -39,7 +39,8 @@ import com.android.launcher.R;
|
||||
|
||||
public class DeleteDropTarget extends ButtonDropTarget {
|
||||
private static int DELETE_ANIMATION_DURATION = 285;
|
||||
private static int FLIND_DELETE_ANIMATION_DURATION = 350;
|
||||
private static int FLING_DELETE_ANIMATION_DURATION = 350;
|
||||
private static float FLING_TO_DELETE_FRICTION = 0.035f;
|
||||
private static int MODE_FLING_DELETE_TO_TRASH = 0;
|
||||
private static int MODE_FLING_DELETE_ALONG_VECTOR = 1;
|
||||
|
||||
@@ -311,22 +312,22 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
* progressively.
|
||||
*/
|
||||
private static class FlingAlongVectorAnimatorUpdateListener implements AnimatorUpdateListener {
|
||||
private static float FRICTION = 0.93f;
|
||||
|
||||
private DragLayer mDragLayer;
|
||||
private PointF mVelocity;
|
||||
private Rect mFrom;
|
||||
private long mPrevTime;
|
||||
private boolean mHasOffsetForScale;
|
||||
private float mFriction;
|
||||
|
||||
private final TimeInterpolator mAlphaInterpolator = new DecelerateInterpolator(0.75f);
|
||||
|
||||
public FlingAlongVectorAnimatorUpdateListener(DragLayer dragLayer, PointF vel, Rect from,
|
||||
long startTime) {
|
||||
long startTime, float friction) {
|
||||
mDragLayer = dragLayer;
|
||||
mVelocity = vel;
|
||||
mFrom = from;
|
||||
mPrevTime = startTime;
|
||||
mFriction = 1f - (dragLayer.getResources().getDisplayMetrics().density * friction);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -352,8 +353,8 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
dragView.setTranslationY(mFrom.top);
|
||||
dragView.setAlpha(1f - mAlphaInterpolator.getInterpolation(t));
|
||||
|
||||
mVelocity.x *= FRICTION;
|
||||
mVelocity.y *= FRICTION;
|
||||
mVelocity.x *= mFriction;
|
||||
mVelocity.y *= mFriction;
|
||||
mPrevTime = curTime;
|
||||
}
|
||||
};
|
||||
@@ -363,7 +364,8 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
final Rect from = new Rect();
|
||||
dragLayer.getViewRectRelativeToSelf(d.dragView, from);
|
||||
|
||||
return new FlingAlongVectorAnimatorUpdateListener(dragLayer, vel, from, startTime);
|
||||
return new FlingAlongVectorAnimatorUpdateListener(dragLayer, vel, from, startTime,
|
||||
FLING_TO_DELETE_FRICTION);
|
||||
}
|
||||
|
||||
public void onFlingToDelete(final DragObject d, int x, int y, PointF vel) {
|
||||
@@ -385,7 +387,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
|
||||
|
||||
final ViewConfiguration config = ViewConfiguration.get(mLauncher);
|
||||
final DragLayer dragLayer = mLauncher.getDragLayer();
|
||||
final int duration = FLIND_DELETE_ANIMATION_DURATION;
|
||||
final int duration = FLING_DELETE_ANIMATION_DURATION;
|
||||
final long startTime = AnimationUtils.currentAnimationTimeMillis();
|
||||
|
||||
// NOTE: Because it takes time for the first frame of animation to actually be
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.launcher2;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.PointF;
|
||||
@@ -62,7 +63,6 @@ public class DragController {
|
||||
static final int SCROLL_RIGHT = 1;
|
||||
|
||||
private static final float MAX_FLING_DEGREES = 35f;
|
||||
private static final int FLING_TO_DELETE_THRESHOLD_Y_VELOCITY = -1500;
|
||||
|
||||
private Launcher mLauncher;
|
||||
private Handler mHandler;
|
||||
@@ -146,14 +146,16 @@ public class DragController {
|
||||
* @param context The application's context.
|
||||
*/
|
||||
public DragController(Launcher launcher) {
|
||||
Resources r = launcher.getResources();
|
||||
mLauncher = launcher;
|
||||
mHandler = new Handler();
|
||||
mScrollZone = launcher.getResources().getDimensionPixelSize(R.dimen.scroll_zone);
|
||||
mScrollZone = r.getDimensionPixelSize(R.dimen.scroll_zone);
|
||||
mVelocityTracker = VelocityTracker.obtain();
|
||||
mVibrator = (Vibrator)launcher.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
mVibrator = (Vibrator) launcher.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
|
||||
float density = launcher.getResources().getDisplayMetrics().density;
|
||||
mFlingToDeleteThresholdVelocity = (int) (FLING_TO_DELETE_THRESHOLD_Y_VELOCITY * density);
|
||||
float density = r.getDisplayMetrics().density;
|
||||
mFlingToDeleteThresholdVelocity =
|
||||
(int) (r.getInteger(R.integer.config_flingToDeleteMinVelocity) * density);
|
||||
}
|
||||
|
||||
public boolean dragging() {
|
||||
|
||||
Reference in New Issue
Block a user