mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
136 lines
5 KiB
Java
136 lines
5 KiB
Java
|
package com.google.android.material.ripple;
|
||
|
|
||
|
import android.content.res.ColorStateList;
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.ColorFilter;
|
||
|
import android.graphics.PorterDuff;
|
||
|
import android.graphics.Rect;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import androidx.core.graphics.drawable.TintAwareDrawable;
|
||
|
import com.google.android.material.shape.MaterialShapeDrawable;
|
||
|
import com.google.android.material.shape.ShapeAppearanceModel;
|
||
|
import com.google.android.material.shape.Shapeable;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class RippleDrawableCompat extends Drawable implements Shapeable, TintAwareDrawable {
|
||
|
private RippleDrawableCompatState drawableState;
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public Drawable.ConstantState getConstantState() {
|
||
|
return this.drawableState;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public boolean isStateful() {
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public RippleDrawableCompat(ShapeAppearanceModel shapeAppearanceModel) {
|
||
|
this(new RippleDrawableCompatState(new MaterialShapeDrawable(shapeAppearanceModel)));
|
||
|
}
|
||
|
|
||
|
private RippleDrawableCompat(RippleDrawableCompatState rippleDrawableCompatState) {
|
||
|
this.drawableState = rippleDrawableCompatState;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||
|
public void setTint(int i) {
|
||
|
this.drawableState.delegate.setTint(i);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||
|
public void setTintMode(PorterDuff.Mode mode) {
|
||
|
this.drawableState.delegate.setTintMode(mode);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
||
|
public void setTintList(ColorStateList colorStateList) {
|
||
|
this.drawableState.delegate.setTintList(colorStateList);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.material.shape.Shapeable
|
||
|
public void setShapeAppearanceModel(ShapeAppearanceModel shapeAppearanceModel) {
|
||
|
this.drawableState.delegate.setShapeAppearanceModel(shapeAppearanceModel);
|
||
|
}
|
||
|
|
||
|
@Override // com.google.android.material.shape.Shapeable
|
||
|
public ShapeAppearanceModel getShapeAppearanceModel() {
|
||
|
return this.drawableState.delegate.getShapeAppearanceModel();
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
protected boolean onStateChange(int[] iArr) {
|
||
|
boolean onStateChange = super.onStateChange(iArr);
|
||
|
if (this.drawableState.delegate.setState(iArr)) {
|
||
|
onStateChange = true;
|
||
|
}
|
||
|
boolean shouldDrawRippleCompat = RippleUtils.shouldDrawRippleCompat(iArr);
|
||
|
if (this.drawableState.shouldDrawDelegate == shouldDrawRippleCompat) {
|
||
|
return onStateChange;
|
||
|
}
|
||
|
this.drawableState.shouldDrawDelegate = shouldDrawRippleCompat;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public void draw(Canvas canvas) {
|
||
|
if (this.drawableState.shouldDrawDelegate) {
|
||
|
this.drawableState.delegate.draw(canvas);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
protected void onBoundsChange(Rect rect) {
|
||
|
super.onBoundsChange(rect);
|
||
|
this.drawableState.delegate.setBounds(rect);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public RippleDrawableCompat mutate() {
|
||
|
this.drawableState = new RippleDrawableCompatState(this.drawableState);
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public void setAlpha(int i) {
|
||
|
this.drawableState.delegate.setAlpha(i);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public void setColorFilter(ColorFilter colorFilter) {
|
||
|
this.drawableState.delegate.setColorFilter(colorFilter);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public int getOpacity() {
|
||
|
return this.drawableState.delegate.getOpacity();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public static final class RippleDrawableCompatState extends Drawable.ConstantState {
|
||
|
MaterialShapeDrawable delegate;
|
||
|
boolean shouldDrawDelegate;
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
||
|
public int getChangingConfigurations() {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
public RippleDrawableCompatState(MaterialShapeDrawable materialShapeDrawable) {
|
||
|
this.delegate = materialShapeDrawable;
|
||
|
this.shouldDrawDelegate = false;
|
||
|
}
|
||
|
|
||
|
public RippleDrawableCompatState(RippleDrawableCompatState rippleDrawableCompatState) {
|
||
|
this.delegate = (MaterialShapeDrawable) rippleDrawableCompatState.delegate.getConstantState().newDrawable();
|
||
|
this.shouldDrawDelegate = rippleDrawableCompatState.shouldDrawDelegate;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
||
|
public RippleDrawableCompat newDrawable() {
|
||
|
return new RippleDrawableCompat(new RippleDrawableCompatState(this));
|
||
|
}
|
||
|
}
|
||
|
}
|