69 lines
2.8 KiB
Java
69 lines
2.8 KiB
Java
|
package com.google.android.material.textview;
|
||
|
|
||
|
import android.R;
|
||
|
import android.content.Context;
|
||
|
import android.content.res.Resources;
|
||
|
import android.content.res.TypedArray;
|
||
|
import android.util.AttributeSet;
|
||
|
import androidx.appcompat.widget.AppCompatTextView;
|
||
|
import o.C14739fyr;
|
||
|
import o.C17052tZT;
|
||
|
import o.TZc;
|
||
|
import o.hdZ;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class MaterialTextView extends AppCompatTextView {
|
||
|
public MaterialTextView(Context context) {
|
||
|
this(context, null);
|
||
|
}
|
||
|
|
||
|
public MaterialTextView(Context context, AttributeSet attributeSet) {
|
||
|
this(context, attributeSet, R.attr.textViewStyle);
|
||
|
}
|
||
|
|
||
|
public MaterialTextView(Context context, AttributeSet attributeSet, int i) {
|
||
|
super(hdZ.MQ_(context, attributeSet, i, 0), attributeSet, i);
|
||
|
Context context2 = getContext();
|
||
|
if (TZc.b(context2, C17052tZT.IeS.textAppearanceLineHeightEnabled, true)) {
|
||
|
Resources.Theme theme = context2.getTheme();
|
||
|
TypedArray obtainStyledAttributes = theme.obtainStyledAttributes(attributeSet, C17052tZT.jNh.MaterialTextView, i, 0);
|
||
|
int MJ_ = MJ_(context2, obtainStyledAttributes, C17052tZT.jNh.MaterialTextView_android_lineHeight, C17052tZT.jNh.MaterialTextView_lineHeight);
|
||
|
obtainStyledAttributes.recycle();
|
||
|
if (MJ_ != -1) {
|
||
|
return;
|
||
|
}
|
||
|
TypedArray obtainStyledAttributes2 = theme.obtainStyledAttributes(attributeSet, C17052tZT.jNh.MaterialTextView, i, 0);
|
||
|
int resourceId = obtainStyledAttributes2.getResourceId(C17052tZT.jNh.MaterialTextView_android_textAppearance, -1);
|
||
|
obtainStyledAttributes2.recycle();
|
||
|
if (resourceId != -1) {
|
||
|
MI_(theme, resourceId);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // androidx.appcompat.widget.AppCompatTextView, android.widget.TextView
|
||
|
public void setTextAppearance(Context context, int i) {
|
||
|
super.setTextAppearance(context, i);
|
||
|
if (TZc.b(context, C17052tZT.IeS.textAppearanceLineHeightEnabled, true)) {
|
||
|
MI_(context.getTheme(), i);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void MI_(Resources.Theme theme, int i) {
|
||
|
TypedArray obtainStyledAttributes = theme.obtainStyledAttributes(i, C17052tZT.jNh.MaterialTextAppearance);
|
||
|
int MJ_ = MJ_(getContext(), obtainStyledAttributes, C17052tZT.jNh.MaterialTextAppearance_android_lineHeight, C17052tZT.jNh.MaterialTextAppearance_lineHeight);
|
||
|
obtainStyledAttributes.recycle();
|
||
|
if (MJ_ >= 0) {
|
||
|
setLineHeight(MJ_);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static int MJ_(Context context, TypedArray typedArray, int... iArr) {
|
||
|
int i = -1;
|
||
|
for (int i2 = 0; i2 < iArr.length && i < 0; i2++) {
|
||
|
i = C14739fyr.Kw_(context, typedArray, iArr[i2]);
|
||
|
}
|
||
|
return i;
|
||
|
}
|
||
|
}
|