Reconcile with ics-mr1-release
Change-Id: I6b3173e0900eedd8c37be072173650ff89f41e45
diff --git a/res/values-vi/strings.xml b/res/values-vi/strings.xml
index 164f1e1..5ad3af9 100644
--- a/res/values-vi/strings.xml
+++ b/res/values-vi/strings.xml
@@ -32,7 +32,7 @@
<string name="external_drop_widget_error" msgid="127440783198670829">"Không thể thả mục vào Màn hình chính này."</string>
<string name="external_drop_widget_pick_title" msgid="7040647073452295370">"Chọn tiện ích con để tạo"</string>
<string name="rename_folder_label" msgid="5646236631298452787">"Tên thư mục"</string>
- <string name="rename_folder_title" msgid="4544573104191526550">"Đổi tên thư mục"</string>
+ <string name="rename_folder_title" msgid="4544573104191526550">"Đổi tên thư mục"</string>
<string name="rename_action" msgid="6016003384693240896">"OK"</string>
<string name="cancel_action" msgid="3811860427489435048">"Hủy"</string>
<string name="menu_item_add_item" msgid="6233177331075781114">"Thêm vào Màn hình chính"</string>
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index a6757d7..fdde4d5 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -156,6 +156,7 @@
super.onFinishInflate();
mContent = (CellLayout) findViewById(R.id.folder_content);
mContent.setGridSize(0, 0);
+ mContent.getChildrenLayout().setMotionEventSplittingEnabled(false);
mFolderName = (FolderEditText) findViewById(R.id.folder_name);
mFolderName.setFolder(this);
mFolderName.setOnFocusChangeListener(this);
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 2f66537..ba303a1 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -61,8 +61,6 @@
// the min drag distance for a fling to register, to prevent random page shifts
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 = 550;
protected static final float NANOTIME_DIV = 1000000000.0f;
@@ -72,6 +70,8 @@
private static final int MINIMUM_SNAP_VELOCITY = 2200;
private static final int MIN_FLING_VELOCITY = 250;
private static final float RETURN_TO_ORIGINAL_PAGE_THRESHOLD = 0.33f;
+ // The page is moved more than halfway, automatically move to the next page on touch up.
+ private static final float SIGNIFICANT_MOVE_THRESHOLD = 0.4f;
// the velocity at which a fling gesture will cause us to snap to the next page
protected int mSnapVelocity = 500;
@@ -1205,24 +1205,25 @@
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int velocityX = (int) velocityTracker.getXVelocity(activePointerId);
final int deltaX = (int) (x - mDownMotionX);
- boolean isSignificantMove = Math.abs(deltaX) > MIN_LENGTH_FOR_MOVE;
+ final int pageWidth = getScaledMeasuredWidth(getPageAt(mCurrentPage));
+ boolean isSignificantMove = Math.abs(deltaX) > pageWidth *
+ SIGNIFICANT_MOVE_THRESHOLD;
final int snapVelocity = mSnapVelocity;
mTotalMotionX += Math.abs(mLastMotionX + mLastMotionXRemainder - x);
+ boolean isFling = mTotalMotionX > MIN_LENGTH_FOR_FLING &&
+ Math.abs(velocityX) > snapVelocity;
+
// In the case that the page is moved far to one direction and then is flung
// in the opposite direction, we use a threshold to determine whether we should
// just return to the starting page, or if we should skip one further.
boolean returnToOriginalPage = false;
- final int pageWidth = getScaledMeasuredWidth(getPageAt(mCurrentPage));
if (Math.abs(deltaX) > pageWidth * RETURN_TO_ORIGINAL_PAGE_THRESHOLD &&
- Math.signum(velocityX) != Math.signum(deltaX)) {
+ Math.signum(velocityX) != Math.signum(deltaX) && isFling) {
returnToOriginalPage = true;
}
- boolean isFling = mTotalMotionX > MIN_LENGTH_FOR_FLING &&
- Math.abs(velocityX) > snapVelocity;
-
int finalPage;
// We give flings precedence over large moves, which is why we short-circuit our
// test for a large move if a fling has been registered. That is, a large
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 79e9942..ea7c0be 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -57,6 +57,7 @@
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.ImageView;
@@ -1280,21 +1281,34 @@
return (mBackground != null && mBackgroundAlpha > 0.0f && mDrawBackground);
}
- @Override
- protected void dispatchDraw(Canvas canvas) {
+ public void scrollTo (int x, int y) {
+ super.scrollTo(x, y);
+ syncChildrenLayersEnabledOnVisiblePages();
+ }
+
+ // This method just applies the value mChildrenLayersEnabled to all the pages that
+ // will be rendered on the next frame.
+ // We do this because calling setChildrenLayersEnabled on a view that's not
+ // visible/rendered causes slowdowns on some graphics cards
+ private void syncChildrenLayersEnabledOnVisiblePages() {
if (mChildrenLayersEnabled) {
getVisiblePages(mTempVisiblePagesRange);
final int leftScreen = mTempVisiblePagesRange[0];
final int rightScreen = mTempVisiblePagesRange[1];
if (leftScreen != -1 && rightScreen != -1) {
- // calling setChildrenLayersEnabled on a view that's not visible/rendered
- // causes slowdowns on some graphics cards, so we set it here to be sure
- // it's only called when it's safe (ie when the view will be rendered)
for (int i = leftScreen; i <= rightScreen; i++) {
- ((ViewGroup)getPageAt(i)).setChildrenLayersEnabled(true);
+ ViewGroup page = (ViewGroup) getPageAt(i);
+ if (page.getVisibility() == VISIBLE &&
+ page.getAlpha() > ViewConfiguration.ALPHA_THRESHOLD) {
+ ((ViewGroup)getPageAt(i)).setChildrenLayersEnabled(true);
+ }
}
}
}
+ }
+
+ @Override
+ protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (mInScrollArea && !LauncherApplication.isScreenLarge()) {
@@ -1723,6 +1737,7 @@
b * mNewBackgroundAlphaMultipliers[i]);
cl.setFastAlpha(a * mOldAlphas[i] + b * mNewAlphas[i]);
}
+ syncChildrenLayersEnabledOnVisiblePages();
}
});
@@ -1760,6 +1775,7 @@
// Fade the background gradient away
animateBackgroundGradient(0f, true);
}
+ syncChildrenLayersEnabledOnVisiblePages();
}
/**
@@ -2347,6 +2363,7 @@
mDragTargetLayout.onDragExit();
}
mLastDragOverView = null;
+ mSpringLoadedDragController.cancel();
if (!mIsPageMoving) {
hideOutlines();