Fixing drop target area, and adding bg color indicators.

- Merging wallpaper fix and PagedViewIconCache key fix

Change-Id: I2a65bc4b642f020dfc4d2223a36d3ebcf41de5f5
This commit is contained in:
Winson Chung
2011-06-12 15:15:29 -07:00
parent f0ea4d3378
commit 61fa4197c4
12 changed files with 176 additions and 78 deletions

View File

@@ -16,20 +16,20 @@
package com.android.launcher2;
import android.animation.ObjectAnimator;
import android.content.ComponentName;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import com.android.launcher.R;
public class InfoDropTarget extends IconDropTarget {
public class InfoDropTarget extends ButtonDropTarget {
private int mDefaultTextColor;
private int mHoverColor = 0xFF0000FF;
public InfoDropTarget(Context context, AttributeSet attrs) {
@@ -46,10 +46,11 @@ public class InfoDropTarget extends IconDropTarget {
// Get the hover color
Resources r = getResources();
mDefaultTextColor = getTextColors().getDefaultColor();
mHoverColor = r.getColor(R.color.info_target_hover_tint);
mHoverPaint.setColorFilter(new PorterDuffColorFilter(
mHoverColor, PorterDuff.Mode.SRC_ATOP));
setBackgroundColor(mHoverColor);
getBackground().setAlpha(0);
}
private boolean isApplication(Object info) {
@@ -85,7 +86,7 @@ public class InfoDropTarget extends IconDropTarget {
}
mActive = isVisible;
((ViewGroup) getParent()).setVisibility(isVisible ? View.VISIBLE : View.GONE);
setVisibility(isVisible ? View.VISIBLE : View.GONE);
}
@Override
@@ -97,12 +98,17 @@ public class InfoDropTarget extends IconDropTarget {
public void onDragEnter(DragObject d) {
super.onDragEnter(d);
setTextColor(mHoverColor);
ObjectAnimator anim = ObjectAnimator.ofInt(getBackground(), "alpha",
Color.alpha(mHoverColor));
anim.setDuration(mTransitionDuration);
anim.start();
}
public void onDragExit(DragObject d) {
super.onDragExit(d);
setTextColor(mDefaultTextColor);
ObjectAnimator anim = ObjectAnimator.ofInt(getBackground(), "alpha", 0);
anim.setDuration(mTransitionDuration);
anim.start();
}
}