am 010272d7: am 68ba5ca5: Keep banging on the launcher locks up bug. This moves the delayed zoom stuff into one place, so it should be out of sync less.
Merge commit '010272d7e8e09f76044ba5d23d349594654b05d3' into eclair-mr2-plus-aosp * commit '010272d7e8e09f76044ba5d23d349594654b05d3': Keep banging on the launcher locks up bug. This moves the
This commit is contained in:
commit
af80bdfa99
2 files changed
+33
-44
No files matched your search
@@ -104,7 +104,7 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
*/
|
*/
|
||||||
private int mLastSelectedIcon;
|
private int mLastSelectedIcon;
|
||||||
|
|
||||||
private VelocityTracker mVelocity;
|
private VelocityTracker mVelocityTracker;
|
||||||
private int mTouchTracking;
|
private int mTouchTracking;
|
||||||
private int mMotionDownRawX;
|
private int mMotionDownRawX;
|
||||||
private int mMotionDownRawY;
|
private int mMotionDownRawY;
|
||||||
@@ -114,9 +114,11 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
private boolean mShouldGainFocus;
|
private boolean mShouldGainFocus;
|
||||||
|
|
||||||
private boolean mZoomDirty = false;
|
private boolean mZoomDirty = false;
|
||||||
private float mNextZoom;
|
private boolean mAnimateNextZoom;
|
||||||
private boolean mNextAnimate;
|
private float mZoom;
|
||||||
AAMessage mMessageProc;
|
private float mPosX;
|
||||||
|
private float mVelocity;
|
||||||
|
private AAMessage mMessageProc;
|
||||||
|
|
||||||
static class Defines {
|
static class Defines {
|
||||||
public static final int ALLOC_PARAMS = 0;
|
public static final int ALLOC_PARAMS = 0;
|
||||||
@@ -231,7 +233,7 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
if (mRollo.mState.iconCount > 0) {
|
if (mRollo.mState.iconCount > 0) {
|
||||||
if (mLastSelection == SELECTION_ICONS) {
|
if (mLastSelection == SELECTION_ICONS) {
|
||||||
int selection = mLastSelectedIcon;
|
int selection = mLastSelectedIcon;
|
||||||
final int firstIcon = Math.round(mMessageProc.mPosX) *
|
final int firstIcon = Math.round(mPosX) *
|
||||||
Defines.COLUMNS_PER_PAGE;
|
Defines.COLUMNS_PER_PAGE;
|
||||||
if (selection < 0 || // No selection
|
if (selection < 0 || // No selection
|
||||||
selection < firstIcon || // off the top of the screen
|
selection < firstIcon || // off the top of the screen
|
||||||
@@ -286,7 +288,7 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
|
if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
|
||||||
// Select the first icon when we gain keyboard focus
|
// Select the first icon when we gain keyboard focus
|
||||||
mArrowNavigation = true;
|
mArrowNavigation = true;
|
||||||
mRollo.selectIcon(Math.round(mMessageProc.mPosX) * Defines.COLUMNS_PER_PAGE,
|
mRollo.selectIcon(Math.round(mPosX) * Defines.COLUMNS_PER_PAGE,
|
||||||
SELECTED_FOCUSED);
|
SELECTED_FOCUSED);
|
||||||
mRollo.mState.save();
|
mRollo.mState.save();
|
||||||
}
|
}
|
||||||
@@ -322,7 +324,7 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
mArrowNavigation = true;
|
mArrowNavigation = true;
|
||||||
|
|
||||||
int currentSelection = mRollo.mState.selectedIconIndex;
|
int currentSelection = mRollo.mState.selectedIconIndex;
|
||||||
int currentTopRow = Math.round(mMessageProc.mPosX);
|
int currentTopRow = Math.round(mPosX);
|
||||||
|
|
||||||
// The column of the current selection, in the range 0..COLUMNS_PER_PAGE-1
|
// The column of the current selection, in the range 0..COLUMNS_PER_PAGE-1
|
||||||
final int currentPageCol = currentSelection % Defines.COLUMNS_PER_PAGE;
|
final int currentPageCol = currentSelection % Defines.COLUMNS_PER_PAGE;
|
||||||
@@ -451,7 +453,7 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
mRollo.clearSelectedIcon();
|
mRollo.clearSelectedIcon();
|
||||||
} else {
|
} else {
|
||||||
mDownIconIndex = mCurrentIconIndex
|
mDownIconIndex = mCurrentIconIndex
|
||||||
= mRollo.selectIcon(x, y, mMessageProc.mPosX, SELECTED_PRESSED);
|
= mRollo.selectIcon(x, y, mPosX, SELECTED_PRESSED);
|
||||||
if (mDownIconIndex < 0) {
|
if (mDownIconIndex < 0) {
|
||||||
// if nothing was selected, no long press.
|
// if nothing was selected, no long press.
|
||||||
cancelLongPress();
|
cancelLongPress();
|
||||||
@@ -459,8 +461,8 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
}
|
}
|
||||||
mRollo.mState.save();
|
mRollo.mState.save();
|
||||||
mRollo.move();
|
mRollo.move();
|
||||||
mVelocity = VelocityTracker.obtain();
|
mVelocityTracker = VelocityTracker.obtain();
|
||||||
mVelocity.addMovement(ev);
|
mVelocityTracker.addMovement(ev);
|
||||||
mStartedScrolling = false;
|
mStartedScrolling = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -479,7 +481,7 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
if (!mStartedScrolling && slop < mSlop) {
|
if (!mStartedScrolling && slop < mSlop) {
|
||||||
// don't update anything so when we do start scrolling
|
// don't update anything so when we do start scrolling
|
||||||
// below, we get the right delta.
|
// below, we get the right delta.
|
||||||
mCurrentIconIndex = mRollo.chooseTappedIcon(x, y, mMessageProc.mPosX);
|
mCurrentIconIndex = mRollo.chooseTappedIcon(x, y, mPosX);
|
||||||
if (mDownIconIndex != mCurrentIconIndex) {
|
if (mDownIconIndex != mCurrentIconIndex) {
|
||||||
// If a different icon is selected, don't allow it to be picked up.
|
// If a different icon is selected, don't allow it to be picked up.
|
||||||
// This handles off-axis dragging.
|
// This handles off-axis dragging.
|
||||||
@@ -497,7 +499,7 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
|
|
||||||
mStartedScrolling = true;
|
mStartedScrolling = true;
|
||||||
mRollo.clearSelectedIcon();
|
mRollo.clearSelectedIcon();
|
||||||
mVelocity.addMovement(ev);
|
mVelocityTracker.addMovement(ev);
|
||||||
mRollo.mState.save();
|
mRollo.mState.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -518,15 +520,15 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
mRollo.mState.newTouchDown = 0;
|
mRollo.mState.newTouchDown = 0;
|
||||||
mRollo.mState.newPositionX = ev.getRawY() / getHeight();
|
mRollo.mState.newPositionX = ev.getRawY() / getHeight();
|
||||||
|
|
||||||
mVelocity.computeCurrentVelocity(1000 /* px/sec */, mMaxFlingVelocity);
|
mVelocityTracker.computeCurrentVelocity(1000 /* px/sec */, mMaxFlingVelocity);
|
||||||
mRollo.mState.flingVelocity = mVelocity.getYVelocity() / getHeight();
|
mRollo.mState.flingVelocity = mVelocityTracker.getYVelocity() / getHeight();
|
||||||
mRollo.clearSelectedIcon();
|
mRollo.clearSelectedIcon();
|
||||||
mRollo.mState.save();
|
mRollo.mState.save();
|
||||||
mRollo.fling();
|
mRollo.fling();
|
||||||
|
|
||||||
if (mVelocity != null) {
|
if (mVelocityTracker != null) {
|
||||||
mVelocity.recycle();
|
mVelocityTracker.recycle();
|
||||||
mVelocity = null;
|
mVelocityTracker = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mTouchTracking = TRACKING_NONE;
|
mTouchTracking = TRACKING_NONE;
|
||||||
@@ -625,8 +627,8 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
cancelLongPress();
|
cancelLongPress();
|
||||||
if (mRollo == null || !mRollo.mHasSurface) {
|
if (mRollo == null || !mRollo.mHasSurface) {
|
||||||
mZoomDirty = true;
|
mZoomDirty = true;
|
||||||
mNextZoom = zoom;
|
mZoom = zoom;
|
||||||
mNextAnimate = animate;
|
mAnimateNextZoom = animate;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
mRollo.setZoom(zoom, animate);
|
mRollo.setZoom(zoom, animate);
|
||||||
@@ -634,27 +636,13 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisible() {
|
public boolean isVisible() {
|
||||||
if (mZoomDirty) {
|
Log.d(TAG, "isVisible mZoomDirty=" + mZoomDirty
|
||||||
return mNextZoom > 0.001f;
|
+ " mMessageProc=" + (mMessageProc == null ? "null" : mZoom));
|
||||||
} else {
|
return mZoom > 0.001f;
|
||||||
if (mMessageProc == null) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return mMessageProc.mZoom > 0.001f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOpaque() {
|
public boolean isOpaque() {
|
||||||
if (mZoomDirty) {
|
return mZoom > 0.999f;
|
||||||
return mNextZoom > 0.999f;
|
|
||||||
} else {
|
|
||||||
if (mMessageProc == null) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return mMessageProc.mZoom > 0.999f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApps(ArrayList<ApplicationInfo> list) {
|
public void setApps(ArrayList<ApplicationInfo> list) {
|
||||||
@@ -765,9 +753,6 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
mZoom = ((float)mData[2]) / (1 << 16);
|
mZoom = ((float)mData[2]) / (1 << 16);
|
||||||
mZoomDirty = false;
|
mZoomDirty = false;
|
||||||
}
|
}
|
||||||
float mZoom;
|
|
||||||
float mPosX;
|
|
||||||
float mVelocity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RolloRS {
|
public class RolloRS {
|
||||||
@@ -829,8 +814,8 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkClickOK() {
|
private boolean checkClickOK() {
|
||||||
return (Math.abs(mMessageProc.mVelocity) < 0.4f) &&
|
return (Math.abs(mVelocity) < 0.4f) &&
|
||||||
(Math.abs(mMessageProc.mPosX - Math.round(mMessageProc.mPosX)) < 0.4f);
|
(Math.abs(mPosX - Math.round(mPosX)) < 0.4f);
|
||||||
}
|
}
|
||||||
|
|
||||||
class Params extends BaseAlloc {
|
class Params extends BaseAlloc {
|
||||||
@@ -1067,7 +1052,7 @@ public class AllAppsView extends RSSurfaceView
|
|||||||
mAppsDirty = false;
|
mAppsDirty = false;
|
||||||
}
|
}
|
||||||
if (mZoomDirty) {
|
if (mZoomDirty) {
|
||||||
setZoom(mNextZoom, mNextAnimate);
|
setZoom(mZoom, mAnimateNextZoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import android.graphics.drawable.Drawable;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.VelocityTracker;
|
import android.view.VelocityTracker;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -688,7 +689,10 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
if (mLauncher.isWorkspaceLocked() || mLauncher.isAllAppsVisible()) {
|
final boolean workspaceLocked = mLauncher.isWorkspaceLocked();
|
||||||
|
final boolean allAppsVisible = mLauncher.isAllAppsVisible();
|
||||||
|
Log.d(TAG, "workspaceLocked=" + workspaceLocked + " allAppsVisible=" + allAppsVisible);
|
||||||
|
if (workspaceLocked || allAppsVisible) {
|
||||||
return false; // We don't want the events. Let them fall through to the all apps view.
|
return false; // We don't want the events. Let them fall through to the all apps view.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user