summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2010-12-17 20:04:50 -0800
committerMichael Jurka <mikejurka@google.com>2010-12-21 14:27:41 -0800
commit577d017732abf9969e9a5c1b6aa3ffb5b8fdae7f (patch)
treef72eea280796f43ca4b758d0efed80d2a5b189c8 /src
parentb7f2a8f099bd5abac5a613b8b2a5e8e337f847b1 (diff)
downloadandroid_packages_apps_Trebuchet-577d017732abf9969e9a5c1b6aa3ffb5b8fdae7f.tar.gz
android_packages_apps_Trebuchet-577d017732abf9969e9a5c1b6aa3ffb5b8fdae7f.tar.bz2
android_packages_apps_Trebuchet-577d017732abf9969e9a5c1b6aa3ffb5b8fdae7f.zip
adding "Remove" and "Delete" text to delete button
- also removed some unused assets Change-Id: Iad42afd2f144de92d80fb89d892ab42b32811b69
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AllAppsPagedView.java7
-rw-r--r--src/com/android/launcher2/DeleteZone.java20
-rw-r--r--src/com/android/launcher2/IconDropTarget.java9
-rw-r--r--src/com/android/launcher2/Launcher.java6
4 files changed, 24 insertions, 18 deletions
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 5b98a1530..caa140605 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -204,10 +204,6 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
private void setupDragMode() {
mLauncher.getWorkspace().shrink(Workspace.ShrinkState.BOTTOM_VISIBLE);
-
- DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
- deleteZone.setDragAndDropEnabled(false);
-
DeleteZone allAppsDeleteZone = (DeleteZone)
mLauncher.findViewById(R.id.all_apps_delete_zone);
allAppsDeleteZone.setDragAndDropEnabled(true);
@@ -223,9 +219,6 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All
// deleteZone and the appInfoButton in all apps, and re-enable the instance which
// live in the workspace
public void run() {
- DeleteZone deleteZone = (DeleteZone) mLauncher.findViewById(R.id.delete_zone);
- deleteZone.setDragAndDropEnabled(true);
-
DeleteZone allAppsDeleteZone =
(DeleteZone) mLauncher.findViewById(R.id.all_apps_delete_zone);
allAppsDeleteZone.setDragAndDropEnabled(false);
diff --git a/src/com/android/launcher2/DeleteZone.java b/src/com/android/launcher2/DeleteZone.java
index 16061d34e..4bed84c5c 100644
--- a/src/com/android/launcher2/DeleteZone.java
+++ b/src/com/android/launcher2/DeleteZone.java
@@ -16,7 +16,10 @@
package com.android.launcher2;
+import com.android.launcher.R;
+
import android.content.Context;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
@@ -31,14 +34,13 @@ import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
-import com.android.launcher.R;
-
public class DeleteZone extends IconDropTarget {
private static final int ORIENTATION_HORIZONTAL = 1;
private static final int TRANSITION_DURATION = 250;
private static final int ANIMATION_DURATION = 200;
private static final int XLARGE_TRANSITION_DURATION = 150;
private static final int XLARGE_ANIMATION_DURATION = 200;
+ private static final int LEFT_DRAWABLE = 0;
private AnimationSet mInAnimation;
private AnimationSet mOutAnimation;
@@ -51,6 +53,8 @@ public class DeleteZone extends IconDropTarget {
private final RectF mRegionF = new RectF();
private final Rect mRegion = new Rect();
private TransitionDrawable mTransition;
+ private int mTextColor;
+ private int mDragTextColor;
public DeleteZone(Context context, AttributeSet attrs) {
this(context, attrs, 0);
@@ -74,7 +78,14 @@ public class DeleteZone extends IconDropTarget {
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mTransition = (TransitionDrawable) getDrawable();
+ mTransition = (TransitionDrawable) getCompoundDrawables()[LEFT_DRAWABLE];
+ if (LauncherApplication.isScreenXLarge()) {
+ mTransition.setCrossFadeEnabled(false);
+ }
+
+ Resources r = getResources();
+ mTextColor = r.getColor(R.color.workspace_all_apps_and_delete_zone_text_color);
+ mDragTextColor = r.getColor(R.color.workspace_delete_zone_drag_text_color);
}
public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
@@ -115,7 +126,6 @@ public class DeleteZone extends IconDropTarget {
final LauncherAppWidgetInfo launcherAppWidgetInfo = (LauncherAppWidgetInfo) item;
final LauncherAppWidgetHost appWidgetHost = mLauncher.getAppWidgetHost();
if (appWidgetHost != null) {
- final int appWidgetId = launcherAppWidgetInfo.appWidgetId;
// Deleting an app widget ID is a void call but writes to disk before returning
// to the caller...
new Thread("deleteAppWidgetId") {
@@ -133,6 +143,7 @@ public class DeleteZone extends IconDropTarget {
DragView dragView, Object dragInfo) {
if (mDragAndDropEnabled) {
mTransition.reverseTransition(getTransitionAnimationDuration());
+ setTextColor(mDragTextColor);
super.onDragEnter(source, x, y, xOffset, yOffset, dragView, dragInfo);
}
}
@@ -141,6 +152,7 @@ public class DeleteZone extends IconDropTarget {
DragView dragView, Object dragInfo) {
if (mDragAndDropEnabled) {
mTransition.reverseTransition(getTransitionAnimationDuration());
+ setTextColor(mTextColor);
super.onDragExit(source, x, y, xOffset, yOffset, dragView, dragInfo);
}
}
diff --git a/src/com/android/launcher2/IconDropTarget.java b/src/com/android/launcher2/IconDropTarget.java
index bfc46cf42..fb5d0f081 100644
--- a/src/com/android/launcher2/IconDropTarget.java
+++ b/src/com/android/launcher2/IconDropTarget.java
@@ -16,22 +16,19 @@
package com.android.launcher2;
-import com.android.launcher.R;
-
import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
-import android.widget.ImageView;
+import android.widget.TextView;
+
/**
* Implements a DropTarget which allows applications to be dropped on it,
* in order to launch the application info for that app.
*/
-public class IconDropTarget extends ImageView implements DropTarget, DragController.DragListener {
+public class IconDropTarget extends TextView implements DropTarget, DragController.DragListener {
protected Launcher mLauncher;
/**
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 3c1c33657..82f5aea03 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2595,19 +2595,23 @@ public final class Launcher extends Activity
hideOrShowToolbarButton(true, divider, showSeq);
hideOrShowToolbarButton(true, configureButton, showSeq);
mDeleteZone.setOverlappingViews(new View[] { allAppsButton, divider, configureButton });
+ mDeleteZone.setDragAndDropEnabled(true);
+ mDeleteZone.setText(getResources().getString(R.string.delete_zone_label_workspace));
break;
case ALL_APPS:
hideOrShowToolbarButton(false, configureButton, hideSeq);
hideOrShowToolbarButton(false, searchButton, hideSeq);
hideOrShowToolbarButton(false, divider, hideSeq);
hideOrShowToolbarButton(false, allAppsButton, hideSeq);
+ mDeleteZone.setDragAndDropEnabled(false);
+ mDeleteZone.setText(getResources().getString(R.string.delete_zone_label_all_apps));
break;
case CUSTOMIZE:
hideOrShowToolbarButton(false, allAppsButton, hideSeq);
hideOrShowToolbarButton(false, searchButton, hideSeq);
hideOrShowToolbarButton(false, divider, hideSeq);
hideOrShowToolbarButton(false, configureButton, hideSeq);
- //mDeleteZone.setOverlappingView(configureButton);
+ mDeleteZone.setDragAndDropEnabled(false);
break;
}
}