1384 lines
46 KiB
Java
1384 lines
46 KiB
Java
package androidx.vectordrawable.graphics.drawable;
|
|
|
|
import android.content.res.ColorStateList;
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.content.res.XmlResourceParser;
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Color;
|
|
import android.graphics.ColorFilter;
|
|
import android.graphics.Matrix;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Path;
|
|
import android.graphics.PathMeasure;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.PorterDuffColorFilter;
|
|
import android.graphics.Rect;
|
|
import android.graphics.Shader;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.graphics.drawable.VectorDrawable;
|
|
import android.os.Build;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.util.Xml;
|
|
import androidx.collection.ArrayMap;
|
|
import androidx.core.content.res.ComplexColorCompat;
|
|
import androidx.core.content.res.ResourcesCompat;
|
|
import androidx.core.content.res.TypedArrayUtils;
|
|
import androidx.core.graphics.PathParser;
|
|
import androidx.core.graphics.drawable.DrawableCompat;
|
|
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
|
import java.io.IOException;
|
|
import java.util.ArrayDeque;
|
|
import java.util.ArrayList;
|
|
import org.xmlpull.v1.XmlPullParser;
|
|
import org.xmlpull.v1.XmlPullParserException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class VectorDrawableCompat extends VectorDrawableCommon {
|
|
static final PorterDuff.Mode j = PorterDuff.Mode.SRC_IN;
|
|
private VectorDrawableCompatState b;
|
|
private PorterDuffColorFilter c;
|
|
private ColorFilter d;
|
|
private boolean e;
|
|
private boolean f;
|
|
private final float[] g;
|
|
private final Matrix h;
|
|
private final Rect i;
|
|
|
|
private static class VClipPath extends VPath {
|
|
public VClipPath() {
|
|
}
|
|
|
|
public void a(Resources resources, AttributeSet attributeSet, Resources.Theme theme, XmlPullParser xmlPullParser) {
|
|
if (TypedArrayUtils.a(xmlPullParser, "pathData")) {
|
|
TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.d);
|
|
a(a);
|
|
a.recycle();
|
|
}
|
|
}
|
|
|
|
@Override // androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.VPath
|
|
public boolean b() {
|
|
return true;
|
|
}
|
|
|
|
public VClipPath(VClipPath vClipPath) {
|
|
super(vClipPath);
|
|
}
|
|
|
|
private void a(TypedArray typedArray) {
|
|
String string = typedArray.getString(0);
|
|
if (string != null) {
|
|
this.b = string;
|
|
}
|
|
String string2 = typedArray.getString(1);
|
|
if (string2 != null) {
|
|
this.a = PathParser.a(string2);
|
|
}
|
|
}
|
|
}
|
|
|
|
private static abstract class VObject {
|
|
private VObject() {
|
|
}
|
|
|
|
public boolean a() {
|
|
return false;
|
|
}
|
|
|
|
public boolean a(int[] iArr) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
private static class VectorDrawableCompatState extends Drawable.ConstantState {
|
|
int a;
|
|
VPathRenderer b;
|
|
ColorStateList c;
|
|
PorterDuff.Mode d;
|
|
boolean e;
|
|
Bitmap f;
|
|
ColorStateList g;
|
|
PorterDuff.Mode h;
|
|
int i;
|
|
boolean j;
|
|
boolean k;
|
|
Paint l;
|
|
|
|
public VectorDrawableCompatState(VectorDrawableCompatState vectorDrawableCompatState) {
|
|
this.c = null;
|
|
this.d = VectorDrawableCompat.j;
|
|
if (vectorDrawableCompatState != null) {
|
|
this.a = vectorDrawableCompatState.a;
|
|
this.b = new VPathRenderer(vectorDrawableCompatState.b);
|
|
Paint paint = vectorDrawableCompatState.b.e;
|
|
if (paint != null) {
|
|
this.b.e = new Paint(paint);
|
|
}
|
|
Paint paint2 = vectorDrawableCompatState.b.d;
|
|
if (paint2 != null) {
|
|
this.b.d = new Paint(paint2);
|
|
}
|
|
this.c = vectorDrawableCompatState.c;
|
|
this.d = vectorDrawableCompatState.d;
|
|
this.e = vectorDrawableCompatState.e;
|
|
}
|
|
}
|
|
|
|
public void a(Canvas canvas, ColorFilter colorFilter, Rect rect) {
|
|
canvas.drawBitmap(this.f, (Rect) null, rect, a(colorFilter));
|
|
}
|
|
|
|
public boolean b() {
|
|
return this.b.getRootAlpha() < 255;
|
|
}
|
|
|
|
public void c(int i, int i2) {
|
|
this.f.eraseColor(0);
|
|
this.b.a(new Canvas(this.f), i, i2, (ColorFilter) null);
|
|
}
|
|
|
|
public void d() {
|
|
this.g = this.c;
|
|
this.h = this.d;
|
|
this.i = this.b.getRootAlpha();
|
|
this.j = this.e;
|
|
this.k = false;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public int getChangingConfigurations() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public Drawable newDrawable() {
|
|
return new VectorDrawableCompat(this);
|
|
}
|
|
|
|
public void b(int i, int i2) {
|
|
if (this.f == null || !a(i, i2)) {
|
|
this.f = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
|
|
this.k = true;
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public Drawable newDrawable(Resources resources) {
|
|
return new VectorDrawableCompat(this);
|
|
}
|
|
|
|
public Paint a(ColorFilter colorFilter) {
|
|
if (!b() && colorFilter == null) {
|
|
return null;
|
|
}
|
|
if (this.l == null) {
|
|
this.l = new Paint();
|
|
this.l.setFilterBitmap(true);
|
|
}
|
|
this.l.setAlpha(this.b.getRootAlpha());
|
|
this.l.setColorFilter(colorFilter);
|
|
return this.l;
|
|
}
|
|
|
|
public boolean c() {
|
|
return this.b.a();
|
|
}
|
|
|
|
public boolean a(int i, int i2) {
|
|
return i == this.f.getWidth() && i2 == this.f.getHeight();
|
|
}
|
|
|
|
public boolean a() {
|
|
return !this.k && this.g == this.c && this.h == this.d && this.j == this.e && this.i == this.b.getRootAlpha();
|
|
}
|
|
|
|
public VectorDrawableCompatState() {
|
|
this.c = null;
|
|
this.d = VectorDrawableCompat.j;
|
|
this.b = new VPathRenderer();
|
|
}
|
|
|
|
public boolean a(int[] iArr) {
|
|
boolean a = this.b.a(iArr);
|
|
this.k |= a;
|
|
return a;
|
|
}
|
|
}
|
|
|
|
VectorDrawableCompat() {
|
|
this.f = true;
|
|
this.g = new float[9];
|
|
this.h = new Matrix();
|
|
this.i = new Rect();
|
|
this.b = new VectorDrawableCompatState();
|
|
}
|
|
|
|
public static VectorDrawableCompat createFromXmlInner(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
|
VectorDrawableCompat vectorDrawableCompat = new VectorDrawableCompat();
|
|
vectorDrawableCompat.inflate(resources, xmlPullParser, attributeSet, theme);
|
|
return vectorDrawableCompat;
|
|
}
|
|
|
|
Object a(String str) {
|
|
return this.b.b.p.get(str);
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public boolean canApplyTheme() {
|
|
Drawable drawable = this.a;
|
|
if (drawable == null) {
|
|
return false;
|
|
}
|
|
DrawableCompat.a(drawable);
|
|
return false;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void draw(Canvas canvas) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.draw(canvas);
|
|
return;
|
|
}
|
|
copyBounds(this.i);
|
|
if (this.i.width() <= 0 || this.i.height() <= 0) {
|
|
return;
|
|
}
|
|
ColorFilter colorFilter = this.d;
|
|
if (colorFilter == null) {
|
|
colorFilter = this.c;
|
|
}
|
|
canvas.getMatrix(this.h);
|
|
this.h.getValues(this.g);
|
|
float abs = Math.abs(this.g[0]);
|
|
float abs2 = Math.abs(this.g[4]);
|
|
float abs3 = Math.abs(this.g[1]);
|
|
float abs4 = Math.abs(this.g[3]);
|
|
if (abs3 != 0.0f || abs4 != 0.0f) {
|
|
abs = 1.0f;
|
|
abs2 = 1.0f;
|
|
}
|
|
int min = Math.min(2048, (int) (this.i.width() * abs));
|
|
int min2 = Math.min(2048, (int) (this.i.height() * abs2));
|
|
if (min <= 0 || min2 <= 0) {
|
|
return;
|
|
}
|
|
int save = canvas.save();
|
|
Rect rect = this.i;
|
|
canvas.translate(rect.left, rect.top);
|
|
if (a()) {
|
|
canvas.translate(this.i.width(), 0.0f);
|
|
canvas.scale(-1.0f, 1.0f);
|
|
}
|
|
this.i.offsetTo(0, 0);
|
|
this.b.b(min, min2);
|
|
if (!this.f) {
|
|
this.b.c(min, min2);
|
|
} else if (!this.b.a()) {
|
|
this.b.c(min, min2);
|
|
this.b.d();
|
|
}
|
|
this.b.a(canvas, colorFilter, this.i);
|
|
canvas.restoreToCount(save);
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public int getAlpha() {
|
|
Drawable drawable = this.a;
|
|
return drawable != null ? DrawableCompat.c(drawable) : this.b.b.getRootAlpha();
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public int getChangingConfigurations() {
|
|
Drawable drawable = this.a;
|
|
return drawable != null ? drawable.getChangingConfigurations() : super.getChangingConfigurations() | this.b.getChangingConfigurations();
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public Drawable.ConstantState getConstantState() {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null && Build.VERSION.SDK_INT >= 24) {
|
|
return new VectorDrawableDelegateState(drawable.getConstantState());
|
|
}
|
|
this.b.a = getChangingConfigurations();
|
|
return this.b;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public int getIntrinsicHeight() {
|
|
Drawable drawable = this.a;
|
|
return drawable != null ? drawable.getIntrinsicHeight() : (int) this.b.b.j;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public int getIntrinsicWidth() {
|
|
Drawable drawable = this.a;
|
|
return drawable != null ? drawable.getIntrinsicWidth() : (int) this.b.b.i;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public int getOpacity() {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
return drawable.getOpacity();
|
|
}
|
|
return -3;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void inflate(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet) throws XmlPullParserException, IOException {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.inflate(resources, xmlPullParser, attributeSet);
|
|
} else {
|
|
inflate(resources, xmlPullParser, attributeSet, null);
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void invalidateSelf() {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.invalidateSelf();
|
|
} else {
|
|
super.invalidateSelf();
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public boolean isAutoMirrored() {
|
|
Drawable drawable = this.a;
|
|
return drawable != null ? DrawableCompat.f(drawable) : this.b.e;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public boolean isStateful() {
|
|
VectorDrawableCompatState vectorDrawableCompatState;
|
|
ColorStateList colorStateList;
|
|
Drawable drawable = this.a;
|
|
return drawable != null ? drawable.isStateful() : super.isStateful() || ((vectorDrawableCompatState = this.b) != null && (vectorDrawableCompatState.c() || ((colorStateList = this.b.c) != null && colorStateList.isStateful())));
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public Drawable mutate() {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.mutate();
|
|
return this;
|
|
}
|
|
if (!this.e && super.mutate() == this) {
|
|
this.b = new VectorDrawableCompatState(this.b);
|
|
this.e = true;
|
|
}
|
|
return this;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
protected void onBoundsChange(Rect rect) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.setBounds(rect);
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
protected boolean onStateChange(int[] iArr) {
|
|
PorterDuff.Mode mode;
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
return drawable.setState(iArr);
|
|
}
|
|
boolean z = false;
|
|
VectorDrawableCompatState vectorDrawableCompatState = this.b;
|
|
ColorStateList colorStateList = vectorDrawableCompatState.c;
|
|
if (colorStateList != null && (mode = vectorDrawableCompatState.d) != null) {
|
|
this.c = a(this.c, colorStateList, mode);
|
|
invalidateSelf();
|
|
z = true;
|
|
}
|
|
if (!vectorDrawableCompatState.c() || !vectorDrawableCompatState.a(iArr)) {
|
|
return z;
|
|
}
|
|
invalidateSelf();
|
|
return true;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void scheduleSelf(Runnable runnable, long j2) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.scheduleSelf(runnable, j2);
|
|
} else {
|
|
super.scheduleSelf(runnable, j2);
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void setAlpha(int i) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.setAlpha(i);
|
|
} else if (this.b.b.getRootAlpha() != i) {
|
|
this.b.b.setRootAlpha(i);
|
|
invalidateSelf();
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void setAutoMirrored(boolean z) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
DrawableCompat.a(drawable, z);
|
|
} else {
|
|
this.b.e = z;
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
|
public void setTint(int i) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
DrawableCompat.b(drawable, i);
|
|
} else {
|
|
setTintList(ColorStateList.valueOf(i));
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
|
public void setTintList(ColorStateList colorStateList) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
DrawableCompat.a(drawable, colorStateList);
|
|
return;
|
|
}
|
|
VectorDrawableCompatState vectorDrawableCompatState = this.b;
|
|
if (vectorDrawableCompatState.c != colorStateList) {
|
|
vectorDrawableCompatState.c = colorStateList;
|
|
this.c = a(this.c, colorStateList, vectorDrawableCompatState.d);
|
|
invalidateSelf();
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable, androidx.core.graphics.drawable.TintAwareDrawable
|
|
public void setTintMode(PorterDuff.Mode mode) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
DrawableCompat.a(drawable, mode);
|
|
return;
|
|
}
|
|
VectorDrawableCompatState vectorDrawableCompatState = this.b;
|
|
if (vectorDrawableCompatState.d != mode) {
|
|
vectorDrawableCompatState.d = mode;
|
|
this.c = a(this.c, vectorDrawableCompatState.c, mode);
|
|
invalidateSelf();
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public boolean setVisible(boolean z, boolean z2) {
|
|
Drawable drawable = this.a;
|
|
return drawable != null ? drawable.setVisible(z, z2) : super.setVisible(z, z2);
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void unscheduleSelf(Runnable runnable) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.unscheduleSelf(runnable);
|
|
} else {
|
|
super.unscheduleSelf(runnable);
|
|
}
|
|
}
|
|
|
|
private static abstract class VPath extends VObject {
|
|
protected PathParser.PathDataNode[] a;
|
|
String b;
|
|
int c;
|
|
|
|
public VPath() {
|
|
super();
|
|
this.a = null;
|
|
}
|
|
|
|
public void a(Path path) {
|
|
path.reset();
|
|
PathParser.PathDataNode[] pathDataNodeArr = this.a;
|
|
if (pathDataNodeArr != null) {
|
|
PathParser.PathDataNode.a(pathDataNodeArr, path);
|
|
}
|
|
}
|
|
|
|
public boolean b() {
|
|
return false;
|
|
}
|
|
|
|
public PathParser.PathDataNode[] getPathData() {
|
|
return this.a;
|
|
}
|
|
|
|
public String getPathName() {
|
|
return this.b;
|
|
}
|
|
|
|
public void setPathData(PathParser.PathDataNode[] pathDataNodeArr) {
|
|
if (PathParser.a(this.a, pathDataNodeArr)) {
|
|
PathParser.b(this.a, pathDataNodeArr);
|
|
} else {
|
|
this.a = PathParser.a(pathDataNodeArr);
|
|
}
|
|
}
|
|
|
|
public VPath(VPath vPath) {
|
|
super();
|
|
this.a = null;
|
|
this.b = vPath.b;
|
|
this.c = vPath.c;
|
|
this.a = PathParser.a(vPath.a);
|
|
}
|
|
}
|
|
|
|
private static class VectorDrawableDelegateState extends Drawable.ConstantState {
|
|
private final Drawable.ConstantState a;
|
|
|
|
public VectorDrawableDelegateState(Drawable.ConstantState constantState) {
|
|
this.a = constantState;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public boolean canApplyTheme() {
|
|
return this.a.canApplyTheme();
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public int getChangingConfigurations() {
|
|
return this.a.getChangingConfigurations();
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public Drawable newDrawable() {
|
|
VectorDrawableCompat vectorDrawableCompat = new VectorDrawableCompat();
|
|
vectorDrawableCompat.a = (VectorDrawable) this.a.newDrawable();
|
|
return vectorDrawableCompat;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public Drawable newDrawable(Resources resources) {
|
|
VectorDrawableCompat vectorDrawableCompat = new VectorDrawableCompat();
|
|
vectorDrawableCompat.a = (VectorDrawable) this.a.newDrawable(resources);
|
|
return vectorDrawableCompat;
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
|
public Drawable newDrawable(Resources resources, Resources.Theme theme) {
|
|
VectorDrawableCompat vectorDrawableCompat = new VectorDrawableCompat();
|
|
vectorDrawableCompat.a = (VectorDrawable) this.a.newDrawable(resources, theme);
|
|
return vectorDrawableCompat;
|
|
}
|
|
}
|
|
|
|
PorterDuffColorFilter a(PorterDuffColorFilter porterDuffColorFilter, ColorStateList colorStateList, PorterDuff.Mode mode) {
|
|
if (colorStateList == null || mode == null) {
|
|
return null;
|
|
}
|
|
return new PorterDuffColorFilter(colorStateList.getColorForState(getState(), 0), mode);
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void setColorFilter(ColorFilter colorFilter) {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
drawable.setColorFilter(colorFilter);
|
|
} else {
|
|
this.d = colorFilter;
|
|
invalidateSelf();
|
|
}
|
|
}
|
|
|
|
private static class VFullPath extends VPath {
|
|
private int[] d;
|
|
ComplexColorCompat e;
|
|
float f;
|
|
ComplexColorCompat g;
|
|
float h;
|
|
int i;
|
|
float j;
|
|
float k;
|
|
float l;
|
|
float m;
|
|
Paint.Cap n;
|
|
Paint.Join o;
|
|
float p;
|
|
|
|
public VFullPath() {
|
|
this.f = 0.0f;
|
|
this.h = 1.0f;
|
|
this.i = 0;
|
|
this.j = 1.0f;
|
|
this.k = 0.0f;
|
|
this.l = 1.0f;
|
|
this.m = 0.0f;
|
|
this.n = Paint.Cap.BUTT;
|
|
this.o = Paint.Join.MITER;
|
|
this.p = 4.0f;
|
|
}
|
|
|
|
private Paint.Cap a(int i, Paint.Cap cap) {
|
|
return i != 0 ? i != 1 ? i != 2 ? cap : Paint.Cap.SQUARE : Paint.Cap.ROUND : Paint.Cap.BUTT;
|
|
}
|
|
|
|
float getFillAlpha() {
|
|
return this.j;
|
|
}
|
|
|
|
int getFillColor() {
|
|
return this.g.a();
|
|
}
|
|
|
|
float getStrokeAlpha() {
|
|
return this.h;
|
|
}
|
|
|
|
int getStrokeColor() {
|
|
return this.e.a();
|
|
}
|
|
|
|
float getStrokeWidth() {
|
|
return this.f;
|
|
}
|
|
|
|
float getTrimPathEnd() {
|
|
return this.l;
|
|
}
|
|
|
|
float getTrimPathOffset() {
|
|
return this.m;
|
|
}
|
|
|
|
float getTrimPathStart() {
|
|
return this.k;
|
|
}
|
|
|
|
void setFillAlpha(float f) {
|
|
this.j = f;
|
|
}
|
|
|
|
void setFillColor(int i) {
|
|
this.g.a(i);
|
|
}
|
|
|
|
void setStrokeAlpha(float f) {
|
|
this.h = f;
|
|
}
|
|
|
|
void setStrokeColor(int i) {
|
|
this.e.a(i);
|
|
}
|
|
|
|
void setStrokeWidth(float f) {
|
|
this.f = f;
|
|
}
|
|
|
|
void setTrimPathEnd(float f) {
|
|
this.l = f;
|
|
}
|
|
|
|
void setTrimPathOffset(float f) {
|
|
this.m = f;
|
|
}
|
|
|
|
void setTrimPathStart(float f) {
|
|
this.k = f;
|
|
}
|
|
|
|
private Paint.Join a(int i, Paint.Join join) {
|
|
if (i == 0) {
|
|
return Paint.Join.MITER;
|
|
}
|
|
if (i != 1) {
|
|
return i != 2 ? join : Paint.Join.BEVEL;
|
|
}
|
|
return Paint.Join.ROUND;
|
|
}
|
|
|
|
public void a(Resources resources, AttributeSet attributeSet, Resources.Theme theme, XmlPullParser xmlPullParser) {
|
|
TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.c);
|
|
a(a, xmlPullParser, theme);
|
|
a.recycle();
|
|
}
|
|
|
|
private void a(TypedArray typedArray, XmlPullParser xmlPullParser, Resources.Theme theme) {
|
|
this.d = null;
|
|
if (TypedArrayUtils.a(xmlPullParser, "pathData")) {
|
|
String string = typedArray.getString(0);
|
|
if (string != null) {
|
|
this.b = string;
|
|
}
|
|
String string2 = typedArray.getString(2);
|
|
if (string2 != null) {
|
|
this.a = PathParser.a(string2);
|
|
}
|
|
this.g = TypedArrayUtils.a(typedArray, xmlPullParser, theme, "fillColor", 1, 0);
|
|
this.j = TypedArrayUtils.a(typedArray, xmlPullParser, "fillAlpha", 12, this.j);
|
|
this.n = a(TypedArrayUtils.b(typedArray, xmlPullParser, "strokeLineCap", 8, -1), this.n);
|
|
this.o = a(TypedArrayUtils.b(typedArray, xmlPullParser, "strokeLineJoin", 9, -1), this.o);
|
|
this.p = TypedArrayUtils.a(typedArray, xmlPullParser, "strokeMiterLimit", 10, this.p);
|
|
this.e = TypedArrayUtils.a(typedArray, xmlPullParser, theme, "strokeColor", 3, 0);
|
|
this.h = TypedArrayUtils.a(typedArray, xmlPullParser, "strokeAlpha", 11, this.h);
|
|
this.f = TypedArrayUtils.a(typedArray, xmlPullParser, "strokeWidth", 4, this.f);
|
|
this.l = TypedArrayUtils.a(typedArray, xmlPullParser, "trimPathEnd", 6, this.l);
|
|
this.m = TypedArrayUtils.a(typedArray, xmlPullParser, "trimPathOffset", 7, this.m);
|
|
this.k = TypedArrayUtils.a(typedArray, xmlPullParser, "trimPathStart", 5, this.k);
|
|
this.i = TypedArrayUtils.b(typedArray, xmlPullParser, "fillType", 13, this.i);
|
|
}
|
|
}
|
|
|
|
public VFullPath(VFullPath vFullPath) {
|
|
super(vFullPath);
|
|
this.f = 0.0f;
|
|
this.h = 1.0f;
|
|
this.i = 0;
|
|
this.j = 1.0f;
|
|
this.k = 0.0f;
|
|
this.l = 1.0f;
|
|
this.m = 0.0f;
|
|
this.n = Paint.Cap.BUTT;
|
|
this.o = Paint.Join.MITER;
|
|
this.p = 4.0f;
|
|
this.d = vFullPath.d;
|
|
this.e = vFullPath.e;
|
|
this.f = vFullPath.f;
|
|
this.h = vFullPath.h;
|
|
this.g = vFullPath.g;
|
|
this.i = vFullPath.i;
|
|
this.j = vFullPath.j;
|
|
this.k = vFullPath.k;
|
|
this.l = vFullPath.l;
|
|
this.m = vFullPath.m;
|
|
this.n = vFullPath.n;
|
|
this.o = vFullPath.o;
|
|
this.p = vFullPath.p;
|
|
}
|
|
|
|
@Override // androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.VObject
|
|
public boolean a() {
|
|
return this.g.d() || this.e.d();
|
|
}
|
|
|
|
@Override // androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.VObject
|
|
public boolean a(int[] iArr) {
|
|
return this.e.a(iArr) | this.g.a(iArr);
|
|
}
|
|
}
|
|
|
|
private static class VGroup extends VObject {
|
|
final Matrix a;
|
|
final ArrayList<VObject> b;
|
|
float c;
|
|
private float d;
|
|
private float e;
|
|
private float f;
|
|
private float g;
|
|
private float h;
|
|
private float i;
|
|
final Matrix j;
|
|
int k;
|
|
private int[] l;
|
|
private String m;
|
|
|
|
public VGroup(VGroup vGroup, ArrayMap<String, Object> arrayMap) {
|
|
super();
|
|
VPath vClipPath;
|
|
this.a = new Matrix();
|
|
this.b = new ArrayList<>();
|
|
this.c = 0.0f;
|
|
this.d = 0.0f;
|
|
this.e = 0.0f;
|
|
this.f = 1.0f;
|
|
this.g = 1.0f;
|
|
this.h = 0.0f;
|
|
this.i = 0.0f;
|
|
this.j = new Matrix();
|
|
this.m = null;
|
|
this.c = vGroup.c;
|
|
this.d = vGroup.d;
|
|
this.e = vGroup.e;
|
|
this.f = vGroup.f;
|
|
this.g = vGroup.g;
|
|
this.h = vGroup.h;
|
|
this.i = vGroup.i;
|
|
this.l = vGroup.l;
|
|
this.m = vGroup.m;
|
|
this.k = vGroup.k;
|
|
String str = this.m;
|
|
if (str != null) {
|
|
arrayMap.put(str, this);
|
|
}
|
|
this.j.set(vGroup.j);
|
|
ArrayList<VObject> arrayList = vGroup.b;
|
|
for (int i = 0; i < arrayList.size(); i++) {
|
|
VObject vObject = arrayList.get(i);
|
|
if (vObject instanceof VGroup) {
|
|
this.b.add(new VGroup((VGroup) vObject, arrayMap));
|
|
} else {
|
|
if (vObject instanceof VFullPath) {
|
|
vClipPath = new VFullPath((VFullPath) vObject);
|
|
} else {
|
|
if (!(vObject instanceof VClipPath)) {
|
|
throw new IllegalStateException("Unknown object in the tree!");
|
|
}
|
|
vClipPath = new VClipPath((VClipPath) vObject);
|
|
}
|
|
this.b.add(vClipPath);
|
|
String str2 = vClipPath.b;
|
|
if (str2 != null) {
|
|
arrayMap.put(str2, vClipPath);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void b() {
|
|
this.j.reset();
|
|
this.j.postTranslate(-this.d, -this.e);
|
|
this.j.postScale(this.f, this.g);
|
|
this.j.postRotate(this.c, 0.0f, 0.0f);
|
|
this.j.postTranslate(this.h + this.d, this.i + this.e);
|
|
}
|
|
|
|
public void a(Resources resources, AttributeSet attributeSet, Resources.Theme theme, XmlPullParser xmlPullParser) {
|
|
TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.b);
|
|
a(a, xmlPullParser);
|
|
a.recycle();
|
|
}
|
|
|
|
public String getGroupName() {
|
|
return this.m;
|
|
}
|
|
|
|
public Matrix getLocalMatrix() {
|
|
return this.j;
|
|
}
|
|
|
|
public float getPivotX() {
|
|
return this.d;
|
|
}
|
|
|
|
public float getPivotY() {
|
|
return this.e;
|
|
}
|
|
|
|
public float getRotation() {
|
|
return this.c;
|
|
}
|
|
|
|
public float getScaleX() {
|
|
return this.f;
|
|
}
|
|
|
|
public float getScaleY() {
|
|
return this.g;
|
|
}
|
|
|
|
public float getTranslateX() {
|
|
return this.h;
|
|
}
|
|
|
|
public float getTranslateY() {
|
|
return this.i;
|
|
}
|
|
|
|
public void setPivotX(float f) {
|
|
if (f != this.d) {
|
|
this.d = f;
|
|
b();
|
|
}
|
|
}
|
|
|
|
public void setPivotY(float f) {
|
|
if (f != this.e) {
|
|
this.e = f;
|
|
b();
|
|
}
|
|
}
|
|
|
|
public void setRotation(float f) {
|
|
if (f != this.c) {
|
|
this.c = f;
|
|
b();
|
|
}
|
|
}
|
|
|
|
public void setScaleX(float f) {
|
|
if (f != this.f) {
|
|
this.f = f;
|
|
b();
|
|
}
|
|
}
|
|
|
|
public void setScaleY(float f) {
|
|
if (f != this.g) {
|
|
this.g = f;
|
|
b();
|
|
}
|
|
}
|
|
|
|
public void setTranslateX(float f) {
|
|
if (f != this.h) {
|
|
this.h = f;
|
|
b();
|
|
}
|
|
}
|
|
|
|
public void setTranslateY(float f) {
|
|
if (f != this.i) {
|
|
this.i = f;
|
|
b();
|
|
}
|
|
}
|
|
|
|
private void a(TypedArray typedArray, XmlPullParser xmlPullParser) {
|
|
this.l = null;
|
|
this.c = TypedArrayUtils.a(typedArray, xmlPullParser, "rotation", 5, this.c);
|
|
this.d = typedArray.getFloat(1, this.d);
|
|
this.e = typedArray.getFloat(2, this.e);
|
|
this.f = TypedArrayUtils.a(typedArray, xmlPullParser, "scaleX", 3, this.f);
|
|
this.g = TypedArrayUtils.a(typedArray, xmlPullParser, "scaleY", 4, this.g);
|
|
this.h = TypedArrayUtils.a(typedArray, xmlPullParser, "translateX", 6, this.h);
|
|
this.i = TypedArrayUtils.a(typedArray, xmlPullParser, "translateY", 7, this.i);
|
|
String string = typedArray.getString(0);
|
|
if (string != null) {
|
|
this.m = string;
|
|
}
|
|
b();
|
|
}
|
|
|
|
@Override // androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.VObject
|
|
public boolean a() {
|
|
for (int i = 0; i < this.b.size(); i++) {
|
|
if (this.b.get(i).a()) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.VObject
|
|
public boolean a(int[] iArr) {
|
|
boolean z = false;
|
|
for (int i = 0; i < this.b.size(); i++) {
|
|
z |= this.b.get(i).a(iArr);
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public VGroup() {
|
|
super();
|
|
this.a = new Matrix();
|
|
this.b = new ArrayList<>();
|
|
this.c = 0.0f;
|
|
this.d = 0.0f;
|
|
this.e = 0.0f;
|
|
this.f = 1.0f;
|
|
this.g = 1.0f;
|
|
this.h = 0.0f;
|
|
this.i = 0.0f;
|
|
this.j = new Matrix();
|
|
this.m = null;
|
|
}
|
|
}
|
|
|
|
public static VectorDrawableCompat a(Resources resources, int i, Resources.Theme theme) {
|
|
int next;
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
VectorDrawableCompat vectorDrawableCompat = new VectorDrawableCompat();
|
|
vectorDrawableCompat.a = ResourcesCompat.a(resources, i, theme);
|
|
new VectorDrawableDelegateState(vectorDrawableCompat.a.getConstantState());
|
|
return vectorDrawableCompat;
|
|
}
|
|
try {
|
|
XmlResourceParser xml = resources.getXml(i);
|
|
AttributeSet asAttributeSet = Xml.asAttributeSet(xml);
|
|
do {
|
|
next = xml.next();
|
|
if (next == 2) {
|
|
break;
|
|
}
|
|
} while (next != 1);
|
|
if (next == 2) {
|
|
return createFromXmlInner(resources, (XmlPullParser) xml, asAttributeSet, theme);
|
|
}
|
|
throw new XmlPullParserException("No start tag found");
|
|
} catch (IOException e) {
|
|
Log.e("VectorDrawableCompat", "parser error", e);
|
|
return null;
|
|
} catch (XmlPullParserException e2) {
|
|
Log.e("VectorDrawableCompat", "parser error", e2);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@Override // android.graphics.drawable.Drawable
|
|
public void inflate(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
|
Drawable drawable = this.a;
|
|
if (drawable != null) {
|
|
DrawableCompat.a(drawable, resources, xmlPullParser, attributeSet, theme);
|
|
return;
|
|
}
|
|
VectorDrawableCompatState vectorDrawableCompatState = this.b;
|
|
vectorDrawableCompatState.b = new VPathRenderer();
|
|
TypedArray a = TypedArrayUtils.a(resources, theme, attributeSet, AndroidResources.a);
|
|
a(a, xmlPullParser);
|
|
a.recycle();
|
|
vectorDrawableCompatState.a = getChangingConfigurations();
|
|
vectorDrawableCompatState.k = true;
|
|
a(resources, xmlPullParser, attributeSet, theme);
|
|
this.c = a(this.c, vectorDrawableCompatState.c, vectorDrawableCompatState.d);
|
|
}
|
|
|
|
VectorDrawableCompat(VectorDrawableCompatState vectorDrawableCompatState) {
|
|
this.f = true;
|
|
this.g = new float[9];
|
|
this.h = new Matrix();
|
|
this.i = new Rect();
|
|
this.b = vectorDrawableCompatState;
|
|
this.c = a(this.c, vectorDrawableCompatState.c, vectorDrawableCompatState.d);
|
|
}
|
|
|
|
private static class VPathRenderer {
|
|
private static final Matrix q = new Matrix();
|
|
private final Path a;
|
|
private final Path b;
|
|
private final Matrix c;
|
|
Paint d;
|
|
Paint e;
|
|
private PathMeasure f;
|
|
private int g;
|
|
final VGroup h;
|
|
float i;
|
|
float j;
|
|
float k;
|
|
float l;
|
|
int m;
|
|
String n;
|
|
Boolean o;
|
|
final ArrayMap<String, Object> p;
|
|
|
|
public VPathRenderer() {
|
|
this.c = new Matrix();
|
|
this.i = 0.0f;
|
|
this.j = 0.0f;
|
|
this.k = 0.0f;
|
|
this.l = 0.0f;
|
|
this.m = 255;
|
|
this.n = null;
|
|
this.o = null;
|
|
this.p = new ArrayMap<>();
|
|
this.h = new VGroup();
|
|
this.a = new Path();
|
|
this.b = new Path();
|
|
}
|
|
|
|
private static float a(float f, float f2, float f3, float f4) {
|
|
return (f * f4) - (f2 * f3);
|
|
}
|
|
|
|
private void a(VGroup vGroup, Matrix matrix, Canvas canvas, int i, int i2, ColorFilter colorFilter) {
|
|
vGroup.a.set(matrix);
|
|
vGroup.a.preConcat(vGroup.j);
|
|
canvas.save();
|
|
for (int i3 = 0; i3 < vGroup.b.size(); i3++) {
|
|
VObject vObject = vGroup.b.get(i3);
|
|
if (vObject instanceof VGroup) {
|
|
a((VGroup) vObject, vGroup.a, canvas, i, i2, colorFilter);
|
|
} else if (vObject instanceof VPath) {
|
|
a(vGroup, (VPath) vObject, canvas, i, i2, colorFilter);
|
|
}
|
|
}
|
|
canvas.restore();
|
|
}
|
|
|
|
public float getAlpha() {
|
|
return getRootAlpha() / 255.0f;
|
|
}
|
|
|
|
public int getRootAlpha() {
|
|
return this.m;
|
|
}
|
|
|
|
public void setAlpha(float f) {
|
|
setRootAlpha((int) (f * 255.0f));
|
|
}
|
|
|
|
public void setRootAlpha(int i) {
|
|
this.m = i;
|
|
}
|
|
|
|
public void a(Canvas canvas, int i, int i2, ColorFilter colorFilter) {
|
|
a(this.h, q, canvas, i, i2, colorFilter);
|
|
}
|
|
|
|
public VPathRenderer(VPathRenderer vPathRenderer) {
|
|
this.c = new Matrix();
|
|
this.i = 0.0f;
|
|
this.j = 0.0f;
|
|
this.k = 0.0f;
|
|
this.l = 0.0f;
|
|
this.m = 255;
|
|
this.n = null;
|
|
this.o = null;
|
|
this.p = new ArrayMap<>();
|
|
this.h = new VGroup(vPathRenderer.h, this.p);
|
|
this.a = new Path(vPathRenderer.a);
|
|
this.b = new Path(vPathRenderer.b);
|
|
this.i = vPathRenderer.i;
|
|
this.j = vPathRenderer.j;
|
|
this.k = vPathRenderer.k;
|
|
this.l = vPathRenderer.l;
|
|
this.g = vPathRenderer.g;
|
|
this.m = vPathRenderer.m;
|
|
this.n = vPathRenderer.n;
|
|
String str = vPathRenderer.n;
|
|
if (str != null) {
|
|
this.p.put(str, this);
|
|
}
|
|
this.o = vPathRenderer.o;
|
|
}
|
|
|
|
private void a(VGroup vGroup, VPath vPath, Canvas canvas, int i, int i2, ColorFilter colorFilter) {
|
|
float f = i / this.k;
|
|
float f2 = i2 / this.l;
|
|
float min = Math.min(f, f2);
|
|
Matrix matrix = vGroup.a;
|
|
this.c.set(matrix);
|
|
this.c.postScale(f, f2);
|
|
float a = a(matrix);
|
|
if (a == 0.0f) {
|
|
return;
|
|
}
|
|
vPath.a(this.a);
|
|
Path path = this.a;
|
|
this.b.reset();
|
|
if (vPath.b()) {
|
|
this.b.addPath(path, this.c);
|
|
canvas.clipPath(this.b);
|
|
return;
|
|
}
|
|
VFullPath vFullPath = (VFullPath) vPath;
|
|
if (vFullPath.k != 0.0f || vFullPath.l != 1.0f) {
|
|
float f3 = vFullPath.k;
|
|
float f4 = vFullPath.m;
|
|
float f5 = (f3 + f4) % 1.0f;
|
|
float f6 = (vFullPath.l + f4) % 1.0f;
|
|
if (this.f == null) {
|
|
this.f = new PathMeasure();
|
|
}
|
|
this.f.setPath(this.a, false);
|
|
float length = this.f.getLength();
|
|
float f7 = f5 * length;
|
|
float f8 = f6 * length;
|
|
path.reset();
|
|
if (f7 > f8) {
|
|
this.f.getSegment(f7, length, path, true);
|
|
this.f.getSegment(0.0f, f8, path, true);
|
|
} else {
|
|
this.f.getSegment(f7, f8, path, true);
|
|
}
|
|
path.rLineTo(0.0f, 0.0f);
|
|
}
|
|
this.b.addPath(path, this.c);
|
|
if (vFullPath.g.e()) {
|
|
ComplexColorCompat complexColorCompat = vFullPath.g;
|
|
if (this.e == null) {
|
|
this.e = new Paint(1);
|
|
this.e.setStyle(Paint.Style.FILL);
|
|
}
|
|
Paint paint = this.e;
|
|
if (complexColorCompat.c()) {
|
|
Shader b = complexColorCompat.b();
|
|
b.setLocalMatrix(this.c);
|
|
paint.setShader(b);
|
|
paint.setAlpha(Math.round(vFullPath.j * 255.0f));
|
|
} else {
|
|
paint.setColor(VectorDrawableCompat.a(complexColorCompat.a(), vFullPath.j));
|
|
}
|
|
paint.setColorFilter(colorFilter);
|
|
this.b.setFillType(vFullPath.i == 0 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD);
|
|
canvas.drawPath(this.b, paint);
|
|
}
|
|
if (vFullPath.e.e()) {
|
|
ComplexColorCompat complexColorCompat2 = vFullPath.e;
|
|
if (this.d == null) {
|
|
this.d = new Paint(1);
|
|
this.d.setStyle(Paint.Style.STROKE);
|
|
}
|
|
Paint paint2 = this.d;
|
|
Paint.Join join = vFullPath.o;
|
|
if (join != null) {
|
|
paint2.setStrokeJoin(join);
|
|
}
|
|
Paint.Cap cap = vFullPath.n;
|
|
if (cap != null) {
|
|
paint2.setStrokeCap(cap);
|
|
}
|
|
paint2.setStrokeMiter(vFullPath.p);
|
|
if (complexColorCompat2.c()) {
|
|
Shader b2 = complexColorCompat2.b();
|
|
b2.setLocalMatrix(this.c);
|
|
paint2.setShader(b2);
|
|
paint2.setAlpha(Math.round(vFullPath.h * 255.0f));
|
|
} else {
|
|
paint2.setColor(VectorDrawableCompat.a(complexColorCompat2.a(), vFullPath.h));
|
|
}
|
|
paint2.setColorFilter(colorFilter);
|
|
paint2.setStrokeWidth(vFullPath.f * min * a);
|
|
canvas.drawPath(this.b, paint2);
|
|
}
|
|
}
|
|
|
|
private float a(Matrix matrix) {
|
|
float[] fArr = {0.0f, 1.0f, 1.0f, 0.0f};
|
|
matrix.mapVectors(fArr);
|
|
float hypot = (float) Math.hypot(fArr[0], fArr[1]);
|
|
float hypot2 = (float) Math.hypot(fArr[2], fArr[3]);
|
|
float a = a(fArr[0], fArr[1], fArr[2], fArr[3]);
|
|
float max = Math.max(hypot, hypot2);
|
|
if (max > 0.0f) {
|
|
return Math.abs(a) / max;
|
|
}
|
|
return 0.0f;
|
|
}
|
|
|
|
public boolean a() {
|
|
if (this.o == null) {
|
|
this.o = Boolean.valueOf(this.h.a());
|
|
}
|
|
return this.o.booleanValue();
|
|
}
|
|
|
|
public boolean a(int[] iArr) {
|
|
return this.h.a(iArr);
|
|
}
|
|
}
|
|
|
|
static int a(int i, float f) {
|
|
return (i & 16777215) | (((int) (Color.alpha(i) * f)) << 24);
|
|
}
|
|
|
|
private static PorterDuff.Mode a(int i, PorterDuff.Mode mode) {
|
|
if (i == 3) {
|
|
return PorterDuff.Mode.SRC_OVER;
|
|
}
|
|
if (i == 5) {
|
|
return PorterDuff.Mode.SRC_IN;
|
|
}
|
|
if (i != 9) {
|
|
switch (i) {
|
|
case 14:
|
|
return PorterDuff.Mode.MULTIPLY;
|
|
case 15:
|
|
return PorterDuff.Mode.SCREEN;
|
|
case 16:
|
|
return PorterDuff.Mode.ADD;
|
|
default:
|
|
return mode;
|
|
}
|
|
}
|
|
return PorterDuff.Mode.SRC_ATOP;
|
|
}
|
|
|
|
private void a(TypedArray typedArray, XmlPullParser xmlPullParser) throws XmlPullParserException {
|
|
VectorDrawableCompatState vectorDrawableCompatState = this.b;
|
|
VPathRenderer vPathRenderer = vectorDrawableCompatState.b;
|
|
vectorDrawableCompatState.d = a(TypedArrayUtils.b(typedArray, xmlPullParser, "tintMode", 6, -1), PorterDuff.Mode.SRC_IN);
|
|
ColorStateList colorStateList = typedArray.getColorStateList(1);
|
|
if (colorStateList != null) {
|
|
vectorDrawableCompatState.c = colorStateList;
|
|
}
|
|
vectorDrawableCompatState.e = TypedArrayUtils.a(typedArray, xmlPullParser, "autoMirrored", 5, vectorDrawableCompatState.e);
|
|
vPathRenderer.k = TypedArrayUtils.a(typedArray, xmlPullParser, "viewportWidth", 7, vPathRenderer.k);
|
|
vPathRenderer.l = TypedArrayUtils.a(typedArray, xmlPullParser, "viewportHeight", 8, vPathRenderer.l);
|
|
if (vPathRenderer.k <= 0.0f) {
|
|
throw new XmlPullParserException(typedArray.getPositionDescription() + "<vector> tag requires viewportWidth > 0");
|
|
}
|
|
if (vPathRenderer.l > 0.0f) {
|
|
vPathRenderer.i = typedArray.getDimension(3, vPathRenderer.i);
|
|
vPathRenderer.j = typedArray.getDimension(2, vPathRenderer.j);
|
|
if (vPathRenderer.i <= 0.0f) {
|
|
throw new XmlPullParserException(typedArray.getPositionDescription() + "<vector> tag requires width > 0");
|
|
}
|
|
if (vPathRenderer.j > 0.0f) {
|
|
vPathRenderer.setAlpha(TypedArrayUtils.a(typedArray, xmlPullParser, "alpha", 4, vPathRenderer.getAlpha()));
|
|
String string = typedArray.getString(0);
|
|
if (string != null) {
|
|
vPathRenderer.n = string;
|
|
vPathRenderer.p.put(string, vPathRenderer);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
throw new XmlPullParserException(typedArray.getPositionDescription() + "<vector> tag requires height > 0");
|
|
}
|
|
throw new XmlPullParserException(typedArray.getPositionDescription() + "<vector> tag requires viewportHeight > 0");
|
|
}
|
|
|
|
private void a(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
|
|
VectorDrawableCompatState vectorDrawableCompatState = this.b;
|
|
VPathRenderer vPathRenderer = vectorDrawableCompatState.b;
|
|
ArrayDeque arrayDeque = new ArrayDeque();
|
|
arrayDeque.push(vPathRenderer.h);
|
|
int eventType = xmlPullParser.getEventType();
|
|
int depth = xmlPullParser.getDepth() + 1;
|
|
boolean z = true;
|
|
while (eventType != 1 && (xmlPullParser.getDepth() >= depth || eventType != 3)) {
|
|
if (eventType == 2) {
|
|
String name = xmlPullParser.getName();
|
|
VGroup vGroup = (VGroup) arrayDeque.peek();
|
|
if (FileDownloadModel.PATH.equals(name)) {
|
|
VFullPath vFullPath = new VFullPath();
|
|
vFullPath.a(resources, attributeSet, theme, xmlPullParser);
|
|
vGroup.b.add(vFullPath);
|
|
if (vFullPath.getPathName() != null) {
|
|
vPathRenderer.p.put(vFullPath.getPathName(), vFullPath);
|
|
}
|
|
z = false;
|
|
vectorDrawableCompatState.a = vFullPath.c | vectorDrawableCompatState.a;
|
|
} else if ("clip-path".equals(name)) {
|
|
VClipPath vClipPath = new VClipPath();
|
|
vClipPath.a(resources, attributeSet, theme, xmlPullParser);
|
|
vGroup.b.add(vClipPath);
|
|
if (vClipPath.getPathName() != null) {
|
|
vPathRenderer.p.put(vClipPath.getPathName(), vClipPath);
|
|
}
|
|
vectorDrawableCompatState.a = vClipPath.c | vectorDrawableCompatState.a;
|
|
} else if ("group".equals(name)) {
|
|
VGroup vGroup2 = new VGroup();
|
|
vGroup2.a(resources, attributeSet, theme, xmlPullParser);
|
|
vGroup.b.add(vGroup2);
|
|
arrayDeque.push(vGroup2);
|
|
if (vGroup2.getGroupName() != null) {
|
|
vPathRenderer.p.put(vGroup2.getGroupName(), vGroup2);
|
|
}
|
|
vectorDrawableCompatState.a = vGroup2.k | vectorDrawableCompatState.a;
|
|
}
|
|
} else if (eventType == 3 && "group".equals(xmlPullParser.getName())) {
|
|
arrayDeque.pop();
|
|
}
|
|
eventType = xmlPullParser.next();
|
|
}
|
|
if (z) {
|
|
throw new XmlPullParserException("no path defined");
|
|
}
|
|
}
|
|
|
|
void a(boolean z) {
|
|
this.f = z;
|
|
}
|
|
|
|
private boolean a() {
|
|
return Build.VERSION.SDK_INT >= 17 && isAutoMirrored() && DrawableCompat.e(this) == 1;
|
|
}
|
|
}
|