正在查看: 凤凰之城 v1.0.3 应用的 am.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 凤凰之城 v1.0.3 应用的 am.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.bytedance.adsdk.lottie;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageView;
import com.bytedance.adsdk.lottie.yo.yv;
import com.bytedance.component.sdk.annotation.FloatRange;
import com.bytedance.component.sdk.annotation.IntRange;
import com.bytedance.component.sdk.annotation.MainThread;
import com.bytedance.component.sdk.annotation.RestrictTo;
import com.google.android.material.shadow.ShadowDrawableWrapper;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class am extends Drawable implements Animatable, Drawable.Callback {
private boolean am;
private boolean au;
public String b;
private com.bytedance.adsdk.lottie.model.layer.yo bw;
private Bitmap c;
private String cd;
private RectF dr;
private final Matrix e;
private Paint ey;
private boolean f;
private Rect fm;
private final ValueAnimator.AnimatorUpdateListener g;
private Canvas ha;
private Matrix hm;
private boolean i;
public qp iz;
private Map<String, Typeface> jb;
private com.bytedance.adsdk.lottie.iz.b jc;
private iz k;
private boolean kc;
private boolean l;
private m lw;
private int m;
private boolean ma;
private Matrix n;
private final com.bytedance.adsdk.lottie.nr.f nr;
private LottieAnimationView nt;
private kc o;
private Rect oq;
private boolean pd;
public bw qp;
private Rect ra;
private yo u;
private com.bytedance.adsdk.lottie.iz.iz v;
private RectF vo;
private final ArrayList<b> vt;
private boolean w;
private RectF y;
private boolean yk;
private f yo;
private boolean yv;
public interface b {
void b(f fVar);
}
public enum iz {
NONE,
PLAY,
RESUME
}
public am(LottieAnimationView lottieAnimationView) {
com.bytedance.adsdk.lottie.nr.f fVar = new com.bytedance.adsdk.lottie.nr.f();
this.nr = fVar;
this.f = true;
this.l = false;
this.am = false;
this.k = iz.NONE;
this.vt = new ArrayList<>();
ValueAnimator.AnimatorUpdateListener animatorUpdateListener = new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
if (am.this.bw != null) {
am.this.bw.b(am.this.nr.f());
}
}
};
this.g = animatorUpdateListener;
this.au = false;
this.kc = true;
this.m = 255;
this.o = kc.AUTOMATIC;
this.pd = false;
this.e = new Matrix();
this.w = false;
this.nt = lottieAnimationView;
fVar.addUpdateListener(animatorUpdateListener);
}
private void dr() {
if (this.ha != null) {
return;
}
this.ha = new Canvas();
this.dr = new RectF();
this.hm = new Matrix();
this.n = new Matrix();
this.fm = new Rect();
this.y = new RectF();
this.ey = new com.bytedance.adsdk.lottie.b.b();
this.oq = new Rect();
this.ra = new Rect();
this.vo = new RectF();
}
private void ey() {
f fVar = this.yo;
if (fVar == null) {
return;
}
this.pd = this.o.b(Build.VERSION.SDK_INT, fVar.b(), fVar.iz());
}
private Context getContext() {
Drawable.Callback callback = getCallback();
if (callback != null && (callback instanceof View)) {
return ((View) callback).getContext();
}
return null;
}
private boolean hm() {
Drawable.Callback callback = getCallback();
if (!(callback instanceof View)) {
return false;
}
ViewParent parent = ((View) callback).getParent();
return (parent instanceof ViewGroup) && !((ViewGroup) parent).getClipChildren();
}
private boolean oq() {
return this.f || this.l;
}
private com.bytedance.adsdk.lottie.iz.iz ra() {
com.bytedance.adsdk.lottie.iz.iz izVar = this.v;
if (izVar != null && !izVar.b(getContext())) {
this.v = null;
}
if (this.v == null) {
this.v = new com.bytedance.adsdk.lottie.iz.iz(getCallback(), this.cd, this.u, this.yo.yk());
}
return this.v;
}
private com.bytedance.adsdk.lottie.iz.b vo() {
if (getCallback() == null) {
return null;
}
if (this.jc == null) {
com.bytedance.adsdk.lottie.iz.b bVar = new com.bytedance.adsdk.lottie.iz.b(getCallback(), this.iz);
this.jc = bVar;
String str = this.b;
if (str != null) {
bVar.b(str);
}
}
return this.jc;
}
public boolean am() {
return this.pd;
}
public void au() {
this.nr.removeAllUpdateListeners();
this.nr.addUpdateListener(this.g);
}
public int bw() {
return (int) this.nr.l();
}
public void c() {
this.vt.clear();
this.nr.cancel();
if (isVisible()) {
return;
}
this.k = iz.NONE;
}
@MainThread
public void cd() {
this.vt.clear();
this.nr.v();
if (isVisible()) {
return;
}
this.k = iz.NONE;
}
@Override
public void draw(Canvas canvas) {
nr.b("Drawable#draw");
try {
if (this.pd) {
b(canvas, this.bw);
} else {
b(canvas);
}
} catch (Throwable th) {
com.bytedance.adsdk.lottie.nr.nr.iz("Lottie crashed in draw!", th);
}
this.w = false;
nr.iz("Drawable#draw");
}
public f e() {
return this.yo;
}
public boolean f() {
return this.au;
}
@FloatRange(from = ShadowDrawableWrapper.COS_45, to = 1.0d)
public float fm() {
return this.nr.f();
}
public void g() {
if (this.nr.isRunning()) {
this.nr.cancel();
if (!isVisible()) {
this.k = iz.NONE;
}
}
this.yo = null;
com.bytedance.adsdk.lottie.model.layer.yo yoVar = this.bw;
if (yoVar != null) {
b(yoVar);
}
this.bw = null;
this.v = null;
this.nr.am();
invalidateSelf();
}
@Override
public int getAlpha() {
return this.m;
}
@Override
public int getIntrinsicHeight() {
f fVar = this.yo;
if (fVar == null) {
return -1;
}
return fVar.yo().height();
}
@Override
public int getIntrinsicWidth() {
f fVar = this.yo;
if (fVar == null) {
return -1;
}
return fVar.yo().width();
}
@Override
public int getOpacity() {
return -3;
}
public void ha() {
this.vt.clear();
this.nr.cd();
if (isVisible()) {
return;
}
this.k = iz.NONE;
}
public boolean i() {
if (isVisible()) {
return this.nr.isRunning();
}
iz izVar = this.k;
return izVar == iz.PLAY || izVar == iz.RESUME;
}
@Override
public void invalidateDrawable(Drawable drawable) {
Drawable.Callback callback = getCallback();
if (callback == null) {
return;
}
callback.invalidateDrawable(this);
}
@Override
public void invalidateSelf() {
if (this.w) {
return;
}
this.w = true;
Drawable.Callback callback = getCallback();
if (callback != null) {
callback.invalidateDrawable(this);
}
}
@Override
public boolean isRunning() {
return ma();
}
public float jb() {
return this.nr.jb();
}
public float jc() {
return this.nr.jc();
}
public au k() {
f fVar = this.yo;
if (fVar != null) {
return fVar.qp();
}
return null;
}
public void kc() {
this.nr.removeAllListeners();
}
public kc l() {
return this.pd ? kc.SOFTWARE : kc.HARDWARE;
}
@SuppressLint({"WrongConstant"})
public int m() {
return this.nr.getRepeatMode();
}
public boolean ma() {
com.bytedance.adsdk.lottie.nr.f fVar = this.nr;
if (fVar == null) {
return false;
}
return fVar.isRunning();
}
public String nr() {
return this.cd;
}
public bw o() {
return this.qp;
}
public boolean pd() {
return this.jb == null && this.qp == null && this.yo.jc().size() > 0;
}
public com.bytedance.adsdk.lottie.model.layer.yo qp() {
return this.bw;
}
@Override
public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
Drawable.Callback callback = getCallback();
if (callback == null) {
return;
}
callback.scheduleDrawable(this, runnable, j);
}
@Override
public void setAlpha(@IntRange(from = 0, to = 255) int i) {
this.m = i;
invalidateSelf();
}
@Override
public void setColorFilter(ColorFilter colorFilter) {
com.bytedance.adsdk.lottie.nr.nr.iz("Use addColorFilter instead.");
}
@Override
public boolean setVisible(boolean z, boolean z2) {
boolean z3 = !isVisible();
boolean visible = super.setVisible(z, z2);
if (z) {
iz izVar = this.k;
if (izVar == iz.PLAY) {
v();
} else if (izVar == iz.RESUME) {
u();
}
} else if (this.nr.isRunning()) {
ha();
this.k = iz.RESUME;
} else if (!z3) {
this.k = iz.NONE;
}
return visible;
}
@Override
@MainThread
public void start() {
Drawable.Callback callback = getCallback();
if ((callback instanceof View) && ((View) callback).isInEditMode()) {
return;
}
v();
}
@Override
@MainThread
public void stop() {
cd();
}
@MainThread
public void u() {
if (this.bw == null) {
this.vt.add(new b() {
@Override
public void b(f fVar) {
am.this.u();
}
});
return;
}
ey();
if (oq() || yv() == 0) {
if (isVisible()) {
this.nr.u();
this.k = iz.NONE;
} else {
this.k = iz.RESUME;
}
}
if (oq()) {
return;
}
qp((int) (yk() < 0.0f ? jc() : jb()));
this.nr.v();
if (isVisible()) {
return;
}
this.k = iz.NONE;
}
@Override
public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
Drawable.Callback callback = getCallback();
if (callback == null) {
return;
}
callback.unscheduleDrawable(this, runnable);
}
@MainThread
public void v() {
if (this.bw == null) {
this.vt.add(new b() {
@Override
public void b(f fVar) {
am.this.v();
}
});
return;
}
ey();
if (oq() || yv() == 0) {
if (isVisible()) {
this.nr.g();
this.k = iz.NONE;
} else {
this.k = iz.PLAY;
}
}
if (oq()) {
return;
}
qp((int) (yk() < 0.0f ? jc() : jb()));
this.nr.v();
if (isVisible()) {
return;
}
this.k = iz.NONE;
}
public boolean vt() {
return this.i;
}
public RectF y() {
return this.dr;
}
public float yk() {
return this.nr.vt();
}
public boolean yo() {
return this.kc;
}
public int yv() {
return this.nr.getRepeatCount();
}
public void am(boolean z) {
this.nr.qp(z);
}
public void b(m mVar) {
this.lw = mVar;
}
public void f(boolean z) {
this.am = z;
}
public LottieAnimationView iz() {
return this.nt;
}
public void l(boolean z) {
this.l = z;
}
public void nr(boolean z) {
this.i = z;
}
public void qp(boolean z) {
this.yv = z;
f fVar = this.yo;
if (fVar != null) {
fVar.iz(z);
}
}
public void yo(boolean z) {
if (this.ma == z) {
return;
}
this.ma = z;
com.bytedance.adsdk.lottie.model.layer.yo yoVar = this.bw;
if (yoVar != null) {
yoVar.b(z);
}
}
public m b() {
return this.lw;
}
public k f(String str) {
f fVar = this.yo;
if (fVar == null) {
return null;
}
return fVar.yk().get(str);
}
public void iz(boolean z) {
this.au = z;
}
public void l(String str) {
this.b = str;
com.bytedance.adsdk.lottie.iz.b vo = vo();
if (vo != null) {
vo.b(str);
}
}
public void nr(int i) {
this.nr.setRepeatCount(i);
}
public void b(boolean z, Context context) {
if (this.yk == z) {
return;
}
this.yk = z;
if (this.yo != null) {
b(context);
}
}
public void iz(final int i) {
if (this.yo == null) {
this.vt.add(new b() {
@Override
public void b(f fVar) {
am.this.iz(i);
}
});
} else {
this.nr.iz(i + 0.99f);
}
}
public Bitmap nr(String str) {
com.bytedance.adsdk.lottie.iz.iz ra = ra();
if (ra != null) {
return ra.b(str);
}
return null;
}
public void qp(final String str) {
f fVar = this.yo;
if (fVar == null) {
this.vt.add(new b() {
@Override
public void b(f fVar2) {
am.this.qp(str);
}
});
return;
}
com.bytedance.adsdk.lottie.model.f qp = fVar.qp(str);
if (qp != null) {
iz((int) (qp.b + qp.iz));
return;
}
throw new IllegalArgumentException("Cannot find marker with name " + str + ".");
}
public void yo(final String str) {
f fVar = this.yo;
if (fVar == null) {
this.vt.add(new b() {
@Override
public void b(f fVar2) {
am.this.yo(str);
}
});
return;
}
com.bytedance.adsdk.lottie.model.f qp = fVar.qp(str);
if (qp != null) {
int i = (int) qp.b;
b(i, ((int) qp.iz) + i);
} else {
throw new IllegalArgumentException("Cannot find marker with name " + str + ".");
}
}
public void iz(@FloatRange(from = 0.0d, to = 1.0d) final float f) {
f fVar = this.yo;
if (fVar == null) {
this.vt.add(new b() {
@Override
public void b(f fVar2) {
am.this.iz(f);
}
});
} else {
this.nr.iz(com.bytedance.adsdk.lottie.nr.am.b(fVar.f(), this.yo.l(), f));
}
}
public void b(boolean z) {
if (z != this.kc) {
this.kc = z;
com.bytedance.adsdk.lottie.model.layer.yo yoVar = this.bw;
if (yoVar != null) {
yoVar.iz(z);
}
invalidateSelf();
}
}
public void iz(final String str) {
f fVar = this.yo;
if (fVar == null) {
this.vt.add(new b() {
@Override
public void b(f fVar2) {
am.this.iz(str);
}
});
return;
}
com.bytedance.adsdk.lottie.model.f qp = fVar.qp(str);
if (qp != null) {
b((int) qp.b);
return;
}
throw new IllegalArgumentException("Cannot find marker with name " + str + ".");
}
public void qp(float f) {
this.nr.qp(f);
}
public void qp(final int i) {
if (this.yo == null) {
this.vt.add(new b() {
@Override
public void b(f fVar) {
am.this.qp(i);
}
});
} else {
this.nr.b(i);
}
}
public void yo(@FloatRange(from = 0.0d, to = 1.0d) final float f) {
if (this.yo == null) {
this.vt.add(new b() {
@Override
public void b(f fVar) {
am.this.yo(f);
}
});
return;
}
nr.b("Drawable#setProgress");
this.nr.b(this.yo.b(f));
nr.iz("Drawable#setProgress");
}
public void b(String str) {
this.cd = str;
}
public boolean b(f fVar, Context context) {
if (this.yo == fVar) {
return false;
}
this.w = true;
g();
this.yo = fVar;
b(context);
this.nr.b(fVar);
yo(this.nr.getAnimatedFraction());
Iterator it = new ArrayList(this.vt).iterator();
while (it.hasNext()) {
b bVar = (b) it.next();
if (bVar != null) {
bVar.b(fVar);
}
it.remove();
}
this.vt.clear();
fVar.iz(this.yv);
ey();
Drawable.Callback callback = getCallback();
if (callback instanceof ImageView) {
ImageView imageView = (ImageView) callback;
imageView.setImageDrawable(null);
imageView.setImageDrawable(this);
}
return true;
}
public void iz(ValueAnimator.AnimatorUpdateListener animatorUpdateListener) {
this.nr.removeUpdateListener(animatorUpdateListener);
}
public void iz(Animator.AnimatorListener animatorListener) {
this.nr.removeListener(animatorListener);
}
private void iz(int i, int i2) {
Bitmap bitmap = this.c;
if (bitmap != null && bitmap.getWidth() >= i && this.c.getHeight() >= i2) {
if (this.c.getWidth() > i || this.c.getHeight() > i2) {
Bitmap createBitmap = Bitmap.createBitmap(this.c, 0, 0, i, i2);
this.c = createBitmap;
this.ha.setBitmap(createBitmap);
this.w = true;
return;
}
return;
}
Bitmap createBitmap2 = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
this.c = createBitmap2;
this.ha.setBitmap(createBitmap2);
this.w = true;
}
public void yo(int i) {
this.nr.setRepeatMode(i);
}
public void b(kc kcVar) {
this.o = kcVar;
ey();
}
private void b(Context context) {
f fVar = this.yo;
if (fVar == null) {
return;
}
com.bytedance.adsdk.lottie.model.layer.yo yoVar = this.bw;
if (yoVar != null) {
b(yoVar);
}
com.bytedance.adsdk.lottie.model.layer.yo yoVar2 = new com.bytedance.adsdk.lottie.model.layer.yo(this, yv.b(fVar), fVar.u(), fVar, context);
this.bw = yoVar2;
if (this.ma) {
yoVar2.b(true);
}
this.bw.iz(this.kc);
}
private void b(com.bytedance.adsdk.lottie.model.layer.yo yoVar) {
if (yoVar != null) {
yoVar.qp();
List<com.bytedance.adsdk.lottie.model.layer.qp> u = yoVar.u();
if (u != null) {
for (com.bytedance.adsdk.lottie.model.layer.qp qpVar : u) {
if (qpVar instanceof com.bytedance.adsdk.lottie.model.layer.yo) {
b((com.bytedance.adsdk.lottie.model.layer.yo) qpVar);
} else if (qpVar != null) {
qpVar.qp();
}
}
}
}
}
public void b(final int i) {
if (this.yo == null) {
this.vt.add(new b() {
@Override
public void b(f fVar) {
am.this.b(i);
}
});
} else {
this.nr.b(i);
}
}
public void b(final float f) {
f fVar = this.yo;
if (fVar == null) {
this.vt.add(new b() {
@Override
public void b(f fVar2) {
am.this.b(f);
}
});
} else {
b((int) com.bytedance.adsdk.lottie.nr.am.b(fVar.f(), this.yo.l(), f));
}
}
public void b(final int i, final int i2) {
if (this.yo == null) {
this.vt.add(new b() {
@Override
public void b(f fVar) {
am.this.b(i, i2);
}
});
} else {
this.nr.b(i, i2 + 0.99f);
}
}
public void b(ValueAnimator.AnimatorUpdateListener animatorUpdateListener) {
this.nr.addUpdateListener(animatorUpdateListener);
}
public void b(Animator.AnimatorListener animatorListener) {
this.nr.addListener(animatorListener);
}
public void b(Boolean bool) {
this.f = bool.booleanValue();
}
public void b(yo yoVar) {
this.u = yoVar;
com.bytedance.adsdk.lottie.iz.iz izVar = this.v;
if (izVar != null) {
izVar.b(yoVar);
}
}
public void b(qp qpVar) {
this.iz = qpVar;
com.bytedance.adsdk.lottie.iz.b bVar = this.jc;
if (bVar != null) {
bVar.b(qpVar);
}
}
public void b(Map<String, Typeface> map) {
if (map == this.jb) {
return;
}
this.jb = map;
invalidateSelf();
}
public void b(bw bwVar) {
this.qp = bwVar;
}
public Bitmap b(String str, Bitmap bitmap) {
com.bytedance.adsdk.lottie.iz.iz ra = ra();
if (ra == null) {
com.bytedance.adsdk.lottie.nr.nr.iz("Cannot update bitmap. Most likely the drawable is not added to a View which prevents Lottie from getting a Context.");
return null;
}
Bitmap b2 = ra.b(str, bitmap);
invalidateSelf();
return b2;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public Typeface b(com.bytedance.adsdk.lottie.model.qp qpVar) {
Map<String, Typeface> map = this.jb;
if (map != null) {
String b2 = qpVar.b();
if (map.containsKey(b2)) {
return map.get(b2);
}
String iz2 = qpVar.iz();
if (map.containsKey(iz2)) {
return map.get(iz2);
}
String str = qpVar.b() + "-" + qpVar.qp();
if (map.containsKey(str)) {
return map.get(str);
}
}
com.bytedance.adsdk.lottie.iz.b vo = vo();
if (vo != null) {
return vo.b(qpVar);
}
return null;
}
private void b(Canvas canvas) {
com.bytedance.adsdk.lottie.model.layer.yo yoVar = this.bw;
f fVar = this.yo;
if (yoVar == null || fVar == null) {
return;
}
this.e.reset();
if (!getBounds().isEmpty()) {
this.e.preScale(r2.width() / fVar.yo().width(), r2.height() / fVar.yo().height());
this.e.preTranslate(r2.left, r2.top);
}
yoVar.b(canvas, this.e, this.m);
}
private void b(Canvas canvas, com.bytedance.adsdk.lottie.model.layer.yo yoVar) {
if (this.yo == null || yoVar == null) {
return;
}
dr();
canvas.getMatrix(this.hm);
canvas.getClipBounds(this.fm);
b(this.fm, this.y);
this.hm.mapRect(this.y);
b(this.y, this.fm);
if (this.kc) {
this.dr.set(0.0f, 0.0f, getIntrinsicWidth(), getIntrinsicHeight());
} else {
yoVar.b(this.dr, (Matrix) null, false);
}
this.hm.mapRect(this.dr);
Rect bounds = getBounds();
float width = bounds.width() / getIntrinsicWidth();
float height = bounds.height() / getIntrinsicHeight();
b(this.dr, width, height);
if (!hm()) {
RectF rectF = this.dr;
Rect rect = this.fm;
rectF.intersect(rect.left, rect.top, rect.right, rect.bottom);
}
int ceil = (int) Math.ceil(this.dr.width());
int ceil2 = (int) Math.ceil(this.dr.height());
if (ceil == 0 || ceil2 == 0) {
return;
}
iz(ceil, ceil2);
if (this.w) {
this.e.set(this.hm);
this.e.preScale(width, height);
Matrix matrix = this.e;
RectF rectF2 = this.dr;
matrix.postTranslate(-rectF2.left, -rectF2.top);
this.c.eraseColor(0);
yoVar.b(this.ha, this.e, this.m);
this.hm.invert(this.n);
this.n.mapRect(this.vo, this.dr);
b(this.vo, this.ra);
}
this.oq.set(0, 0, ceil, ceil2);
canvas.drawBitmap(this.c, this.oq, this.ra, this.ey);
}
private void b(RectF rectF, Rect rect) {
rect.set((int) Math.floor(rectF.left), (int) Math.floor(rectF.top), (int) Math.ceil(rectF.right), (int) Math.ceil(rectF.bottom));
}
private void b(Rect rect, RectF rectF) {
rectF.set(rect.left, rect.top, rect.right, rect.bottom);
}
private void b(RectF rectF, float f, float f2) {
rectF.set(rectF.left * f, rectF.top * f2, rectF.right * f, rectF.bottom * f2);
}
}