diff --git a/app/src/main/java/com/hippo/effect/ripple/RippleOldDrawable.java b/app/src/main/java/com/hippo/effect/ripple/RippleDrawable.java similarity index 98% rename from app/src/main/java/com/hippo/effect/ripple/RippleOldDrawable.java rename to app/src/main/java/com/hippo/effect/ripple/RippleDrawable.java index ed7a77a5a..b9aaa11f8 100644 --- a/app/src/main/java/com/hippo/effect/ripple/RippleOldDrawable.java +++ b/app/src/main/java/com/hippo/effect/ripple/RippleDrawable.java @@ -76,9 +76,9 @@ import java.util.Arrays; * * @attr ref android.R.styleable#RippleDrawable_color */ -public class RippleOldDrawable extends Drawable implements RippleOwner, Hotspotable { +public class RippleDrawable extends Drawable implements RippleOwner, Hotspotable { @SuppressWarnings("unused") - private static final String TAG = RippleOldDrawable.class.getSimpleName(); + private static final String TAG = RippleDrawable.class.getSimpleName(); /** The maximum number of ripples supported. */ private static final int MAX_RIPPLES = 10; @@ -132,7 +132,7 @@ public class RippleOldDrawable extends Drawable implements RippleOwner, Hotspota private final Drawable mContent; - RippleOldDrawable(ColorStateList color, Drawable content) { + RippleDrawable(ColorStateList color, Drawable content) { setColor(color); mContent = content; diff --git a/app/src/main/java/com/hippo/effect/ripple/RippleSalon.java b/app/src/main/java/com/hippo/effect/ripple/RippleSalon.java index 066ce4f31..34cca4667 100644 --- a/app/src/main/java/com/hippo/effect/ripple/RippleSalon.java +++ b/app/src/main/java/com/hippo/effect/ripple/RippleSalon.java @@ -21,7 +21,6 @@ import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; -import android.graphics.drawable.RippleDrawable; import android.os.Build; import android.view.View; @@ -47,17 +46,18 @@ public final class RippleSalon { addRipple(v, color, v.getBackground()); } - @SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void addRipple(View v, ColorStateList color, Drawable content) { if (USE_OLD_RIPPLE) { - RippleOldDrawable rippleOldDrawable = new RippleOldDrawable(color, content); - v.setOnTouchListener(new HotspotTouchHelper(rippleOldDrawable)); - v.setBackgroundDrawable(rippleOldDrawable); + RippleDrawable rippleDrawable = new RippleDrawable(color, content); + v.setOnTouchListener(new HotspotTouchHelper(rippleDrawable)); + //noinspection deprecation + v.setBackgroundDrawable(rippleDrawable); } else { - RippleDrawable rippleDrawable = new RippleDrawable(color, content, MASK); + android.graphics.drawable.RippleDrawable rippleDrawable = + new android.graphics.drawable.RippleDrawable(color, content, MASK); + //noinspection deprecation v.setBackgroundDrawable(rippleDrawable); } } - }