discord-jadx/app/src/main/java/com/discord/views/CheckableImageView.java

57 lines
2.0 KiB
Java

package com.discord.views;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.ImageView;
import androidx.appcompat.widget.AppCompatImageView;
import com.discord.R;
import d0.z.d.m;
/* compiled from: CheckableImageView.kt */
public final class CheckableImageView extends AppCompatImageView implements Checkable {
public final int[] i = {16842912};
public boolean j;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public CheckableImageView(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
m.checkNotNullParameter(context, "context");
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.a.CheckableImageView, 0, 0);
m.checkNotNullExpressionValue(obtainStyledAttributes, "context.obtainStyledAttr…CheckableImageView, 0, 0)");
try {
this.j = obtainStyledAttributes.getBoolean(0, this.j);
} finally {
obtainStyledAttributes.recycle();
}
}
}
@Override // android.widget.Checkable
public boolean isChecked() {
return this.j;
}
@Override // android.widget.ImageView, android.view.View
public int[] onCreateDrawableState(int i) {
int[] onCreateDrawableState = super.onCreateDrawableState(i + 1);
m.checkNotNullExpressionValue(onCreateDrawableState, "super.onCreateDrawableState(extraSpace + 1)");
if (this.j) {
ImageView.mergeDrawableStates(onCreateDrawableState, this.i);
}
return onCreateDrawableState;
}
@Override // android.widget.Checkable
public void setChecked(boolean z2) {
this.j = z2;
refreshDrawableState();
}
@Override // android.widget.Checkable
public void toggle() {
setChecked(!this.j);
}
}