summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2010-10-15 18:25:36 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-15 18:25:36 -0700
commitb84c27c0af713270f0de6f154702a46d9250bbe1 (patch)
tree085857558285a6f052ecf8a2120942076913ccff
parentc031830b9e3bc052b290f5dadd2dc285ee7aa5f9 (diff)
parent3adcb0c4a32d14ed1f59a4520d08f75ff833af1f (diff)
downloadandroid_packages_apps_Trebuchet-b84c27c0af713270f0de6f154702a46d9250bbe1.tar.gz
android_packages_apps_Trebuchet-b84c27c0af713270f0de6f154702a46d9250bbe1.tar.bz2
android_packages_apps_Trebuchet-b84c27c0af713270f0de6f154702a46d9250bbe1.zip
Merge "making size of delete zone & info button larger"
-rw-r--r--src/com/android/launcher2/ApplicationInfoDropTarget.java17
-rw-r--r--src/com/android/launcher2/DeleteZone.java31
2 files changed, 39 insertions, 9 deletions
diff --git a/src/com/android/launcher2/ApplicationInfoDropTarget.java b/src/com/android/launcher2/ApplicationInfoDropTarget.java
index cb45b3aab..c4aa98cf7 100644
--- a/src/com/android/launcher2/ApplicationInfoDropTarget.java
+++ b/src/com/android/launcher2/ApplicationInfoDropTarget.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
+import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
@@ -98,9 +99,8 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
public void onDragStart(DragSource source, Object info, int dragAction) {
if (info != null) {
- mActive = true;
-
if (mManageVisibility) {
+ mActive = true;
// Only show the info icon when an application is selected
if (((ItemInfo)info).itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
setVisibility(VISIBLE);
@@ -111,7 +111,7 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
}
public boolean isDropEnabled() {
- return true;
+ return mActive;
}
public void onDragEnd() {
@@ -124,6 +124,17 @@ public class ApplicationInfoDropTarget extends ImageView implements DropTarget,
}
}
+ @Override
+ public void getHitRect(Rect outRect) {
+ super.getHitRect(outRect);
+ if (LauncherApplication.isScreenXLarge()) {
+ outRect.top -= 50;
+ outRect.left -= 50;
+ outRect.bottom += 50;
+ outRect.right += 50;
+ }
+ }
+
void setLauncher(Launcher launcher) {
mLauncher = launcher;
}
diff --git a/src/com/android/launcher2/DeleteZone.java b/src/com/android/launcher2/DeleteZone.java
index 1f54b366b..e8f160f3c 100644
--- a/src/com/android/launcher2/DeleteZone.java
+++ b/src/com/android/launcher2/DeleteZone.java
@@ -23,6 +23,7 @@ import android.content.res.TypedArray;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
+import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.TransitionDrawable;
import android.util.AttributeSet;
@@ -59,7 +60,8 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
private int mOrientation;
private DragController mDragController;
- private final RectF mRegion = new RectF();
+ private final RectF mRegionF = new RectF();
+ private final Rect mRegion = new Rect();
private TransitionDrawable mTransition;
private final Paint mTrashPaint = new Paint();
@@ -158,11 +160,17 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
final ItemInfo item = (ItemInfo) info;
if (item != null) {
mTrashMode = true;
- final int[] location = mLocation;
- getLocationOnScreen(location);
- mRegion.set(location[0], location[1], location[0] + mRight - mLeft,
- location[1] + mBottom - mTop);
- mDragController.setDeleteRegion(mRegion);
+ getHitRect(mRegion);
+ mRegionF.set(mRegion);
+
+ if (LauncherApplication.isScreenXLarge()) {
+ // This region will be a "dead zone" for scrolling; make it extend to the edge of
+ // the screen so users don't accidentally trigger a scroll while deleting items
+ mRegionF.top = mLauncher.getWorkspace().getTop();
+ mRegionF.right = mLauncher.getWorkspace().getRight();
+ }
+
+ mDragController.setDeleteRegion(mRegionF);
// Make sure the icon is set to the default drawable, not the hover drawable
mTransition.resetTransition();
@@ -194,6 +202,17 @@ public class DeleteZone extends ImageView implements DropTarget, DragController.
return true;
}
+ @Override
+ public void getHitRect(Rect outRect) {
+ super.getHitRect(outRect);
+ if (LauncherApplication.isScreenXLarge()) {
+ outRect.top -= 50;
+ outRect.left -= 50;
+ outRect.bottom += 50;
+ outRect.right += 50;
+ }
+ }
+
private void createAnimations() {
if (mInAnimation == null) {
mInAnimation = new FastAnimationSet();