Merge branch 'master' into honeycomb-release

This commit is contained in:
The Android Automerger
2010-10-27 07:15:57 -07:00
3 changed files with 17 additions and 6 deletions
+3 -1
View File
@@ -847,7 +847,9 @@ public class CellLayout extends ViewGroup implements Dimmable {
final View view = getChildAt(i);
view.setDrawingCacheEnabled(enabled);
// Update the drawing caches
view.buildDrawingCache(true);
if (!view.isHardwareAccelerated()) {
view.buildDrawingCache(true);
}
}
}
+11 -4
View File
@@ -53,7 +53,9 @@ public abstract class PagedView extends ViewGroup {
protected static final int INVALID_PAGE = -1;
// the min drag distance for a fling to register, to prevent random page shifts
private static final int MIN_LENGTH_FOR_FLING = 50;
private static final int MIN_LENGTH_FOR_FLING = 25;
// The min drag distance to trigger a page shift (regardless of velocity)
private static final int MIN_LENGTH_FOR_MOVE = 200;
private static final int PAGE_SNAP_ANIMATION_DURATION = 1000;
protected static final float NANOTIME_DIV = 1000000000.0f;
@@ -836,12 +838,17 @@ public abstract class PagedView extends ViewGroup {
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int velocityX = (int) velocityTracker.getXVelocity(activePointerId);
boolean isfling = Math.abs(mDownMotionX - x) > MIN_LENGTH_FOR_FLING;
final int deltaX = (int) (x - mDownMotionX);
boolean isfling = Math.abs(deltaX) > MIN_LENGTH_FOR_FLING;
boolean isSignificantMove = Math.abs(deltaX) > MIN_LENGTH_FOR_MOVE;
final int snapVelocity = mSnapVelocity;
if (isfling && velocityX > snapVelocity && mCurrentPage > 0) {
if ((isSignificantMove && deltaX > 0 ||
(isfling && velocityX > snapVelocity)) &&
mCurrentPage > 0) {
snapToPageWithVelocity(mCurrentPage - 1, velocityX);
} else if (isfling && velocityX < -snapVelocity &&
} else if ((isSignificantMove && deltaX < 0 ||
(isfling && velocityX < -snapVelocity)) &&
mCurrentPage < getChildCount() - 1) {
snapToPageWithVelocity(mCurrentPage + 1, velocityX);
} else {
@@ -250,7 +250,9 @@ public class PagedViewCellLayout extends ViewGroup {
final View view = getChildAt(i);
view.setDrawingCacheEnabled(enabled);
// Update the drawing caches
view.buildDrawingCache(true);
if (!view.isHardwareAccelerated()) {
view.buildDrawingCache(true);
}
}
}