adding "Remove" and "Delete" text to delete button
- also removed some unused assets
Change-Id: Iad42afd2f144de92d80fb89d892ab42b32811b69
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index 5b98a15..caa1406 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -204,10 +204,6 @@
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 @@
// 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 16061d3..4bed84c 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.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 @@
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 @@
@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 @@
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 @@
DragView dragView, Object dragInfo) {
if (mDragAndDropEnabled) {
mTransition.reverseTransition(getTransitionAnimationDuration());
+ setTextColor(mDragTextColor);
super.onDragEnter(source, x, y, xOffset, yOffset, dragView, dragInfo);
}
}
@@ -141,6 +152,7 @@
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 bfc46cf..fb5d0f0 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 3c1c336..82f5aea 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2595,19 +2595,23 @@
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;
}
}