diff options
author | Winson Chung <winsonc@google.com> | 2011-06-30 18:09:30 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2011-07-01 12:33:32 -0700 |
commit | 967289b6d5fec77f5c381d11ffb2319f3bb5e737 (patch) | |
tree | 4cee018390432723fb9526a8bf744a5a0a5b9b6a /src/com/android/launcher2/DeleteDropTarget.java | |
parent | 3ac74c55cf8baef29db80e8c67ab4ab033b04417 (diff) | |
download | android_packages_apps_Trebuchet-967289b6d5fec77f5c381d11ffb2319f3bb5e737.tar.gz android_packages_apps_Trebuchet-967289b6d5fec77f5c381d11ffb2319f3bb5e737.tar.bz2 android_packages_apps_Trebuchet-967289b6d5fec77f5c381d11ffb2319f3bb5e737.zip |
Adding new assets.
Change-Id: I20c8ceae997290781923caf195f6f87e283b1b7f
Diffstat (limited to 'src/com/android/launcher2/DeleteDropTarget.java')
-rw-r--r-- | src/com/android/launcher2/DeleteDropTarget.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/com/android/launcher2/DeleteDropTarget.java b/src/com/android/launcher2/DeleteDropTarget.java index a30c03e66..6e01bc0c4 100644 --- a/src/com/android/launcher2/DeleteDropTarget.java +++ b/src/com/android/launcher2/DeleteDropTarget.java @@ -16,16 +16,14 @@ package com.android.launcher2; -import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; -import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; +import android.graphics.drawable.TransitionDrawable; import android.util.AttributeSet; import android.view.View; -import android.view.ViewGroup; import android.widget.TextView; import com.android.launcher.R; @@ -33,6 +31,7 @@ import com.android.launcher.R; public class DeleteDropTarget extends ButtonDropTarget { private TextView mText; + private TransitionDrawable mDrawable; private int mHoverColor = 0xFFFF0000; public DeleteDropTarget(Context context, AttributeSet attrs) { @@ -55,8 +54,8 @@ public class DeleteDropTarget extends ButtonDropTarget { mHoverColor = r.getColor(R.color.delete_target_hover_tint); mHoverPaint.setColorFilter(new PorterDuffColorFilter( mHoverColor, PorterDuff.Mode.SRC_ATOP)); - setBackgroundColor(mHoverColor); - getBackground().setAlpha(0); + mDrawable = (TransitionDrawable) mText.getCompoundDrawables()[0]; + mDrawable.setCrossFadeEnabled(true); // Remove the text in the Phone UI in landscape int orientation = getResources().getConfiguration().orientation; @@ -127,18 +126,13 @@ public class DeleteDropTarget extends ButtonDropTarget { public void onDragEnter(DragObject d) { super.onDragEnter(d); - ObjectAnimator anim = ObjectAnimator.ofInt(getBackground(), "alpha", - Color.alpha(mHoverColor)); - anim.setDuration(mTransitionDuration); - anim.start(); + mDrawable.startTransition(mTransitionDuration); } public void onDragExit(DragObject d) { super.onDragExit(d); - ObjectAnimator anim = ObjectAnimator.ofInt(getBackground(), "alpha", 0); - anim.setDuration(mTransitionDuration); - anim.start(); + mDrawable.resetTransition(); } public void onDrop(DragObject d) { |