87 lines
3.6 KiB
Java
87 lines
3.6 KiB
Java
package o;
|
|
|
|
import android.content.res.ColorStateList;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.view.View;
|
|
import android.widget.ImageView;
|
|
import androidx.core.view.ViewCompat;
|
|
import com.google.android.material.internal.CheckableImageButton;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import java.util.Arrays;
|
|
|
|
/* renamed from: o.kAW, reason: case insensitive filesystem */
|
|
/* loaded from: classes2.dex */
|
|
public final class C15977kAW {
|
|
public static void Mr_(CheckableImageButton checkableImageButton, View.OnLongClickListener onLongClickListener) {
|
|
boolean B = ViewCompat.B(checkableImageButton);
|
|
boolean z = onLongClickListener != null;
|
|
boolean z2 = B || z;
|
|
checkableImageButton.setFocusable(z2);
|
|
checkableImageButton.setClickable(B);
|
|
checkableImageButton.setPressable(B);
|
|
checkableImageButton.setLongClickable(z);
|
|
ViewCompat.g(checkableImageButton, z2 ? 1 : 2);
|
|
}
|
|
|
|
public static void Mo_(TextInputLayout textInputLayout, CheckableImageButton checkableImageButton, ColorStateList colorStateList, PorterDuff.Mode mode) {
|
|
Drawable drawable = checkableImageButton.getDrawable();
|
|
if (drawable != null) {
|
|
drawable = Tlu.pI_(drawable).mutate();
|
|
if (colorStateList != null && colorStateList.isStateful()) {
|
|
Tlu.pF_(drawable, ColorStateList.valueOf(colorStateList.getColorForState(d(textInputLayout, checkableImageButton), colorStateList.getDefaultColor())));
|
|
} else {
|
|
Tlu.pF_(drawable, colorStateList);
|
|
}
|
|
if (mode != null) {
|
|
Tlu.pG_(drawable, mode);
|
|
}
|
|
}
|
|
if (checkableImageButton.getDrawable() != drawable) {
|
|
checkableImageButton.setImageDrawable(drawable);
|
|
}
|
|
}
|
|
|
|
public static void Mq_(TextInputLayout textInputLayout, CheckableImageButton checkableImageButton, ColorStateList colorStateList) {
|
|
Drawable drawable = checkableImageButton.getDrawable();
|
|
if (checkableImageButton.getDrawable() == null || colorStateList == null || !colorStateList.isStateful()) {
|
|
return;
|
|
}
|
|
int colorForState = colorStateList.getColorForState(d(textInputLayout, checkableImageButton), colorStateList.getDefaultColor());
|
|
Drawable mutate = Tlu.pI_(drawable).mutate();
|
|
Tlu.pF_(mutate, ColorStateList.valueOf(colorForState));
|
|
checkableImageButton.setImageDrawable(mutate);
|
|
}
|
|
|
|
private static int[] d(TextInputLayout textInputLayout, CheckableImageButton checkableImageButton) {
|
|
int[] drawableState = textInputLayout.getDrawableState();
|
|
int[] drawableState2 = checkableImageButton.getDrawableState();
|
|
int length = drawableState.length;
|
|
int[] copyOf = Arrays.copyOf(drawableState, drawableState.length + drawableState2.length);
|
|
System.arraycopy(drawableState2, 0, copyOf, length, drawableState2.length);
|
|
return copyOf;
|
|
}
|
|
|
|
public static ImageView.ScaleType Mp_(int i) {
|
|
if (i == 0) {
|
|
return ImageView.ScaleType.FIT_XY;
|
|
}
|
|
if (i == 1) {
|
|
return ImageView.ScaleType.FIT_START;
|
|
}
|
|
if (i == 2) {
|
|
return ImageView.ScaleType.FIT_CENTER;
|
|
}
|
|
if (i == 3) {
|
|
return ImageView.ScaleType.FIT_END;
|
|
}
|
|
if (i == 5) {
|
|
return ImageView.ScaleType.CENTER_CROP;
|
|
}
|
|
if (i == 6) {
|
|
return ImageView.ScaleType.CENTER_INSIDE;
|
|
}
|
|
return ImageView.ScaleType.CENTER;
|
|
}
|
|
}
|