discord-jadx/app/src/main/java/com/discord/views/CheckableImageView.java
2021-12-02 19:53:44 +01:00

56 lines
2 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[] j = {16842912};
public boolean k;
/* 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.k = obtainStyledAttributes.getBoolean(0, this.k);
} finally {
obtainStyledAttributes.recycle();
}
}
}
@Override // android.widget.Checkable
public boolean isChecked() {
return this.k;
}
@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.k) {
ImageView.mergeDrawableStates(onCreateDrawableState, this.j);
}
return onCreateDrawableState;
}
@Override // android.widget.Checkable
public void setChecked(boolean z2) {
this.k = z2;
refreshDrawableState();
}
@Override // android.widget.Checkable
public void toggle() {
setChecked(!this.k);
}
}