summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/HolographicViewHelper.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-11-03 13:12:50 -0700
committerWinson Chung <winsonc@google.com>2011-11-03 16:31:47 -0700
commit620542254c9b63cd17d2deefb07ffd39d8a54623 (patch)
tree3d4c53edea1c22b599d975115a1913c7261451df /src/com/android/launcher2/HolographicViewHelper.java
parent14cee9a9bb10807362595f1d1e486716f997fc00 (diff)
downloadandroid_packages_apps_Trebuchet-620542254c9b63cd17d2deefb07ffd39d8a54623.tar.gz
android_packages_apps_Trebuchet-620542254c9b63cd17d2deefb07ffd39d8a54623.tar.bz2
android_packages_apps_Trebuchet-620542254c9b63cd17d2deefb07ffd39d8a54623.zip
Altering touch feedback for qsb assets. (Bug: 5560273)
- Removing some dead code Change-Id: If6f3ffcf28249ca08c23089acb5bcd501b455119
Diffstat (limited to 'src/com/android/launcher2/HolographicViewHelper.java')
-rw-r--r--src/com/android/launcher2/HolographicViewHelper.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/com/android/launcher2/HolographicViewHelper.java b/src/com/android/launcher2/HolographicViewHelper.java
index c68a5eaad..11e81b4d3 100644
--- a/src/com/android/launcher2/HolographicViewHelper.java
+++ b/src/com/android/launcher2/HolographicViewHelper.java
@@ -20,12 +20,12 @@ import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.PorterDuff;
import android.graphics.drawable.StateListDrawable;
-import android.view.View;
+import android.widget.ImageView;
public class HolographicViewHelper {
- private final HolographicOutlineHelper mOutlineHelper = new HolographicOutlineHelper();
private final Canvas mTempCanvas = new Canvas();
private boolean mStatesUpdated;
@@ -39,16 +39,17 @@ public class HolographicViewHelper {
/**
* Generate the pressed/focused states if necessary.
*/
- void generatePressedFocusedStates(View v) {
- if (!mStatesUpdated) {
+ void generatePressedFocusedStates(ImageView v) {
+ if (!mStatesUpdated && v != null) {
mStatesUpdated = true;
- Bitmap outline = createGlowingOutline(v, mTempCanvas, mHighlightColor, mHighlightColor);
+ Bitmap outline = createGlowingOutline(v, mTempCanvas);
FastBitmapDrawable d = new FastBitmapDrawable(outline);
StateListDrawable states = new StateListDrawable();
states.addState(new int[] {android.R.attr.state_pressed}, d);
states.addState(new int[] {android.R.attr.state_focused}, d);
- v.setBackgroundDrawable(states);
+ states.addState(new int[] {}, v.getDrawable());
+ v.setImageDrawable(states);
}
}
@@ -56,16 +57,16 @@ public class HolographicViewHelper {
* Returns a new bitmap to be used as the object outline, e.g. to visualize the drop location.
* Responsibility for the bitmap is transferred to the caller.
*/
- private Bitmap createGlowingOutline(View v, Canvas canvas, int outlineColor, int glowColor) {
+ private Bitmap createGlowingOutline(ImageView v, Canvas canvas) {
final int padding = HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS;
final Bitmap b = Bitmap.createBitmap(
v.getWidth() + padding, v.getHeight() + padding, Bitmap.Config.ARGB_8888);
canvas.setBitmap(b);
canvas.save();
- v.draw(canvas);
+ v.getDrawable().draw(canvas);
canvas.restore();
- mOutlineHelper.applyOuterBlur(b, canvas, outlineColor);
+ canvas.drawColor(mHighlightColor, PorterDuff.Mode.SRC_IN);
canvas.setBitmap(null);
return b;