summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/DeleteZone.java
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/com/android/launcher2/DeleteZone.java
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/com/android/launcher2/DeleteZone.java')
-rw-r--r--src/com/android/launcher2/DeleteZone.java20
1 files changed, 16 insertions, 4 deletions
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);
}
}