CrackMe.apk
Download file
package com.google.android.material.resources;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.os.Handler;
import android.text.TextPaint;
import android.util.Log;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.view.ViewCompat;
import com.google.android.material.R;
public class TextAppearance {
private static final String TAG = "TextAppearance";
private static final int TYPEFACE_MONOSPACE = 3;
private static final int TYPEFACE_SANS = 1;
private static final int TYPEFACE_SERIF = 2;
/* access modifiers changed from: private */
public Typeface font;
public final String fontFamily;
private final int fontFamilyResourceId;
/* access modifiers changed from: private */
public boolean fontResolved = false;
public final ColorStateList shadowColor;
public final float shadowDx;
public final float shadowDy;
public final float shadowRadius;
public final boolean textAllCaps;
public final ColorStateList textColor;
public final ColorStateList textColorHint;
public final ColorStateList textColorLink;
public final float textSize;
public final int textStyle;
public final int typeface;
public TextAppearance(Context context, int i) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(i, R.styleable.TextAppearance);
this.textSize = obtainStyledAttributes.getDimension(R.styleable.TextAppearance_android_textSize, 0.0f);
this.textColor = MaterialResources.getColorStateList(context, obtainStyledAttributes, R.styleable.TextAppearance_android_textColor);
this.textColorHint = MaterialResources.getColorStateList(context, obtainStyledAttributes, R.styleable.TextAppearance_android_textColorHint);
this.textColorLink = MaterialResources.getColorStateList(context, obtainStyledAttributes, R.styleable.TextAppearance_android_textColorLink);
this.textStyle = obtainStyledAttributes.getInt(R.styleable.TextAppearance_android_textStyle, 0);
this.typeface = obtainStyledAttributes.getInt(R.styleable.TextAppearance_android_typeface, 1);
int indexWithValue = MaterialResources.getIndexWithValue(obtainStyledAttributes, R.styleable.TextAppearance_fontFamily, R.styleable.TextAppearance_android_fontFamily);
this.fontFamilyResourceId = obtainStyledAttributes.getResourceId(indexWithValue, 0);
this.fontFamily = obtainStyledAttributes.getString(indexWithValue);
this.textAllCaps = obtainStyledAttributes.getBoolean(R.styleable.TextAppearance_textAllCaps, false);
this.shadowColor = MaterialResources.getColorStateList(context, obtainStyledAttributes, R.styleable.TextAppearance_android_shadowColor);
this.shadowDx = obtainStyledAttributes.getFloat(R.styleable.TextAppearance_android_shadowDx, 0.0f);
this.shadowDy = obtainStyledAttributes.getFloat(R.styleable.TextAppearance_android_shadowDy, 0.0f);
this.shadowRadius = obtainStyledAttributes.getFloat(R.styleable.TextAppearance_android_shadowRadius, 0.0f);
obtainStyledAttributes.recycle();
}
public Typeface getFont(Context context) {
if (this.fontResolved) {
return this.font;
}
if (!context.isRestricted()) {
try {
Typeface font2 = ResourcesCompat.getFont(context, this.fontFamilyResourceId);
this.font = font2;
if (font2 != null) {
this.font = Typeface.create(font2, this.textStyle);
}
} catch (Resources.NotFoundException | UnsupportedOperationException unused) {
} catch (Exception e) {
Log.d(TAG, "Error loading font " + this.fontFamily, e);
}
}
createFallbackFont();
this.fontResolved = true;
return this.font;
}
public void getFontAsync(Context context, final TextAppearanceFontCallback textAppearanceFontCallback) {
if (TextAppearanceConfig.shouldLoadFontSynchronously()) {
getFont(context);
} else {
createFallbackFont();
}
int i = this.fontFamilyResourceId;
if (i == 0) {
this.fontResolved = true;
}
if (this.fontResolved) {
textAppearanceFontCallback.onFontRetrieved(this.font, true);
return;
}
try {
ResourcesCompat.getFont(context, i, new ResourcesCompat.FontCallback() {
public void onFontRetrieved(Typeface typeface) {
TextAppearance textAppearance = TextAppearance.this;
Typeface unused = textAppearance.font = Typeface.create(typeface, textAppearance.textStyle);
boolean unused2 = TextAppearance.this.fontResolved = true;
textAppearanceFontCallback.onFontRetrieved(TextAppearance.this.font, false);
}
public void onFontRetrievalFailed(int i) {
boolean unused = TextAppearance.this.fontResolved = true;
textAppearanceFontCallback.onFontRetrievalFailed(i);
}
}, (Handler) null);
} catch (Resources.NotFoundException unused) {
this.fontResolved = true;
textAppearanceFontCallback.onFontRetrievalFailed(1);
} catch (Exception e) {
Log.d(TAG, "Error loading font " + this.fontFamily, e);
this.fontResolved = true;
textAppearanceFontCallback.onFontRetrievalFailed(-3);
}
}
public void getFontAsync(Context context, final TextPaint textPaint, final TextAppearanceFontCallback textAppearanceFontCallback) {
updateTextPaintMeasureState(textPaint, getFallbackFont());
getFontAsync(context, new TextAppearanceFontCallback() {
public void onFontRetrieved(Typeface typeface, boolean z) {
TextAppearance.this.updateTextPaintMeasureState(textPaint, typeface);
textAppearanceFontCallback.onFontRetrieved(typeface, z);
}
public void onFontRetrievalFailed(int i) {
textAppearanceFontCallback.onFontRetrievalFailed(i);
}
});
}
public Typeface getFallbackFont() {
createFallbackFont();
return this.font;
}
private void createFallbackFont() {
String str;
if (this.font == null && (str = this.fontFamily) != null) {
this.font = Typeface.create(str, this.textStyle);
}
if (this.font == null) {
int i = this.typeface;
if (i == 1) {
this.font = Typeface.SANS_SERIF;
} else if (i == 2) {
this.font = Typeface.SERIF;
} else if (i != 3) {
this.font = Typeface.DEFAULT;
} else {
this.font = Typeface.MONOSPACE;
}
this.font = Typeface.create(this.font, this.textStyle);
}
}
public void updateDrawState(Context context, TextPaint textPaint, TextAppearanceFontCallback textAppearanceFontCallback) {
updateMeasureState(context, textPaint, textAppearanceFontCallback);
ColorStateList colorStateList = this.textColor;
textPaint.setColor(colorStateList != null ? colorStateList.getColorForState(textPaint.drawableState, this.textColor.getDefaultColor()) : ViewCompat.MEASURED_STATE_MASK);
float f = this.shadowRadius;
float f2 = this.shadowDx;
float f3 = this.shadowDy;
ColorStateList colorStateList2 = this.shadowColor;
textPaint.setShadowLayer(f, f2, f3, colorStateList2 != null ? colorStateList2.getColorForState(textPaint.drawableState, this.shadowColor.getDefaultColor()) : 0);
}
public void updateMeasureState(Context context, TextPaint textPaint, TextAppearanceFontCallback textAppearanceFontCallback) {
if (TextAppearanceConfig.shouldLoadFontSynchronously()) {
updateTextPaintMeasureState(textPaint, getFont(context));
} else {
getFontAsync(context, textPaint, textAppearanceFontCallback);
}
}
public void updateTextPaintMeasureState(TextPaint textPaint, Typeface typeface2) {
textPaint.setTypeface(typeface2);
int i = (~typeface2.getStyle()) & this.textStyle;
textPaint.setFakeBoldText((i & 1) != 0);
textPaint.setTextSkewX((i & 2) != 0 ? -0.25f : 0.0f);
textPaint.setTextSize(this.textSize);
}
}
Download file