merge in honeycomb-release history after reset to honeycomb
diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml
index 5a38e08..3e514fb 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">850</integer>
+ <integer name="config_allAppsZoomInTime">800</integer>
<!-- Duration in milliseconds of the transition between tabs in the all apps/customize
tray -->
@@ -17,18 +17,18 @@
<!-- 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">500</integer>
+ <integer name="config_allAppsZoomOutTime">600</integer>
<!-- Scaling factor used in the all apps zooming animations -->
<integer name="config_allAppsZoomScaleFactor">10</integer>
<!-- 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_customizeZoomInTime">700</integer>
+ <integer name="config_customizeZoomInTime">800</integer>
<!-- 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_customizeZoomOutTime">350</integer>
+ <integer name="config_customizeZoomOutTime">600</integer>
<!-- Scaling factor used in the all apps zooming animations -->
<integer name="config_customizeZoomScaleFactor">7</integer>
@@ -37,9 +37,9 @@
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_customizeWorkspaceShrinkTime">700</integer>
+ <integer name="config_customizeWorkspaceShrinkTime">800</integer>
<integer name="config_allAppsWorkspaceShrinkTime">800</integer>
- <integer name="config_workspaceUnshrinkTime">350</integer>
+ <integer name="config_workspaceUnshrinkTime">450</integer>
<!-- Duration in milliseconds toolbar fade in and fade out animations.
NOTE: Fade in and fade out time should together be less the transition
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index a15b73b..ef9e3fa 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -24,7 +24,6 @@
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -271,6 +270,7 @@
}
// Start the drag
+ mLauncher.lockScreenOrientation();
mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b);
mDragController.startDrag(v, b, this, app, DragController.DRAG_ACTION_COPY, null);
b.recycle();
@@ -289,6 +289,7 @@
}
tearDownDragMode();
mLauncher.getWorkspace().onDragStopped();
+ mLauncher.unlockScreenOrientation();
}
@Override
diff --git a/src/com/android/launcher2/ApplicationInfoDropTarget.java b/src/com/android/launcher2/ApplicationInfoDropTarget.java
index f944022..78a9d2d 100644
--- a/src/com/android/launcher2/ApplicationInfoDropTarget.java
+++ b/src/com/android/launcher2/ApplicationInfoDropTarget.java
@@ -26,7 +26,6 @@
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
-import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 45de630..af2f984 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -797,18 +797,6 @@
}
/**
- * Check if the row 'y' is empty from columns 'left' to 'right', inclusive.
- */
- private static boolean isRowEmpty(int y, int left, int right, boolean[][] occupied) {
- for (int x = left; x <= right; x++) {
- if (occupied[x][y]) {
- return false;
- }
- }
- return true;
- }
-
- /**
* Given a point, return the cell that strictly encloses that point
* @param x X coordinate of the point
* @param y Y coordinate of the point
@@ -1042,28 +1030,6 @@
}
}
- private boolean isVacantIgnoring(
- int originX, int originY, int spanX, int spanY, View ignoreView) {
- if (ignoreView != null) {
- markCellsAsUnoccupiedForView(ignoreView);
- }
- boolean isVacant = true;
- for (int i = 0; i < spanY; i++) {
- if (!isRowEmpty(originY + i, originX, originX + spanX - 1, mOccupied)) {
- isVacant = false;
- break;
- }
- }
- if (ignoreView != null) {
- markCellsAsOccupiedForView(ignoreView);
- }
- return isVacant;
- }
-
- private boolean isVacant(int originX, int originY, int spanX, int spanY) {
- return isVacantIgnoring(originX, originY, spanX, spanY, null);
- }
-
public View getChildAt(int x, int y) {
final int count = getChildCount();
for (int i = 0; i < count; i++) {
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 6a563f2..d9a6612 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -308,8 +308,8 @@
}
public void setCustomizationFilter(CustomizationType filterType) {
- mCustomizationType = filterType;
cancelDragging();
+ mCustomizationType = filterType;
if (getChildCount() > 0) {
setCurrentPage(0);
updateCurrentPageScroll();
@@ -328,6 +328,7 @@
public void onDropCompleted(View target, boolean success) {
resetCheckedGrandchildren();
mLauncher.getWorkspace().onDragStopped();
+ mLauncher.unlockScreenOrientation();
}
@Override
@@ -500,60 +501,67 @@
endChoiceMode();
}
boolean result = false;
+ mLauncher.lockScreenOrientation();
switch (mCustomizationType) {
case WidgetCustomization: {
- // Get the widget preview as the drag representation
- final LinearLayout l = (LinearLayout) v;
- final ImageView i = (ImageView) l.findViewById(R.id.widget_preview);
- final Drawable icon = i.getDrawable();
- Bitmap b = drawableToBitmap(icon, i);
- PendingAddWidgetInfo createWidgetInfo = (PendingAddWidgetInfo) v.getTag();
+ if (v instanceof PagedViewWidget) {
+ // Get the widget preview as the drag representation
+ final LinearLayout l = (LinearLayout) v;
+ final ImageView i = (ImageView) l.findViewById(R.id.widget_preview);
+ final Drawable icon = i.getDrawable();
+ Bitmap b = drawableToBitmap(icon, i);
+ PendingAddWidgetInfo createWidgetInfo = (PendingAddWidgetInfo) v.getTag();
- int[] spanXY = CellLayout.rectToCell(
- getResources(), createWidgetInfo.minWidth, createWidgetInfo.minHeight, null);
- createWidgetInfo.spanX = spanXY[0];
- createWidgetInfo.spanY = spanXY[1];
- mLauncher.getWorkspace().onDragStartedWithItemSpans(spanXY[0], spanXY[1], b);
- mDragController.startDrag(
- i, b, this, createWidgetInfo, DragController.DRAG_ACTION_COPY, null);
- b.recycle();
- result = true;
+ int[] spanXY = CellLayout.rectToCell(
+ getResources(), createWidgetInfo.minWidth, createWidgetInfo.minHeight, null);
+ createWidgetInfo.spanX = spanXY[0];
+ createWidgetInfo.spanY = spanXY[1];
+ mLauncher.getWorkspace().onDragStartedWithItemSpans(spanXY[0], spanXY[1], b);
+ mDragController.startDrag(
+ i, b, this, createWidgetInfo, DragController.DRAG_ACTION_COPY, null);
+ b.recycle();
+ result = true;
+ }
break;
}
case ShortcutCustomization: {
- // get icon (top compound drawable, index is 1)
- final TextView tv = (TextView) v;
- final Drawable icon = tv.getCompoundDrawables()[1];
- Bitmap b = drawableToBitmap(icon, tv);
- PendingAddItemInfo createItemInfo = (PendingAddItemInfo) v.getTag();
+ if (v instanceof PagedViewIcon) {
+ // get icon (top compound drawable, index is 1)
+ final TextView tv = (TextView) v;
+ final Drawable icon = tv.getCompoundDrawables()[1];
+ Bitmap b = drawableToBitmap(icon, tv);
+ PendingAddItemInfo createItemInfo = (PendingAddItemInfo) v.getTag();
- mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b);
- mDragController.startDrag(v, b, this, createItemInfo, DragController.DRAG_ACTION_COPY,
- null);
- b.recycle();
- result = true;
+ mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b);
+ mDragController.startDrag(v, b, this, createItemInfo, DragController.DRAG_ACTION_COPY,
+ null);
+ b.recycle();
+ result = true;
+ }
break;
}
case ApplicationCustomization: {
- // Pick up the application for dropping
- // get icon (top compound drawable, index is 1)
- final TextView tv = (TextView) v;
- final Drawable icon = tv.getCompoundDrawables()[1];
- Bitmap b = drawableToBitmap(icon, tv);
- ApplicationInfo app = (ApplicationInfo) v.getTag();
- app = new ApplicationInfo(app);
+ if (v instanceof PagedViewIcon) {
+ // Pick up the application for dropping
+ // get icon (top compound drawable, index is 1)
+ final TextView tv = (TextView) v;
+ final Drawable icon = tv.getCompoundDrawables()[1];
+ Bitmap b = drawableToBitmap(icon, tv);
+ ApplicationInfo app = (ApplicationInfo) v.getTag();
+ app = new ApplicationInfo(app);
- mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b);
- mDragController.startDrag(v, b, this, app, DragController.DRAG_ACTION_COPY, null);
- b.recycle();
- result = true;
+ mLauncher.getWorkspace().onDragStartedWithItemSpans(1, 1, b);
+ mDragController.startDrag(v, b, this, app, DragController.DRAG_ACTION_COPY, null);
+ b.recycle();
+ result = true;
+ }
break;
}
}
// We toggle the checked state _after_ we create the view for the drag in case toggling the
// checked state changes the view's look
- if (v instanceof Checkable) {
+ if (result && (v instanceof Checkable)) {
// In preparation for drag, we always reset the checked grand children regardless of
// what choice mode we are in
resetCheckedGrandchildren();
diff --git a/src/com/android/launcher2/DeferredHandler.java b/src/com/android/launcher2/DeferredHandler.java
index 0323c7f..930da56 100644
--- a/src/com/android/launcher2/DeferredHandler.java
+++ b/src/com/android/launcher2/DeferredHandler.java
@@ -31,7 +31,7 @@
* This class is fifo.
*/
public class DeferredHandler {
- private LinkedList<Runnable> mQueue = new LinkedList();
+ private LinkedList<Runnable> mQueue = new LinkedList<Runnable>();
private MessageQueue mMessageQueue = Looper.myQueue();
private Impl mHandler = new Impl();
diff --git a/src/com/android/launcher2/DragView.java b/src/com/android/launcher2/DragView.java
index a8dad7a..433dab8 100644
--- a/src/com/android/launcher2/DragView.java
+++ b/src/com/android/launcher2/DragView.java
@@ -123,6 +123,14 @@
// The point in our scaled bitmap that the touch events are located
mRegistrationX = registrationX;
mRegistrationY = registrationY;
+
+ // Force a measure, because Workspace uses getMeasuredHeight() before the layout pass
+ int ms = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
+ measure(ms, ms);
+ }
+
+ public float getOffsetY() {
+ return mOffsetY;
}
public void setDragRegion(int left, int top, int width, int height) {
diff --git a/src/com/android/launcher2/FolderIcon.java b/src/com/android/launcher2/FolderIcon.java
index 86c099e..dd83c78 100644
--- a/src/com/android/launcher2/FolderIcon.java
+++ b/src/com/android/launcher2/FolderIcon.java
@@ -18,7 +18,6 @@
import android.content.Context;
import android.content.res.Resources;
-import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
diff --git a/src/com/android/launcher2/IconCache.java b/src/com/android/launcher2/IconCache.java
index 468645b..2e47adc 100644
--- a/src/com/android/launcher2/IconCache.java
+++ b/src/com/android/launcher2/IconCache.java
@@ -16,8 +16,6 @@
package com.android.launcher2;
-import com.android.launcher.R;
-
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
diff --git a/src/com/android/launcher2/InstallWidgetReceiver.java b/src/com/android/launcher2/InstallWidgetReceiver.java
index 970c6a5..4f6cb8d 100644
--- a/src/com/android/launcher2/InstallWidgetReceiver.java
+++ b/src/com/android/launcher2/InstallWidgetReceiver.java
@@ -184,7 +184,6 @@
@Override
public void onClick(DialogInterface dialog, int which) {
- final LauncherModel model = mLauncher.getModel();
final AppWidgetProviderInfo widgetInfo = mActivities.get(which).widgetInfo;
final PendingAddWidgetInfo createInfo = new PendingAddWidgetInfo(widgetInfo, mMimeType,
diff --git a/src/com/android/launcher2/InterruptibleInOutAnimator.java b/src/com/android/launcher2/InterruptibleInOutAnimator.java
index be2fd04..135fa39 100644
--- a/src/com/android/launcher2/InterruptibleInOutAnimator.java
+++ b/src/com/android/launcher2/InterruptibleInOutAnimator.java
@@ -18,9 +18,7 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
-import android.util.Log;
/**
* A convenience class for two-way animations, e.g. a fadeIn/fadeOut animation.
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index bef4e84..d5b218d 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -17,17 +17,19 @@
package com.android.launcher2;
-import com.android.common.Search;
-import com.android.launcher.R;
-import com.android.launcher2.CustomizePagedView.CustomizationType;
-import com.android.launcher2.Workspace.ShrinkState;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
-import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.app.Activity;
import android.app.AlertDialog;
@@ -45,12 +47,12 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.IntentFilter;
import android.content.Intent.ShortcutIconResource;
+import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -77,16 +79,18 @@
import android.text.TextUtils;
import android.text.method.TextKeyListener;
import android.util.Log;
+import android.view.Display;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
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;
@@ -96,20 +100,16 @@
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 java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
+import com.android.common.Search;
+import com.android.launcher.R;
+import com.android.launcher2.CustomizePagedView.CustomizationType;
+import com.android.launcher2.Workspace.ShrinkState;
/**
@@ -264,6 +264,10 @@
private HashMap<View, AppWidgetProviderInfo> mWidgetsToAdvance =
new HashMap<View, AppWidgetProviderInfo>();
+ // Determines how long to wait after a rotation before restoring the screen orientation to
+ // match the sensor state.
+ private final int mRestoreScreenOrientationDelay = 500;
+
// External icons saved in case of resource changes, orientation, etc.
private static Drawable.ConstantState sGlobalSearchIcon;
private static Drawable.ConstantState sVoiceSearchIcon;
@@ -359,7 +363,6 @@
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- String tag = mHomeCustomizationDrawer.getCurrentTabTag();
mCustomizePagedView.setCustomizationFilter(newType);
final float alpha = mCustomizePagedView.getAlpha();
@@ -993,7 +996,6 @@
deleteZone.setLauncher(this);
deleteZone.setDragController(dragController);
- int deleteZoneHandleId;
final View allAppsButton = findViewById(R.id.all_apps_button);
final View divider = findViewById(R.id.divider);
@@ -1070,7 +1072,6 @@
// reload these every tap; you never know when they might change
loadHotseats();
if (index >= 0 && index < mHotseats.length && mHotseats[index] != null) {
- Intent intent = mHotseats[index];
startActivitySafely(
mHotseats[index],
"hotseat"
@@ -1710,7 +1711,7 @@
final ClipDescription clipDesc = clipData.getDescription();
for (int i = 0; i < clipDesc.getMimeTypeCount(); ++i) {
if (clipDesc.getMimeType(i).equals(mimeType)) {
- final ClipData.Item item = clipData.getItem(i);
+ final ClipData.Item item = clipData.getItemAt(i);
final CharSequence stringData = item.getText();
final Uri uriData = item.getUri();
final Intent intentData = item.getIntent();
@@ -3576,6 +3577,49 @@
}
}
+ private int mapConfigurationOriActivityInfoOri(int configOri) {
+ final Display d = getWindowManager().getDefaultDisplay();
+ int naturalOri = Configuration.ORIENTATION_LANDSCAPE;
+ switch (d.getRotation()) {
+ case Surface.ROTATION_0:
+ case Surface.ROTATION_180:
+ // We are currently in the same basic orientation as the natural orientation
+ naturalOri = configOri;
+ break;
+ case Surface.ROTATION_90:
+ case Surface.ROTATION_270:
+ // We are currently in the other basic orientation to the natural orientation
+ naturalOri = (configOri == Configuration.ORIENTATION_LANDSCAPE) ?
+ Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE;
+ break;
+ }
+
+ int[] oriMap = {
+ ActivityInfo.SCREEN_ORIENTATION_PORTRAIT,
+ ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE,
+ ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT,
+ ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
+ };
+ // Since the map starts at portrait, we need to offset if this device's natural orientation
+ // is landscape.
+ int indexOffset = 0;
+ if (naturalOri == Configuration.ORIENTATION_LANDSCAPE) {
+ indexOffset = 1;
+ }
+ return oriMap[(d.getRotation() + indexOffset) % 4];
+ }
+ public void lockScreenOrientation() {
+ setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
+ .getConfiguration().orientation));
+ }
+ public void unlockScreenOrientation() {
+ mHandler.postDelayed(new Runnable() {
+ public void run() {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ }
+ }, mRestoreScreenOrientationDelay);
+ }
+
/**
* Prints out out state for debugging.
*/
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index bb59678..1965712 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -17,13 +17,9 @@
package com.android.launcher2;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.TreeMap;
-import java.util.TreeSet;
import android.content.Context;
import android.content.res.TypedArray;
-import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Parcel;
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index b779a97..70ad997 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -17,14 +17,8 @@
package com.android.launcher2;
import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.util.AttributeSet;
-import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 07a59ee..9b83f48 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -33,6 +33,7 @@
import android.os.Message;
import android.util.AttributeSet;
import android.view.MotionEvent;
+import android.view.View;
import android.widget.Checkable;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -159,8 +160,10 @@
image.setImageDrawable(preview);
final TextView name = (TextView) findViewById(R.id.widget_name);
name.setText(info.label);
+ name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
final TextView dims = (TextView) findViewById(R.id.widget_dims);
dims.setText(mContext.getString(R.string.widget_dims_format, cellSpan[0], cellSpan[1]));
+ dims.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
if (createHolographicOutline) {
mIconCache = cache;
@@ -178,6 +181,7 @@
image.setImageDrawable(preview);
TextView name = (TextView) findViewById(R.id.wallpaper_name);
name.setText(info.loadLabel(packageManager));
+ name.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
if (createHolographicOutline) {
mIconCache = cache;
diff --git a/src/com/android/launcher2/PagedViewWithDraggableItems.java b/src/com/android/launcher2/PagedViewWithDraggableItems.java
index 3f72292..5fa7be7 100644
--- a/src/com/android/launcher2/PagedViewWithDraggableItems.java
+++ b/src/com/android/launcher2/PagedViewWithDraggableItems.java
@@ -35,6 +35,7 @@
implements View.OnLongClickListener, View.OnTouchListener {
private View mLastTouchedItem;
private boolean mIsDragging;
+ private boolean mIsDragEnabled;
private float mDragSlopeThreshold;
public PagedViewWithDraggableItems(Context context) {
@@ -58,6 +59,7 @@
protected void cancelDragging() {
mIsDragging = false;
mLastTouchedItem = null;
+ mIsDragEnabled = false;
}
private void handleTouchEvent(MotionEvent ev) {
@@ -65,9 +67,10 @@
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
cancelDragging();
+ mIsDragEnabled = true;
break;
case MotionEvent.ACTION_MOVE:
- if (mTouchState != TOUCH_STATE_SCROLLING && !mIsDragging) {
+ if (mTouchState != TOUCH_STATE_SCROLLING && !mIsDragging && mIsDragEnabled) {
determineDraggingStart(ev);
}
break;
@@ -89,6 +92,7 @@
@Override
public boolean onTouch(View v, MotionEvent event) {
mLastTouchedItem = v;
+ mIsDragEnabled = true;
return false;
}
@@ -153,7 +157,7 @@
@Override
protected void onDetachedFromWindow() {
- mLastTouchedItem = null;
+ cancelDragging();
super.onDetachedFromWindow();
}
}
diff --git a/src/com/android/launcher2/UserFolder.java b/src/com/android/launcher2/UserFolder.java
index d6799f7..b362fbd 100644
--- a/src/com/android/launcher2/UserFolder.java
+++ b/src/com/android/launcher2/UserFolder.java
@@ -1,7 +1,6 @@
package com.android.launcher2;
import android.content.Context;
-import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index 03a2a52..60f71f5 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -54,12 +54,10 @@
private static int sIconTextureWidth = -1;
private static int sIconTextureHeight = -1;
- private static final Paint sPaint = new Paint();
private static final Paint sBlurPaint = new Paint();
private static final Paint sGlowColorPressedPaint = new Paint();
private static final Paint sGlowColorFocusedPaint = new Paint();
private static final Paint sDisabledPaint = new Paint();
- private static final Rect sBounds = new Rect();
private static final Rect sOldBounds = new Rect();
private static final Canvas sCanvas = new Canvas();
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 89de2da..af7d080 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -599,9 +599,6 @@
}
protected void setWallpaperDimension() {
- WallpaperManager wpm =
- (WallpaperManager) mLauncher.getSystemService(Context.WALLPAPER_SERVICE);
-
Display display = mLauncher.getWindowManager().getDefaultDisplay();
final int maxDim = Math.max(display.getWidth(), display.getHeight());
final int minDim = Math.min(display.getWidth(), display.getHeight());
@@ -610,7 +607,7 @@
// parallax effects
mWallpaperWidth = (int) (maxDim * wallpaperTravelToScreenWidthRatio(maxDim, minDim));
mWallpaperHeight = (int)(maxDim * wallpaperTravelToScreenHeightRatio(maxDim, minDim));
- wpm.suggestDesiredDimensions(mWallpaperWidth, mWallpaperHeight);
+ mWallpaperManager.suggestDesiredDimensions(mWallpaperWidth, mWallpaperHeight);
}
public void setVerticalWallpaperOffset(WallpaperVerticalOffset offsetPosition) {
@@ -1482,11 +1479,16 @@
PropertyValuesHolder.ofFloat("backgroundAlpha", finalBackgroundAlpha),
PropertyValuesHolder.ofFloat("backgroundAlphaMultiplier",
finalAlphaMultiplierValue),
- PropertyValuesHolder.ofFloat("alpha", finalAlphaValue),
- PropertyValuesHolder.ofFloat("rotationY", rotation));
+ PropertyValuesHolder.ofFloat("alpha", finalAlphaValue));
animWithInterpolator.setDuration(duration);
animWithInterpolator.setInterpolator(mZoomInInterpolator);
- mAnimator.playTogether(animWithInterpolator);
+
+ ObjectAnimator rotationAnim = ObjectAnimator.ofPropertyValuesHolder(cl,
+ PropertyValuesHolder.ofFloat("rotationY", rotation));
+ rotationAnim.setDuration(duration);
+ rotationAnim.setInterpolator(new DecelerateInterpolator(2.0f));
+
+ mAnimator.playTogether(animWithInterpolator, rotationAnim);
} else {
cl.setTranslationX(translation);
cl.setTranslationY(0.0f);
@@ -1648,6 +1650,7 @@
child.getLocationOnScreen(mTempXY);
final int screenX = (int) mTempXY[0] + (child.getWidth() - bmpWidth) / 2;
final int screenY = (int) mTempXY[1] + (child.getHeight() - bmpHeight) / 2;
+ mLauncher.lockScreenOrientation();
mDragController.startDrag(b, screenX, screenY, 0, 0, bmpWidth, bmpHeight, this,
child.getTag(), DragController.DRAG_ACTION_MOVE, null);
b.recycle();
@@ -2011,7 +2014,7 @@
final boolean isShortcut = (widgets == null);
final String mimeType = desc.getMimeType(index);
if (isShortcut) {
- final Intent intent = data.getItem(index).getIntent();
+ final Intent intent = data.getItemAt(index).getIntent();
Object info = model.infoFromShortcutIntent(mContext, intent, data.getIcon());
onDropExternal(x, y, info, layout, false);
} else {
@@ -2258,6 +2261,13 @@
dragView.getDragRegionHeight());
}
}
+ } else if (source == this) {
+ // When dragging from the workspace, the drag view is slightly bigger than
+ // the original view, and offset vertically. Adjust to account for this.
+ final View origView = mDragInfo.cell;
+ originX += (dragView.getMeasuredWidth() - origView.getWidth()) / 2;
+ originY += (dragView.getMeasuredHeight() - origView.getHeight()) / 2
+ + dragView.getOffsetY();
}
if (mDragTargetLayout != null) {
@@ -2447,7 +2457,7 @@
boolean animateDrop = !mWasSpringLoadedOnDragExit;
((CellLayout) getChildAt(mDragInfo.screen)).onDropChild(mDragInfo.cell, animateDrop);
}
-
+ mLauncher.unlockScreenOrientation();
mDragOutline = null;
mDragInfo = null;
}