summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-05-19 15:46:17 -0700
committerAlan Viverette <alanv@google.com>2014-05-19 16:27:31 -0700
commitc80ad99a33ee49d0bac994c1749ff24d243c3862 (patch)
tree63fd934b7c8b6c651d48393d569424f2ef0df95b /graphics
parentc9550f2ce8fc7043256396a689fae01b121b0d5b (diff)
downloadframeworks_base-c80ad99a33ee49d0bac994c1749ff24d243c3862.zip
frameworks_base-c80ad99a33ee49d0bac994c1749ff24d243c3862.tar.gz
frameworks_base-c80ad99a33ee49d0bac994c1749ff24d243c3862.tar.bz2
TouchFeedbackDrawable is now RippleDrawable
Change-Id: I59f5f04b73089215c6320560556ac21beb03db06
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/Drawable.java51
-rw-r--r--graphics/java/android/graphics/drawable/DrawableContainer.java26
-rw-r--r--graphics/java/android/graphics/drawable/DrawableWrapper.java305
-rw-r--r--graphics/java/android/graphics/drawable/InsetDrawable.java22
-rw-r--r--graphics/java/android/graphics/drawable/LayerDrawable.java35
-rw-r--r--graphics/java/android/graphics/drawable/RippleDrawable.java (renamed from graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java)84
6 files changed, 66 insertions, 457 deletions
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index b939636..c78096a 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -484,55 +484,28 @@ public abstract class Drawable {
}
/**
- * Indicates whether the drawable supports hotspots. Hotspots are uniquely
- * identifiable coordinates the may be added, updated and removed within a
- * drawable.
+ * Specifies the hotspot's location within the drawable.
*
- * @return true if hotspots are supported
- * @see #setHotspot(int, float, float)
- * @see #removeHotspot(int)
- * @see #clearHotspots()
- */
- public boolean supportsHotspots() {
- return false;
- }
-
- /**
- * Specifies a hotspot's location within the drawable.
- * <p>
- * The specified key should be an id declared in the resources of the
- * application to ensure it is unique (see the <a
- * href={@docRoot}guide/topics/resources/more-resources.html#Id">ID resource type</a>).
- *
- * @param key The key identifying the hotspot
* @param x The X coordinate of the center of the hotspot
* @param y The Y coordinate of the center of the hotspot
*/
- public void setHotspot(int key, float x, float y) {}
+ public void setHotspot(float x, float y) {}
/**
- * Removes the hotspot with the specified key from the drawable.
- *
- * @param key The key identifying the hotspot
- */
- public void removeHotspot(int key) {}
-
- /**
- * Immediately removes all hotspots from the drawable.
- */
- public void clearHotspots() {}
-
- /**
- * Sets the bounds to which hotspots are constrained.
- *
- * @hide until we finalize these APIs
+ * Sets the bounds to which the hotspot is constrained, if they should be
+ * different from the drawable bounds.
+ *
+ * @param left
+ * @param top
+ * @param right
+ * @param bottom
*/
public void setHotspotBounds(int left, int top, int right, int bottom) {}
/**
* Whether this drawable requests projection.
*
- * @hide until we finalize these APIs
+ * @hide magic!
*/
public boolean isProjected() {
return false;
@@ -1047,8 +1020,8 @@ public abstract class Drawable {
drawable = new LayerDrawable();
} else if (name.equals("transition")) {
drawable = new TransitionDrawable();
- } else if (name.equals("touch-feedback")) {
- drawable = new TouchFeedbackDrawable();
+ } else if (name.equals("ripple")) {
+ drawable = new RippleDrawable();
} else if (name.equals("color")) {
drawable = new ColorDrawable();
} else if (name.equals("shape")) {
diff --git a/graphics/java/android/graphics/drawable/DrawableContainer.java b/graphics/java/android/graphics/drawable/DrawableContainer.java
index 08fc99d..ec5c6c6 100644
--- a/graphics/java/android/graphics/drawable/DrawableContainer.java
+++ b/graphics/java/android/graphics/drawable/DrawableContainer.java
@@ -238,35 +238,13 @@ public class DrawableContainer extends Drawable implements Drawable.Callback {
}
@Override
- public void setHotspot(int key, float x, float y) {
+ public void setHotspot(float x, float y) {
if (mCurrDrawable != null) {
- mCurrDrawable.setHotspot(key, x, y);
+ mCurrDrawable.setHotspot(x, y);
}
}
@Override
- public void removeHotspot(int key) {
- if (mCurrDrawable != null) {
- mCurrDrawable.removeHotspot(key);
- }
- }
-
- @Override
- public void clearHotspots() {
- if (mCurrDrawable != null) {
- mCurrDrawable.clearHotspots();
- }
- }
-
- @Override
- public boolean supportsHotspots() {
- if (mCurrDrawable != null) {
- return mCurrDrawable.supportsHotspots();
- }
- return false;
- }
-
- @Override
protected boolean onStateChange(int[] state) {
if (mLastDrawable != null) {
return mLastDrawable.setState(state);
diff --git a/graphics/java/android/graphics/drawable/DrawableWrapper.java b/graphics/java/android/graphics/drawable/DrawableWrapper.java
deleted file mode 100644
index 6ab33f8..0000000
--- a/graphics/java/android/graphics/drawable/DrawableWrapper.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.graphics.drawable;
-
-import android.content.res.Resources;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.Rect;
-import android.graphics.Xfermode;
-
-/**
- * A Drawable that wraps another Drawable.
- */
-public class DrawableWrapper extends Drawable implements Drawable.Callback {
- private WrapperState mWrapperState;
-
- /** Local drawable backed by its own constant state. */
- private Drawable mWrappedDrawable;
-
- private boolean mMutated;
-
- /** @hide */
- @Override
- public boolean isProjected() {
- return mWrappedDrawable.isProjected();
- }
-
- @Override
- public void setAutoMirrored(boolean mirrored) {
- mWrappedDrawable.setAutoMirrored(mirrored);
- }
-
- @Override
- public boolean isAutoMirrored() {
- return mWrappedDrawable.isAutoMirrored();
- }
-
- @Override
- public int getMinimumWidth() {
- return mWrappedDrawable.getMinimumWidth();
- }
-
- @Override
- public int getMinimumHeight() {
- return mWrappedDrawable.getMinimumHeight();
- }
-
- @Override
- public int getIntrinsicWidth() {
- return mWrappedDrawable.getIntrinsicWidth();
- }
-
- @Override
- public int getIntrinsicHeight() {
- return mWrappedDrawable.getIntrinsicHeight();
- }
-
- @Override
- public Drawable getCurrent() {
- return mWrappedDrawable.getCurrent();
- }
-
- @Override
- public void invalidateDrawable(Drawable who) {
- final Callback callback = getCallback();
- if (callback != null) {
- callback.invalidateDrawable(this);
- }
- }
-
- @Override
- public void scheduleDrawable(Drawable who, Runnable what, long when) {
- final Callback callback = getCallback();
- if (callback != null) {
- callback.scheduleDrawable(this, what, when);
- }
- }
-
- @Override
- public void unscheduleDrawable(Drawable who, Runnable what) {
- final Callback callback = getCallback();
- if (callback != null) {
- callback.unscheduleDrawable(this, what);
- }
- }
-
- @Override
- public void draw(Canvas canvas) {
- mWrappedDrawable.draw(canvas);
- }
-
- @Override
- public int getChangingConfigurations() {
- return mWrappedDrawable.getChangingConfigurations();
- }
-
- @Override
- public boolean getPadding(Rect padding) {
- return mWrappedDrawable.getPadding(padding);
- }
-
- @Override
- public Rect getDirtyBounds() {
- return mWrappedDrawable.getDirtyBounds();
- }
-
- @Override
- public boolean supportsHotspots() {
- return mWrappedDrawable.supportsHotspots();
- }
-
- @Override
- public void setHotspot(int id, float x, float y) {
- mWrappedDrawable.setHotspot(id, x, y);
- }
-
- @Override
- public void removeHotspot(int id) {
- mWrappedDrawable.removeHotspot(id);
- }
-
- @Override
- public void clearHotspots() {
- mWrappedDrawable.clearHotspots();
- }
-
- @Override
- public boolean setVisible(boolean visible, boolean restart) {
- // Must call through to super().
- super.setVisible(visible, restart);
- return mWrappedDrawable.setVisible(visible, restart);
- }
-
- @Override
- public void setAlpha(int alpha) {
- mWrappedDrawable.setAlpha(alpha);
- }
-
- @Override
- public int getAlpha() {
- return mWrappedDrawable.getAlpha();
- }
-
- /** {@hide} */
- @Override
- public void setLayoutDirection(int layoutDirection) {
- mWrappedDrawable.setLayoutDirection(layoutDirection);
- }
-
- /** {@hide} */
- @Override
- public int getLayoutDirection() {
- return mWrappedDrawable.getLayoutDirection();
- }
-
- @Override
- public void setColorFilter(ColorFilter cf) {
- mWrappedDrawable.setColorFilter(cf);
- }
-
- @Override
- public ColorFilter getColorFilter() {
- return mWrappedDrawable.getColorFilter();
- }
-
- @Override
- public void setFilterBitmap(boolean filter) {
- mWrappedDrawable.setFilterBitmap(filter);
- }
-
- @Override
- public void setXfermode(Xfermode mode) {
- mWrappedDrawable.setXfermode(mode);
- }
-
- @Override
- public int getOpacity() {
- return mWrappedDrawable.getOpacity();
- }
-
- @Override
- public boolean isStateful() {
- return mWrappedDrawable.isStateful();
- }
-
- @Override
- public final boolean setState(int[] stateSet) {
- return super.setState(stateSet);
- }
-
- @Override
- public final int[] getState() {
- return super.getState();
- }
-
- @Override
- protected boolean onStateChange(int[] state) {
- // Don't override setState(), getState().
- return mWrappedDrawable.setState(state);
- }
-
- @Override
- protected boolean onLevelChange(int level) {
- // Don't override setLevel(), getLevel().
- return mWrappedDrawable.setLevel(level);
- }
-
- @Override
- public final void setBounds(int left, int top, int right, int bottom) {
- super.setBounds(left, top, right, bottom);
- }
-
- @Override
- public final void setBounds(Rect bounds) {
- super.setBounds(bounds);
- }
-
- @Override
- protected void onBoundsChange(Rect bounds) {
- // Don't override setBounds(), getBounds().
- mWrappedDrawable.setBounds(bounds);
- }
-
- protected void setConstantState(WrapperState wrapperState, Resources res) {
- mWrapperState = wrapperState;
-
- // Load a new drawable from the constant state.
- if (wrapperState == null || wrapperState.mWrappedConstantState == null) {
- mWrappedDrawable = null;
- } else if (res != null) {
- mWrappedDrawable = wrapperState.mWrappedConstantState.newDrawable(res);
- } else {
- mWrappedDrawable = wrapperState.mWrappedConstantState.newDrawable();
- }
- }
-
- @Override
- public ConstantState getConstantState() {
- return mWrapperState;
- }
-
- @Override
- public Drawable mutate() {
- if (!mMutated) {
- mWrappedDrawable = mWrappedDrawable.mutate();
- mMutated = true;
- }
- return this;
- }
-
- /**
- * Sets the wrapped drawable and update the constant state.
- *
- * @param drawable
- * @param res
- */
- protected final void setDrawable(Drawable drawable, Resources res) {
- if (mWrappedDrawable != null) {
- mWrappedDrawable.setCallback(null);
- }
-
- mWrappedDrawable = drawable;
-
- if (drawable != null) {
- drawable.setCallback(this);
-
- mWrapperState.mWrappedConstantState = drawable.getConstantState();
- } else {
- mWrapperState.mWrappedConstantState = null;
- }
- }
-
- protected final Drawable getDrawable() {
- return mWrappedDrawable;
- }
-
- public static abstract class WrapperState extends ConstantState {
- ConstantState mWrappedConstantState;
-
- WrapperState(WrapperState orig) {
- if (orig != null) {
- mWrappedConstantState = orig.mWrappedConstantState;
- }
- }
-
- @Override
- public int getChangingConfigurations() {
- return mWrappedConstantState.getChangingConfigurations();
- }
- }
-}
diff --git a/graphics/java/android/graphics/drawable/InsetDrawable.java b/graphics/java/android/graphics/drawable/InsetDrawable.java
index 9384caf..3749339 100644
--- a/graphics/java/android/graphics/drawable/InsetDrawable.java
+++ b/graphics/java/android/graphics/drawable/InsetDrawable.java
@@ -131,6 +131,7 @@ public class InsetDrawable extends Drawable implements Drawable.Callback
// overrides from Drawable.Callback
+ @Override
public void invalidateDrawable(Drawable who) {
final Callback callback = getCallback();
if (callback != null) {
@@ -138,6 +139,7 @@ public class InsetDrawable extends Drawable implements Drawable.Callback
}
}
+ @Override
public void scheduleDrawable(Drawable who, Runnable what, long when) {
final Callback callback = getCallback();
if (callback != null) {
@@ -145,6 +147,7 @@ public class InsetDrawable extends Drawable implements Drawable.Callback
}
}
+ @Override
public void unscheduleDrawable(Drawable who, Runnable what) {
final Callback callback = getCallback();
if (callback != null) {
@@ -184,23 +187,8 @@ public class InsetDrawable extends Drawable implements Drawable.Callback
}
@Override
- public boolean supportsHotspots() {
- return mInsetState.mDrawable.supportsHotspots();
- }
-
- @Override
- public void setHotspot(int id, float x, float y) {
- mInsetState.mDrawable.setHotspot(id, x, y);
- }
-
- @Override
- public void removeHotspot(int id) {
- mInsetState.mDrawable.removeHotspot(id);
- }
-
- @Override
- public void clearHotspots() {
- mInsetState.mDrawable.clearHotspots();
+ public void setHotspot(float x, float y) {
+ mInsetState.mDrawable.setHotspot(x, y);
}
@Override
diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java
index 7847aad..373d894 100644
--- a/graphics/java/android/graphics/drawable/LayerDrawable.java
+++ b/graphics/java/android/graphics/drawable/LayerDrawable.java
@@ -569,42 +569,11 @@ public class LayerDrawable extends Drawable implements Drawable.Callback {
}
@Override
- public boolean supportsHotspots() {
+ public void setHotspot(float x, float y) {
final ChildDrawable[] array = mLayerState.mChildren;
final int N = mLayerState.mNum;
for (int i = 0; i < N; i++) {
- if (array[i].mDrawable.supportsHotspots()) {
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public void setHotspot(int id, float x, float y) {
- final ChildDrawable[] array = mLayerState.mChildren;
- final int N = mLayerState.mNum;
- for (int i = 0; i < N; i++) {
- array[i].mDrawable.setHotspot(id, x, y);
- }
- }
-
- @Override
- public void removeHotspot(int id) {
- final ChildDrawable[] array = mLayerState.mChildren;
- final int N = mLayerState.mNum;
- for (int i = 0; i < N; i++) {
- array[i].mDrawable.removeHotspot(id);
- }
- }
-
- @Override
- public void clearHotspots() {
- final ChildDrawable[] array = mLayerState.mChildren;
- final int N = mLayerState.mNum;
- for (int i = 0; i < N; i++) {
- array[i].mDrawable.clearHotspots();
+ array[i].mDrawable.setHotspot(x, y);
}
}
diff --git a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index a55a4b2..6776e66 100644
--- a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -22,6 +22,7 @@ import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
+import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.PointF;
@@ -44,7 +45,7 @@ import java.io.IOException;
/**
* Drawable that shows a ripple effect in response to state changes. The
* anchoring position of the ripple for a given state may be specified by
- * calling {@link #setHotspot(int, float, float)} with the corresponding state
+ * calling {@link #setHotspot(float, float)} with the corresponding state
* attribute identifier.
* <p>
* A touch feedback drawable may contain multiple child layers, including a
@@ -56,19 +57,19 @@ import java.io.IOException;
* <p>
* If no mask layer is set, the ripple effect is simply blended onto the
* composite of the child layers using the specified
- * {@link android.R.styleable#TouchFeedbackDrawable_tintMode}.
+ * {@link android.R.styleable#RippleDrawable_tintMode}.
* <p>
* If no child layers or mask is specified and the ripple is set as a View
* background, the ripple will be blended onto the first available parent
* background within the View's hierarchy using the specified
- * {@link android.R.styleable#TouchFeedbackDrawable_tintMode}. In this case, the
+ * {@link android.R.styleable#RippleDrawable_tintMode}. In this case, the
* drawing region may extend outside of the Drawable bounds.
*
* @attr ref android.R.styleable#DrawableStates_state_focused
* @attr ref android.R.styleable#DrawableStates_state_pressed
*/
-public class TouchFeedbackDrawable extends LayerDrawable {
- private static final String LOG_TAG = TouchFeedbackDrawable.class.getSimpleName();
+public class RippleDrawable extends LayerDrawable {
+ private static final String LOG_TAG = RippleDrawable.class.getSimpleName();
private static final PorterDuffXfermode DST_IN = new PorterDuffXfermode(Mode.DST_IN);
private static final PorterDuffXfermode DST_ATOP = new PorterDuffXfermode(Mode.DST_ATOP);
private static final PorterDuffXfermode SRC_ATOP = new PorterDuffXfermode(Mode.SRC_ATOP);
@@ -88,17 +89,17 @@ public class TouchFeedbackDrawable extends LayerDrawable {
/** Current dirty bounds, union of current and previous drawing bounds. */
private final Rect mDirtyBounds = new Rect();
- private final TouchFeedbackState mState;
+ private final RippleState mState;
/**
* Lazily-created map of pending hotspot locations. These may be modified by
- * calls to {@link #setHotspot(int, float, float)}.
+ * calls to {@link #setHotspot(float, float)}.
*/
private SparseArray<PointF> mPendingHotspots;
/**
* Lazily-created map of active hotspot locations. These may be modified by
- * calls to {@link #setHotspot(int, float, float)}.
+ * calls to {@link #setHotspot(float, float)}.
*/
private SparseArray<Ripple> mActiveHotspots;
@@ -121,8 +122,18 @@ public class TouchFeedbackDrawable extends LayerDrawable {
/** Whether bounds are being overridden. */
private boolean mOverrideBounds;
- TouchFeedbackDrawable() {
- this(new TouchFeedbackState(null, null, null), null, null);
+ RippleDrawable() {
+ this(new RippleState(null, null, null), null, null);
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+
}
@Override
@@ -233,7 +244,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme)
throws XmlPullParserException, IOException {
final TypedArray a = obtainAttributes(
- r, theme, attrs, R.styleable.TouchFeedbackDrawable);
+ r, theme, attrs, R.styleable.RippleDrawable);
updateStateFromTypedArray(a);
a.recycle();
@@ -267,22 +278,22 @@ public class TouchFeedbackDrawable extends LayerDrawable {
* Initializes the constant state from the values in the typed array.
*/
private void updateStateFromTypedArray(TypedArray a) {
- final TouchFeedbackState state = mState;
+ final RippleState state = mState;
// Extract the theme attributes, if any.
state.mTouchThemeAttrs = a.extractThemeAttrs();
- final ColorStateList tint = a.getColorStateList(R.styleable.TouchFeedbackDrawable_tint);
+ final ColorStateList tint = a.getColorStateList(R.styleable.RippleDrawable_tint);
if (tint != null) {
mState.mTint = tint;
}
- final int tintMode = a.getInt(R.styleable.TouchFeedbackDrawable_tintMode, -1);
+ final int tintMode = a.getInt(R.styleable.RippleDrawable_tintMode, -1);
if (tintMode != -1) {
mState.setTintMode(Drawable.parseTintMode(tintMode, Mode.SRC_ATOP));
}
- mState.mPinned = a.getBoolean(R.styleable.TouchFeedbackDrawable_pinned, mState.mPinned);
+ mState.mPinned = a.getBoolean(R.styleable.RippleDrawable_pinned, mState.mPinned);
}
/**
@@ -301,13 +312,13 @@ public class TouchFeedbackDrawable extends LayerDrawable {
public void applyTheme(Theme t) {
super.applyTheme(t);
- final TouchFeedbackState state = mState;
+ final RippleState state = mState;
if (state == null || state.mTouchThemeAttrs == null) {
return;
}
final TypedArray a = t.resolveAttributes(state.mTouchThemeAttrs,
- R.styleable.TouchFeedbackDrawable);
+ R.styleable.RippleDrawable);
updateStateFromTypedArray(a);
a.recycle();
}
@@ -318,17 +329,14 @@ public class TouchFeedbackDrawable extends LayerDrawable {
}
@Override
- public boolean supportsHotspots() {
- return true;
- }
-
- @Override
- public void setHotspot(int id, float x, float y) {
+ public void setHotspot(float x, float y) {
if (mState.mPinned && !circleContains(mHotspotBounds, x, y)) {
x = mHotspotBounds.exactCenterX();
y = mHotspotBounds.exactCenterY();
}
+ // TODO: We should only have a single pending/active hotspot.
+ final int id = R.attr.state_pressed;
final int[] stateSet = getState();
if (!Arrays.contains(stateSet, id)) {
// The hotspot is not active, so just modify the pending location.
@@ -423,8 +431,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
mActiveHotspots.put(id, newRipple);
}
- @Override
- public void removeHotspot(int id) {
+ private void removeHotspot(int id) {
if (mActiveHotspots == null) {
return;
}
@@ -437,8 +444,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
}
}
- @Override
- public void clearHotspots() {
+ private void clearHotspots() {
if (mActiveHotspots != null) {
mActiveHotspots.clear();
}
@@ -632,7 +638,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
return mState;
}
- static class TouchFeedbackState extends LayerState {
+ static class RippleState extends LayerState {
int[] mTouchThemeAttrs;
ColorStateList mTint = null;
PorterDuffXfermode mTintXfermode = SRC_ATOP;
@@ -640,8 +646,8 @@ public class TouchFeedbackDrawable extends LayerDrawable {
Drawable mMask;
boolean mPinned = false;
- public TouchFeedbackState(
- TouchFeedbackState orig, TouchFeedbackDrawable owner, Resources res) {
+ public RippleState(
+ RippleState orig, RippleDrawable owner, Resources res) {
super(orig, owner, res);
if (orig != null) {
@@ -655,7 +661,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
}
public void setTintMode(Mode mode) {
- final Mode invertedMode = TouchFeedbackState.invertPorterDuffMode(mode);
+ final Mode invertedMode = RippleState.invertPorterDuffMode(mode);
mTintXfermodeInverse = new PorterDuffXfermode(invertedMode);
mTintXfermode = new PorterDuffXfermode(mode);
}
@@ -675,17 +681,17 @@ public class TouchFeedbackDrawable extends LayerDrawable {
@Override
public Drawable newDrawable() {
- return new TouchFeedbackDrawable(this, null, null);
+ return new RippleDrawable(this, null, null);
}
@Override
public Drawable newDrawable(Resources res) {
- return new TouchFeedbackDrawable(this, res, null);
+ return new RippleDrawable(this, res, null);
}
@Override
public Drawable newDrawable(Resources res, Theme theme) {
- return new TouchFeedbackDrawable(this, res, theme);
+ return new RippleDrawable(this, res, theme);
}
/**
@@ -716,20 +722,20 @@ public class TouchFeedbackDrawable extends LayerDrawable {
}
}
- private TouchFeedbackDrawable(TouchFeedbackState state, Resources res, Theme theme) {
+ private RippleDrawable(RippleState state, Resources res, Theme theme) {
boolean needsTheme = false;
- final TouchFeedbackState ns;
+ final RippleState ns;
if (theme != null && state != null && state.canApplyTheme()) {
- ns = new TouchFeedbackState(state, this, res);
+ ns = new RippleState(state, this, res);
needsTheme = true;
} else if (state == null) {
- ns = new TouchFeedbackState(null, this, res);
+ ns = new RippleState(null, this, res);
} else {
// We always need a new state since child drawables contain local
// state but live within the parent's constant state.
// TODO: Move child drawables into local state.
- ns = new TouchFeedbackState(state, this, res);
+ ns = new RippleState(state, this, res);
}
if (res != null) {