merge in honeycomb-mr2-release history after reset to honeycomb-mr2
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 1d48407..5c5542a 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -3102,6 +3102,7 @@
private Drawable.ConstantState updateTextButtonWithIconFromExternalActivity(
int buttonId, ComponentName activityName, int fallbackDrawableId) {
TextView button = (TextView) findViewById(buttonId);
+ if (button == null) return null;
Drawable toolbarIcon = getExternalPackageToolbarIcon(activityName);
// If we were unable to find the icon via the meta-data, use a generic one
@@ -3118,6 +3119,7 @@
private Drawable.ConstantState updateButtonWithIconFromExternalActivity(
int buttonId, ComponentName activityName, int fallbackDrawableId) {
ImageView button = (ImageView) findViewById(buttonId);
+ if (button == null) return null;
Drawable toolbarIcon = getExternalPackageToolbarIcon(activityName);
// If we were unable to find the icon via the meta-data, use a generic one
@@ -3132,11 +3134,13 @@
private void updateTextButtonWithDrawable(int buttonId, Drawable.ConstantState d) {
TextView button = (TextView) findViewById(buttonId);
+ if (button == null) return;
button.setCompoundDrawables(d.newDrawable(getResources()), null, null, null);
}
private void updateButtonWithDrawable(int buttonId, Drawable.ConstantState d) {
ImageView button = (ImageView) findViewById(buttonId);
+ if (button == null) return;
button.setImageDrawable(d.newDrawable(getResources()));
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 01b3d8e..13e86b9 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -1270,7 +1270,7 @@
// snap duration. This is a function of the actual distance that needs to be traveled;
// we keep this value close to half screen size in order to reduce the variance in snap
// duration as a function of the distance the page needs to travel.
- float distanceRatio = 1.0f * Math.abs(delta) / 2 * halfScreenSize;
+ float distanceRatio = Math.min(1f, 1.0f * Math.abs(delta) / (2 * halfScreenSize));
float distance = halfScreenSize + halfScreenSize *
distanceInfluenceForSnapDuration(distanceRatio);
@@ -1279,8 +1279,8 @@
// we want the page's snap velocity to approximately match the velocity at which the
// user flings, so we scale the duration by a value near to the derivative of the scroll
- // interpolator at zero, ie. 5. We use 6 to make it a little slower.
- duration = 6 * Math.round(1000 * Math.abs(distance / velocity));
+ // interpolator at zero, ie. 5. We use 4 to make it a little slower.
+ duration = 4 * Math.round(1000 * Math.abs(distance / velocity));
snapToPage(whichPage, delta, duration);
}