merge in honeycomb-release history after reset to honeycomb
diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml
index 3e514fb..c6cd0e2 100644
--- a/res/values-xlarge/config.xml
+++ b/res/values-xlarge/config.xml
@@ -9,7 +9,7 @@
<!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
- <integer name="config_allAppsZoomInTime">800</integer>
+ <integer name="config_allAppsZoomInTime">900</integer>
<!-- Duration in milliseconds of the transition between tabs in the all apps/customize
tray -->
@@ -17,7 +17,7 @@
<!-- Duration in milliseconds of the all apps zoom-out animation -->
<!-- NB: This should be less than the workspaceUnshrinkTime as they happen together. -->
- <integer name="config_allAppsZoomOutTime">600</integer>
+ <integer name="config_allAppsZoomOutTime">1400</integer>
<!-- Scaling factor used in the all apps zooming animations -->
<integer name="config_allAppsZoomScaleFactor">10</integer>
@@ -36,9 +36,9 @@
<!-- Duration in milliseconds of the animations between all apps, customize, & home.
NOTE: If these are changed, the toolbar animation times below should also be. -->
<integer name="config_allAppsCameraPanTime">700</integer>
- <integer name="config_allAppsFadeOutTime">150</integer>
+ <integer name="config_allAppsFadeOutTime">400</integer>
<integer name="config_customizeWorkspaceShrinkTime">800</integer>
- <integer name="config_allAppsWorkspaceShrinkTime">800</integer>
+ <integer name="config_allAppsWorkspaceShrinkTime">950</integer>
<integer name="config_workspaceUnshrinkTime">450</integer>
<!-- Duration in milliseconds toolbar fade in and fade out animations.
diff --git a/res/values/config.xml b/res/values/config.xml
index 473ed58..850c609 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -25,6 +25,12 @@
<!-- The alpha value at which to show the most recent drop visualization outline. -->
<integer name="config_dragOutlineMaxAlpha">128</integer>
+ <!-- Workspace screens are cached to bitmaps only when they're smaller than a certain size
+ (maxScaleForUsingWorkspaceScreenBitmapCache), since the bitmap cache it self is smaller
+ than the view itself (workspaceScreenBitmapCacheScale) -->
+ <integer name="config_workspaceScreenBitmapCacheScale">20</integer>
+ <integer name="config_maxScaleForUsingWorkspaceScreenBitmapCache">50</integer>
+
<!-- Parameters controlling the animation for when an item is dropped on the home screen,
and it animates from its old position to the new one. -->
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index de75fd3..448b766 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -267,6 +267,13 @@
addView(mChildren);
}
+ public CellLayoutChildren getChildrenLayout() {
+ if (getChildCount() > 0) {
+ return (CellLayoutChildren) getChildAt(0);
+ }
+ return null;
+ }
+
public void setIsDefaultDropTarget(boolean isDefaultDropTarget) {
if (mIsDefaultDropTarget != isDefaultDropTarget) {
mIsDefaultDropTarget = isDefaultDropTarget;
diff --git a/src/com/android/launcher2/InstallShortcutReceiver.java b/src/com/android/launcher2/InstallShortcutReceiver.java
index ac50f66..c67e90e 100644
--- a/src/com/android/launcher2/InstallShortcutReceiver.java
+++ b/src/com/android/launcher2/InstallShortcutReceiver.java
@@ -55,25 +55,27 @@
if (findEmptyCell(context, mCoordinates, screen)) {
Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
+ if (intent != null) {
+ if (intent.getAction() == null) {
+ intent.setAction(Intent.ACTION_VIEW);
+ }
- if (intent.getAction() == null) {
- intent.setAction(Intent.ACTION_VIEW);
+ // By default, we allow for duplicate entries (located in
+ // different places)
+ boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true);
+ if (duplicate || !LauncherModel.shortcutExists(context, name, intent)) {
+ LauncherApplication app = (LauncherApplication) context.getApplicationContext();
+ app.getModel().addShortcut(context, data, screen, mCoordinates[0],
+ mCoordinates[1], true);
+ Toast.makeText(context, context.getString(R.string.shortcut_installed, name),
+ Toast.LENGTH_SHORT).show();
+ } else {
+ Toast.makeText(context, context.getString(R.string.shortcut_duplicate, name),
+ Toast.LENGTH_SHORT).show();
+ }
+
+ return true;
}
-
- // By default, we allow for duplicate entries (located in
- // different places)
- boolean duplicate = data.getBooleanExtra(Launcher.EXTRA_SHORTCUT_DUPLICATE, true);
- if (duplicate || !LauncherModel.shortcutExists(context, name, intent)) {
- ((LauncherApplication)context.getApplicationContext()).getModel()
- .addShortcut(context, data, screen, mCoordinates[0], mCoordinates[1], true);
- Toast.makeText(context, context.getString(R.string.shortcut_installed, name),
- Toast.LENGTH_SHORT).show();
- } else {
- Toast.makeText(context, context.getString(R.string.shortcut_duplicate, name),
- Toast.LENGTH_SHORT).show();
- }
-
- return true;
} else {
Toast.makeText(context, context.getString(R.string.out_of_space),
Toast.LENGTH_SHORT).show();
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 8614865..a592f20 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -47,12 +47,12 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.Intent.ShortcutIconResource;
import android.content.IntentFilter;
+import android.content.Intent.ShortcutIconResource;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -88,9 +88,9 @@
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
-import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
+import android.view.View.OnLongClickListener;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
@@ -100,11 +100,11 @@
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TabHost;
-import android.widget.TabHost.OnTabChangeListener;
-import android.widget.TabHost.TabContentFactory;
import android.widget.TabWidget;
import android.widget.TextView;
import android.widget.Toast;
+import android.widget.TabHost.OnTabChangeListener;
+import android.widget.TabHost.TabContentFactory;
import com.android.common.Search;
import com.android.launcher.R;
@@ -2684,7 +2684,7 @@
toView.setAlpha(0f);
ObjectAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(toView,
PropertyValuesHolder.ofFloat("alpha", 1.0f));
- alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f));
+ alphaAnim.setInterpolator(new DecelerateInterpolator(1.0f));
alphaAnim.setDuration(duration);
alphaAnim.start();
}
@@ -2782,7 +2782,7 @@
ValueAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(fromView,
PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.0f));
alphaAnim.setDuration(res.getInteger(R.integer.config_allAppsFadeOutTime));
- alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f));
+ alphaAnim.setInterpolator(new DecelerateInterpolator(2.0f));
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -3331,7 +3331,8 @@
int count = workspace.getChildCount();
for (int i = 0; i < count; i++) {
// Use removeAllViewsInLayout() to avoid an extra requestLayout() and invalidate().
- ((ViewGroup) workspace.getChildAt(i)).removeAllViewsInLayout();
+ final ViewGroup layout = ((CellLayout) workspace.getChildAt(i)).getChildrenLayout();
+ layout.removeAllViewsInLayout();
}
if (DEBUG_USER_INTERFACE) {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 842f2f3..4ff9f40 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -60,6 +60,7 @@
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.widget.TextView;
import android.widget.Toast;
@@ -297,6 +298,7 @@
} else {
mDrawCustomizeTrayBackground = false;
}
+ mWallpaperOffset.setOverrideHorizontalCatchupConstant(false);
enableCacheUpdates();
mAnimator = null;
}
@@ -308,6 +310,7 @@
}
@Override
public void onAnimationEnd(Animator animation) {
+ mWallpaperOffset.setOverrideHorizontalCatchupConstant(false);
enableCacheUpdates();
mAnimator = null;
}
@@ -374,7 +377,7 @@
* @return The open folder on the current screen, or null if there is none
*/
Folder getOpenFolder() {
- CellLayout currentPage = (CellLayout) getChildAt(mCurrentPage);
+ ViewGroup currentPage = ((CellLayout) getChildAt(mCurrentPage)).getChildrenLayout();
int count = currentPage.getChildCount();
for (int i = 0; i < count; i++) {
View child = currentPage.getChildAt(i);
@@ -392,7 +395,7 @@
ArrayList<Folder> folders = new ArrayList<Folder>(screenCount);
for (int screen = 0; screen < screenCount; screen++) {
- CellLayout currentPage = (CellLayout) getChildAt(screen);
+ ViewGroup currentPage = ((CellLayout) getChildAt(screen)).getChildrenLayout();
int count = currentPage.getChildCount();
for (int i = 0; i < count; i++) {
View child = currentPage.getChildAt(i);
@@ -720,13 +723,30 @@
float mHorizontalWallpaperOffset = 0.0f;
float mVerticalWallpaperOffset = 0.5f;
long mLastWallpaperOffsetUpdateTime;
+ boolean mIsMovingFast;
+ boolean mOverrideHorizontalCatchupConstant;
+ float mHorizontalCatchupConstant = 0.35f;
+ float mVerticalCatchupConstant = 0.35f;
public WallpaperOffsetInterpolator() {
}
+ public void setOverrideHorizontalCatchupConstant(boolean override) {
+ mOverrideHorizontalCatchupConstant = override;
+ }
+
+ public void setHorizontalCatchupConstant(float f) {
+ mHorizontalCatchupConstant = f;
+ }
+
+ public void setVerticalCatchupConstant(float f) {
+ mVerticalCatchupConstant = f;
+ }
+
public boolean computeScrollOffset() {
if (Float.compare(mHorizontalWallpaperOffset, mFinalHorizontalWallpaperOffset) == 0 &&
Float.compare(mVerticalWallpaperOffset, mFinalVerticalWallpaperOffset) == 0) {
+ mIsMovingFast = false;
return false;
}
Display display = mLauncher.getWindowManager().getDefaultDisplay();
@@ -736,27 +756,44 @@
long timeSinceLastUpdate = currentTime - mLastWallpaperOffsetUpdateTime;
timeSinceLastUpdate = Math.min((long) (1000/30f), timeSinceLastUpdate);
timeSinceLastUpdate = Math.max(1L, timeSinceLastUpdate);
- // ie 75% in 100ms
- float fractionToCatchUpIn1MsHorizontal = isLandscape ? 0.75f / 100 : 0.75f / 100;
- float fractionToCatchUpIn1MsVertical = isLandscape ? 1.1f / 100 : 1.1f / 100;
+
+ float xdiff = Math.abs(mFinalHorizontalWallpaperOffset - mHorizontalWallpaperOffset);
+ if (!mIsMovingFast && xdiff > 0.07) {
+ mIsMovingFast = true;
+ }
+
+ float fractionToCatchUpIn1MsHorizontal;
+ if (mOverrideHorizontalCatchupConstant) {
+ fractionToCatchUpIn1MsHorizontal = mHorizontalCatchupConstant;
+ } else if (mIsMovingFast) {
+ fractionToCatchUpIn1MsHorizontal = isLandscape ? 0.5f : 0.75f;
+ } else {
+ // slow
+ fractionToCatchUpIn1MsHorizontal = isLandscape ? 0.27f : 0.5f;
+ }
+ float fractionToCatchUpIn1MsVertical = mVerticalCatchupConstant;
+
+
+ fractionToCatchUpIn1MsHorizontal /= 33f;
+ fractionToCatchUpIn1MsVertical /= 33f;
final float UPDATE_THRESHOLD = 0.00001f;
float hOffsetDelta = mFinalHorizontalWallpaperOffset - mHorizontalWallpaperOffset;
float vOffsetDelta = mFinalVerticalWallpaperOffset - mVerticalWallpaperOffset;
- boolean jumpToFinalValue =
- Math.abs(hOffsetDelta / mFinalHorizontalWallpaperOffset) < UPDATE_THRESHOLD &&
- Math.abs(vOffsetDelta / mFinalVerticalWallpaperOffset) < UPDATE_THRESHOLD;
+ boolean jumpToFinalValue = Math.abs(hOffsetDelta) < UPDATE_THRESHOLD &&
+ Math.abs(vOffsetDelta) < UPDATE_THRESHOLD;
if (jumpToFinalValue) {
mHorizontalWallpaperOffset = mFinalHorizontalWallpaperOffset;
mVerticalWallpaperOffset = mFinalVerticalWallpaperOffset;
} else {
float percentToCatchUpVertical =
- timeSinceLastUpdate * fractionToCatchUpIn1MsVertical;
+ Math.min(1.0f, timeSinceLastUpdate * fractionToCatchUpIn1MsVertical);
float percentToCatchUpHorizontal =
- timeSinceLastUpdate * fractionToCatchUpIn1MsHorizontal;
+ Math.min(1.0f, timeSinceLastUpdate * fractionToCatchUpIn1MsHorizontal);
mHorizontalWallpaperOffset += percentToCatchUpHorizontal * hOffsetDelta;
mVerticalWallpaperOffset += percentToCatchUpVertical * vOffsetDelta;
}
+
mLastWallpaperOffsetUpdateTime = System.currentTimeMillis();
return true;
}
@@ -1352,20 +1389,33 @@
int wallpaperTravelHeight = (int) (display.getHeight() *
wallpaperTravelToScreenHeightRatio(display.getWidth(), display.getHeight()));
float offsetFromCenter = (wallpaperTravelHeight / (float) mWallpaperHeight) / 2f;
+ boolean isLandscape = display.getWidth() > display.getHeight();
+
switch (shrinkState) {
+ // animating in
case TOP:
+ // customize
wallpaperOffset = 0.5f + offsetFromCenter;
+ mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.46f : 0.44f);
break;
case MIDDLE:
case SPRING_LOADED:
wallpaperOffset = 0.5f;
+ mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.34f : 0.32f);
break;
case BOTTOM_HIDDEN:
case BOTTOM_VISIBLE:
+ // allapps
wallpaperOffset = 0.5f - offsetFromCenter;
+ mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.34f : 0.32f);
break;
}
+ if (animated) {
+ mWallpaperOffset.setHorizontalCatchupConstant(0.46f);
+ mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
+ }
+
setLayoutScale(1.0f);
if (animated) {
mSyncWallpaperOffsetWithScroll = false;
@@ -1576,6 +1626,7 @@
final int screenCount = getChildCount();
final int duration = getResources().getInteger(R.integer.config_workspaceUnshrinkTime);
+
for (int i = 0; i < screenCount; i++) {
final CellLayout cl = (CellLayout)getChildAt(i);
float finalAlphaValue = (i == mCurrentPage) ? 1.0f : 0.0f;
@@ -1623,26 +1674,54 @@
mUnshrinkAnimationListener.onAnimationEnd(null);
}
}
+ Display display = mLauncher.getWindowManager().getDefaultDisplay();
+ boolean isLandscape = display.getWidth() > display.getHeight();
+ switch (mShrinkState) {
+ // animating out
+ case TOP:
+ // customize
+ if (animated) {
+ mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.65f : 0.62f);
+ mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.65f : 0.62f);
+ mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
+ }
+ break;
+ case MIDDLE:
+ case SPRING_LOADED:
+ if (animated) {
+ mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.49f : 0.46f);
+ mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.49f : 0.46f);
+ mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
+ }
+ break;
+ case BOTTOM_HIDDEN:
+ case BOTTOM_VISIBLE:
+ // all apps
+ if (animated) {
+ mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.49f : 0.46f);
+ mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.49f : 0.46f);
+ mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
+ }
+ break;
+ }
if (animated) {
ObjectAnimator wallpaperAnim = ObjectAnimator.ofPropertyValuesHolder(this,
PropertyValuesHolder.ofFloat(
"verticalWallpaperOffset", 0.5f),
PropertyValuesHolder.ofFloat(
"horizontalWallpaperOffset", wallpaperOffsetForCurrentScroll()));
- mAnimator.play(wallpaperAnim);
wallpaperAnim.setDuration(duration);
wallpaperAnim.setInterpolator(mZoomInInterpolator);
- } else {
- setHorizontalWallpaperOffset(wallpaperOffsetForCurrentScroll());
- setVerticalWallpaperOffset(0.5f);
- updateWallpaperOffsetImmediately();
- }
+ mAnimator.play(wallpaperAnim);
- if (animated) {
// If we call this when we're not animated, onAnimationEnd is never called on
// the listener; make sure we only use the listener when we're actually animating
mAnimator.addListener(mUnshrinkAnimationListener);
mAnimator.start();
+ } else {
+ setHorizontalWallpaperOffset(wallpaperOffsetForCurrentScroll());
+ setVerticalWallpaperOffset(0.5f);
+ updateWallpaperOffsetImmediately();
}
}
@@ -2693,7 +2772,7 @@
public Folder getFolderForTag(Object tag) {
final int screenCount = getChildCount();
for (int screen = 0; screen < screenCount; screen++) {
- CellLayout currentScreen = ((CellLayout) getChildAt(screen));
+ ViewGroup currentScreen = ((CellLayout) getChildAt(screen)).getChildrenLayout();
int count = currentScreen.getChildCount();
for (int i = 0; i < count; i++) {
View child = currentScreen.getChildAt(i);
@@ -2712,7 +2791,7 @@
public View getViewForTag(Object tag) {
int screenCount = getChildCount();
for (int screen = 0; screen < screenCount; screen++) {
- CellLayout currentScreen = ((CellLayout) getChildAt(screen));
+ ViewGroup currentScreen = ((CellLayout) getChildAt(screen)).getChildrenLayout();
int count = currentScreen.getChildCount();
for (int i = 0; i < count; i++) {
View child = currentScreen.getChildAt(i);
@@ -2737,7 +2816,7 @@
}
for (int i = 0; i < screenCount; i++) {
- final CellLayout layout = (CellLayout) getChildAt(i);
+ final ViewGroup layout = ((CellLayout) getChildAt(i)).getChildrenLayout();
// Avoid ANRs by treating each screen separately
post(new Runnable() {
@@ -2842,7 +2921,7 @@
void updateShortcuts(ArrayList<ApplicationInfo> apps) {
final int screenCount = getChildCount();
for (int i = 0; i < screenCount; i++) {
- final CellLayout layout = (CellLayout) getChildAt(i);
+ final ViewGroup layout = ((CellLayout) getChildAt(i)).getChildrenLayout();
int childCount = layout.getChildCount();
for (int j = 0; j < childCount; j++) {
final View view = layout.getChildAt(j);