Fixing an issue where qsb press states could be out of sync. (Bug 5627327)

- Adding haptic feedback to qsb button clicks (Bug 5652304)

Change-Id: I93d7c7a737f167d7ddf2b426d87e3a062feccac3
This commit is contained in:
Winson Chung
2011-11-21 12:31:42 -08:00
parent 601cac2f3e
commit bb185bdd57
4 changed files with 42 additions and 6 deletions

View File

@@ -42,7 +42,7 @@ public class HolographicViewHelper {
void generatePressedFocusedStates(ImageView v) {
if (!mStatesUpdated && v != null) {
mStatesUpdated = true;
Bitmap outline = createGlowingOutline(v, mTempCanvas);
Bitmap outline = createPressImage(v, mTempCanvas);
FastBitmapDrawable d = new FastBitmapDrawable(outline);
StateListDrawable states = new StateListDrawable();
@@ -54,10 +54,20 @@ public class HolographicViewHelper {
}
/**
* Returns a new bitmap to be used as the object outline, e.g. to visualize the drop location.
* Invalidates the pressed/focused states.
*/
void invalidatePressedFocusedStates(ImageView v) {
mStatesUpdated = false;
if (v != null) {
v.invalidate();
}
}
/**
* Creates a new press state image which is the old image with a blue overlay.
* Responsibility for the bitmap is transferred to the caller.
*/
private Bitmap createGlowingOutline(ImageView v, Canvas canvas) {
private Bitmap createPressImage(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);