47 lines
1.7 KiB
Java
47 lines
1.7 KiB
Java
package androidx.core.graphics.drawable;
|
|
|
|
import android.content.res.ColorStateList;
|
|
import android.content.res.Resources;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.drawable.Drawable;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
public final class WrappedDrawableState extends Drawable.ConstantState {
|
|
public int mChangingConfigurations;
|
|
public Drawable.ConstantState mDrawableState;
|
|
public ColorStateList mTint = null;
|
|
public PorterDuff.Mode mTintMode = WrappedDrawableApi14.DEFAULT_TINT_MODE;
|
|
|
|
public WrappedDrawableState(@Nullable WrappedDrawableState wrappedDrawableState) {
|
|
if (wrappedDrawableState != null) {
|
|
this.mChangingConfigurations = wrappedDrawableState.mChangingConfigurations;
|
|
this.mDrawableState = wrappedDrawableState.mDrawableState;
|
|
this.mTint = wrappedDrawableState.mTint;
|
|
this.mTintMode = wrappedDrawableState.mTintMode;
|
|
}
|
|
}
|
|
|
|
public boolean canConstantState() {
|
|
return this.mDrawableState != null;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public int getChangingConfigurations() {
|
|
int i = this.mChangingConfigurations;
|
|
Drawable.ConstantState constantState = this.mDrawableState;
|
|
return i | (constantState != null ? constantState.getChangingConfigurations() : 0);
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
@NonNull
|
|
public Drawable newDrawable() {
|
|
return newDrawable(null);
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
@NonNull
|
|
public Drawable newDrawable(@Nullable Resources resources) {
|
|
return new WrappedDrawableApi21(this, resources);
|
|
}
|
|
}
|