导航菜单

页面标题

页面副标题

漫天星 v3.0.2 - h.java 源代码

正在查看: 漫天星 v3.0.2 应用的 h.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package f.p.c.k.n.a;

import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewParent;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.exifinterface.media.ExifInterface;
import com.google.android.material.bottomappbar.BottomAppBarTopEdgeTreatment;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.locks.ReadWriteLock;

public class h extends View {
    public static final String M0 = h.class.getSimpleName();
    public static final List<Integer> N0 = Arrays.asList(0, 90, 180, Integer.valueOf(BottomAppBarTopEdgeTreatment.ANGLE_UP), -1);
    public static final List<Integer> O0 = Arrays.asList(1, 2, 3);
    public static final List<Integer> P0 = Arrays.asList(2, 1);
    public static final List<Integer> Q0 = Arrays.asList(1, 2, 3);
    public static final List<Integer> R0 = Arrays.asList(2, 1, 3, 4);
    public static Bitmap.Config S0;
    public int A;
    public InterfaceC0061h A0;
    public int B;
    public final Handler B0;
    public Executor C;
    public Paint C0;
    public boolean D;
    public Paint D0;
    public boolean E;
    public Paint E0;
    public boolean F;
    public Paint F0;
    public boolean G;
    public i G0;
    public float H;
    public Matrix H0;
    public int I;
    public RectF I0;
    public int J;
    public final float[] J0;
    public float K;
    public final float[] K0;
    public float L;
    public final float L0;
    public PointF M;
    public PointF N;
    public PointF O;
    public Float P;
    public PointF Q;
    public PointF R;
    public int S;
    public int T;
    public int U;
    public Rect V;
    public Rect W;
    public boolean e0;
    public boolean f0;
    public boolean g0;
    public int h0;
    public GestureDetector i0;
    public GestureDetector j0;
    public f.p.c.k.n.a.d k0;
    public final ReadWriteLock l0;
    public f.p.c.k.n.a.b<? extends f.p.c.k.n.a.c> m0;
    public Bitmap n;
    public f.p.c.k.n.a.b<? extends f.p.c.k.n.a.d> n0;
    public boolean o;
    public PointF o0;
    public boolean p;
    public float p0;
    public Uri q;
    public final float q0;
    public int r;
    public float r0;
    public Map<Integer, List<j>> s;
    public boolean s0;
    public boolean t;
    public PointF t0;
    public int u;
    public PointF u0;
    public float v;
    public PointF v0;
    public float w;
    public c w0;
    public int x;
    public boolean x0;
    public int y;
    public boolean y0;
    public int z;
    public g z0;

    public class a extends GestureDetector.SimpleOnGestureListener {
        public final Context n;

        public a(Context context) {
            this.n = context;
        }

        @Override
        public boolean onDoubleTap(MotionEvent motionEvent) {
            if (!h.this.F || !h.this.x0 || h.this.M == null) {
                return super.onDoubleTapEvent(motionEvent);
            }
            h.this.setGestureDetector(this.n);
            if (!h.this.G) {
                h hVar = h.this;
                hVar.R(hVar.J0(new PointF(motionEvent.getX(), motionEvent.getY())), new PointF(motionEvent.getX(), motionEvent.getY()));
                return true;
            }
            h.this.o0 = new PointF(motionEvent.getX(), motionEvent.getY());
            h.this.N = new PointF(h.this.M.x, h.this.M.y);
            h hVar2 = h.this;
            hVar2.L = hVar2.K;
            h.this.g0 = true;
            h.this.e0 = true;
            h.this.r0 = -1.0f;
            h hVar3 = h.this;
            hVar3.u0 = hVar3.J0(hVar3.o0);
            h.this.v0 = new PointF(motionEvent.getX(), motionEvent.getY());
            h.this.t0 = new PointF(h.this.u0.x, h.this.u0.y);
            h.this.s0 = false;
            return false;
        }

        @Override
        public boolean onFling(MotionEvent motionEvent, MotionEvent motionEvent2, float f2, float f3) {
            if (!h.this.E || !h.this.x0 || h.this.M == null || motionEvent == null || motionEvent2 == null || ((Math.abs(motionEvent.getX() - motionEvent2.getX()) <= 50.0f && Math.abs(motionEvent.getY() - motionEvent2.getY()) <= 50.0f) || ((Math.abs(f2) <= 500.0f && Math.abs(f3) <= 500.0f) || h.this.e0))) {
                return super.onFling(motionEvent, motionEvent2, f2, f3);
            }
            PointF pointF = new PointF(h.this.M.x + (f2 * 0.25f), h.this.M.y + (f3 * 0.25f));
            d dVar = new d(h.this, new PointF(((h.this.getWidth() / 2) - pointF.x) / h.this.K, ((h.this.getHeight() / 2) - pointF.y) / h.this.K), (f.p.c.k.n.a.g) null);
            dVar.e(1);
            d.a(dVar, false);
            d.b(dVar, 3);
            dVar.c();
            return true;
        }

        @Override
        public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
            h.this.performClick();
            return true;
        }
    }

    public class b extends GestureDetector.SimpleOnGestureListener {
        public b() {
        }

        @Override
        public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
            h.this.performClick();
            return true;
        }
    }

    public final class d {
        public final float a;
        public final PointF b;
        public final PointF c;
        public long d;
        public int e;

        public int f88f;

        public boolean f89g;
        public boolean h;
        public f i;

        public d(h hVar, float f2, PointF pointF, PointF pointF2, f.p.c.k.n.a.g gVar) {
            this(f2, pointF, pointF2);
        }

        public static d a(d dVar, boolean z) {
            dVar.h(z);
            return dVar;
        }

        public static d b(d dVar, int i) {
            dVar.g(i);
            return dVar;
        }

        public void c() {
            PointF pointF;
            if (h.this.w0 != null && h.this.w0.m != null) {
                try {
                    h.this.w0.m.b();
                } catch (Exception e) {
                    Log.w(h.M0, "Error thrown by animation listener", e);
                }
            }
            int paddingLeft = h.this.getPaddingLeft() + (((h.this.getWidth() - h.this.getPaddingRight()) - h.this.getPaddingLeft()) / 2);
            int paddingTop = h.this.getPaddingTop() + (((h.this.getHeight() - h.this.getPaddingBottom()) - h.this.getPaddingTop()) / 2);
            float g0 = h.this.g0(this.a);
            if (this.h) {
                h hVar = h.this;
                PointF pointF2 = this.b;
                float f2 = pointF2.x;
                float f3 = pointF2.y;
                pointF = new PointF();
                h.F(hVar, f2, f3, g0, pointF);
            } else {
                pointF = this.b;
            }
            f.p.c.k.n.a.g gVar = null;
            h.this.w0 = new c(gVar);
            h.this.w0.a = h.this.K;
            h.this.w0.b = g0;
            h.this.w0.l = System.currentTimeMillis();
            h.this.w0.e = pointF;
            h.this.w0.c = h.this.getCenter();
            h.this.w0.d = pointF;
            h.this.w0.f86f = h.this.B0(pointF);
            h.this.w0.f87g = new PointF(paddingLeft, paddingTop);
            h.this.w0.h = this.d;
            h.this.w0.i = this.f89g;
            h.this.w0.j = this.e;
            h.this.w0.k = this.f88f;
            h.this.w0.l = System.currentTimeMillis();
            h.this.w0.m = this.i;
            PointF pointF3 = this.c;
            if (pointF3 != null) {
                float f4 = pointF3.x - (h.this.w0.c.x * g0);
                float f5 = this.c.y - (h.this.w0.c.y * g0);
                i iVar = new i(g0, new PointF(f4, f5), gVar);
                h.this.Y(true, iVar);
                h.this.w0.f87g = new PointF(this.c.x + (iVar.b.x - f4), this.c.y + (iVar.b.y - f5));
            }
            h.this.invalidate();
        }

        @NonNull
        public d d(long j) {
            this.d = j;
            return this;
        }

        @NonNull
        public d e(int i) {
            if (h.P0.contains(Integer.valueOf(i))) {
                this.e = i;
                return this;
            }
            throw new IllegalArgumentException("Unknown easing type: " + i);
        }

        @NonNull
        public d f(boolean z) {
            this.f89g = z;
            return this;
        }

        @NonNull
        public final d g(int i) {
            this.f88f = i;
            return this;
        }

        @NonNull
        public final d h(boolean z) {
            this.h = z;
            return this;
        }

        public d(h hVar, float f2, PointF pointF, f.p.c.k.n.a.g gVar) {
            this(f2, pointF);
        }

        public d(h hVar, PointF pointF, f.p.c.k.n.a.g gVar) {
            this(pointF);
        }

        public d(PointF pointF) {
            this.d = 500L;
            this.e = 2;
            this.f88f = 1;
            this.f89g = true;
            this.h = true;
            this.a = h.this.K;
            this.b = pointF;
            this.c = null;
        }

        public d(float f2, PointF pointF) {
            this.d = 500L;
            this.e = 2;
            this.f88f = 1;
            this.f89g = true;
            this.h = true;
            this.a = f2;
            this.b = pointF;
            this.c = null;
        }

        public d(float f2, PointF pointF, PointF pointF2) {
            this.d = 500L;
            this.e = 2;
            this.f88f = 1;
            this.f89g = true;
            this.h = true;
            this.a = f2;
            this.b = pointF;
            this.c = pointF2;
        }
    }

    public static class e extends AsyncTask<Void, Void, Integer> {
        public final WeakReference<h> a;
        public final WeakReference<Context> b;
        public final WeakReference<f.p.c.k.n.a.b<? extends f.p.c.k.n.a.c>> c;
        public final Uri d;
        public final boolean e;

        public Bitmap f90f;

        public Exception f91g;

        public e(h hVar, Context context, f.p.c.k.n.a.b<? extends f.p.c.k.n.a.c> bVar, Uri uri, boolean z) {
            this.a = new WeakReference<>(hVar);
            this.b = new WeakReference<>(context);
            this.c = new WeakReference<>(bVar);
            this.d = uri;
            this.e = z;
        }

        @Override
        public Integer doInBackground(Void... voidArr) {
            try {
                String uri = this.d.toString();
                Context context = this.b.get();
                f.p.c.k.n.a.b<? extends f.p.c.k.n.a.c> bVar = this.c.get();
                h hVar = this.a.get();
                if (context == null || bVar == null || hVar == null) {
                    return null;
                }
                hVar.P("BitmapLoadTask.doInBackground", new Object[0]);
                this.f90f = bVar.a().a(context, this.d);
                return Integer.valueOf(hVar.Z(context, uri));
            } catch (Exception e) {
                Log.e(h.M0, "Failed to load bitmap", e);
                this.f91g = e;
                return null;
            } catch (OutOfMemoryError e2) {
                Log.e(h.M0, "Failed to load bitmap - OutOfMemoryError", e2);
                this.f91g = new RuntimeException(e2);
                return null;
            }
        }

        @Override
        public void onPostExecute(Integer num) {
            h hVar = this.a.get();
            if (hVar != null) {
                Bitmap bitmap = this.f90f;
                if (bitmap != null && num != null) {
                    if (this.e) {
                        hVar.k0(bitmap);
                        return;
                    } else {
                        hVar.j0(bitmap, num.intValue(), false);
                        return;
                    }
                }
                if (this.f91g == null || hVar.z0 == null) {
                    return;
                }
                if (this.e) {
                    hVar.z0.b(this.f91g);
                } else {
                    hVar.z0.f(this.f91g);
                }
            }
        }
    }

    public interface f {
        void a();

        void b();

        void onComplete();
    }

    public interface g {
        void a();

        void b(Exception exc);

        void c(Exception exc);

        void d();

        void e();

        void f(Exception exc);
    }

    public interface InterfaceC0061h {
        void a(float f2, int i);

        void b(PointF pointF, int i);
    }

    public static class i {
        public float a;
        public final PointF b;

        public i(float f2, PointF pointF, f.p.c.k.n.a.g gVar) {
            this(f2, pointF);
        }

        public i(float f2, PointF pointF) {
            this.a = f2;
            this.b = pointF;
        }
    }

    public static class j {
        public Rect a;
        public int b;
        public Bitmap c;
        public boolean d;
        public boolean e;

        public Rect f92f;

        public Rect f93g;

        public j() {
        }

        public j(f.p.c.k.n.a.g gVar) {
            this();
        }
    }

    public static class k extends AsyncTask<Void, Void, Bitmap> {
        public final WeakReference<h> a;
        public final WeakReference<f.p.c.k.n.a.d> b;
        public final WeakReference<j> c;
        public Exception d;

        public k(h hVar, f.p.c.k.n.a.d dVar, j jVar) {
            this.a = new WeakReference<>(hVar);
            this.b = new WeakReference<>(dVar);
            this.c = new WeakReference<>(jVar);
            jVar.d = true;
        }

        @Override
        public Bitmap doInBackground(Void... voidArr) {
            try {
                h hVar = this.a.get();
                f.p.c.k.n.a.d dVar = this.b.get();
                j jVar = this.c.get();
                if (dVar == null || jVar == null || hVar == null || !dVar.isReady() || !jVar.e) {
                    if (jVar == null) {
                        return null;
                    }
                    jVar.d = false;
                    return null;
                }
                hVar.P("TileLoadTask.doInBackground, tile.sRect=%s, tile.sampleSize=%d", jVar.a, Integer.valueOf(jVar.b));
                hVar.l0.readLock().lock();
                try {
                    if (!dVar.isReady()) {
                        jVar.d = false;
                        hVar.l0.readLock().unlock();
                        return null;
                    }
                    hVar.W(jVar.a, jVar.f93g);
                    if (hVar.V != null) {
                        jVar.f93g.offset(hVar.V.left, hVar.V.top);
                    }
                    return dVar.b(jVar.f93g, jVar.b);
                } finally {
                    hVar.l0.readLock().unlock();
                }
            } catch (Exception e) {
                Log.e(h.M0, "Failed to decode tile", e);
                this.d = e;
                return null;
            } catch (OutOfMemoryError e2) {
                Log.e(h.M0, "Failed to decode tile - OutOfMemoryError", e2);
                this.d = new RuntimeException(e2);
                return null;
            }
        }

        @Override
        public void onPostExecute(Bitmap bitmap) {
            h hVar = this.a.get();
            j jVar = this.c.get();
            if (hVar == null || jVar == null) {
                return;
            }
            if (bitmap != null) {
                jVar.c = bitmap;
                jVar.d = false;
                hVar.m0();
            } else {
                if (this.d == null || hVar.z0 == null) {
                    return;
                }
                hVar.z0.c(this.d);
            }
        }
    }

    public static PointF F(h hVar, float f2, float f3, float f4, PointF pointF) {
        hVar.f0(f2, f3, f4, pointF);
        return pointF;
    }

    public static Bitmap.Config getPreferredBitmapConfig() {
        return S0;
    }

    @AnyThread
    private int getRequiredRotation() {
        int i2 = this.u;
        return i2 == -1 ? this.U : i2;
    }

    public void setGestureDetector(Context context) {
        this.i0 = new GestureDetector(context, new a(context));
        this.j0 = new GestureDetector(context, new b());
    }

    public static void setPreferredBitmapConfig(Bitmap.Config config) {
        S0 = config;
    }

    @Nullable
    public final PointF A0(float f2, float f3, @NonNull PointF pointF) {
        if (this.M == null) {
            return null;
        }
        pointF.set(D0(f2), E0(f3));
        return pointF;
    }

    @Nullable
    public final PointF B0(PointF pointF) {
        return A0(pointF.x, pointF.y, new PointF());
    }

    public final void C0(@NonNull Rect rect, @NonNull Rect rect2) {
        rect2.set((int) D0(rect.left), (int) E0(rect.top), (int) D0(rect.right), (int) E0(rect.bottom));
    }

    public final float D0(float f2) {
        PointF pointF = this.M;
        if (pointF == null) {
            return Float.NaN;
        }
        return (f2 * this.K) + pointF.x;
    }

    public final float E0(float f2) {
        PointF pointF = this.M;
        if (pointF == null) {
            return Float.NaN;
        }
        return (f2 * this.K) + pointF.y;
    }

    public final boolean F0(j jVar) {
        return K0(0.0f) <= ((float) jVar.a.right) && ((float) jVar.a.left) <= K0((float) getWidth()) && L0(0.0f) <= ((float) jVar.a.bottom) && ((float) jVar.a.top) <= L0((float) getHeight());
    }

    @NonNull
    public final PointF G0(float f2, float f3, float f4) {
        int paddingLeft = getPaddingLeft() + (((getWidth() - getPaddingRight()) - getPaddingLeft()) / 2);
        int paddingTop = getPaddingTop() + (((getHeight() - getPaddingBottom()) - getPaddingTop()) / 2);
        if (this.G0 == null) {
            this.G0 = new i(0.0f, new PointF(0.0f, 0.0f), null);
        }
        this.G0.a = f4;
        this.G0.b.set(paddingLeft - (f2 * f4), paddingTop - (f3 * f4));
        Y(true, this.G0);
        return this.G0.b;
    }

    @Nullable
    public final PointF H0(float f2, float f3) {
        return I0(f2, f3, new PointF());
    }

    @Nullable
    public final PointF I0(float f2, float f3, @NonNull PointF pointF) {
        if (this.M == null) {
            return null;
        }
        pointF.set(K0(f2), L0(f3));
        return pointF;
    }

    @Nullable
    public final PointF J0(PointF pointF) {
        return I0(pointF.x, pointF.y, new PointF());
    }

    public final float K0(float f2) {
        PointF pointF = this.M;
        if (pointF == null) {
            return Float.NaN;
        }
        return (f2 - pointF.x) / this.K;
    }

    public final int L(float f2) {
        int round;
        if (this.x > 0) {
            DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
            f2 *= this.x / ((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f);
        }
        int v0 = (int) (v0() * f2);
        int u0 = (int) (u0() * f2);
        if (v0 == 0 || u0 == 0) {
            return 32;
        }
        int i2 = 1;
        if (u0() > u0 || v0() > v0) {
            round = Math.round(u0() / u0);
            int round2 = Math.round(v0() / v0);
            if (round >= round2) {
                round = round2;
            }
        } else {
            round = 1;
        }
        while (true) {
            int i3 = i2 * 2;
            if (i3 >= round) {
                return i2;
            }
            i2 = i3;
        }
    }

    public final float L0(float f2) {
        PointF pointF = this.M;
        if (pointF == null) {
            return Float.NaN;
        }
        return (f2 - pointF.y) / this.K;
    }

    public final boolean M() {
        boolean d0 = d0();
        if (!this.y0 && d0) {
            o0();
            this.y0 = true;
            i0();
            g gVar = this.z0;
            if (gVar != null) {
                gVar.a();
            }
        }
        return d0;
    }

    public final boolean N() {
        boolean z = getWidth() > 0 && getHeight() > 0 && this.S > 0 && this.T > 0 && (this.n != null || d0());
        if (!this.x0 && z) {
            o0();
            this.x0 = true;
            l0();
            g gVar = this.z0;
            if (gVar != null) {
                gVar.e();
            }
        }
        return z;
    }

    public final void O() {
        if (this.C0 == null) {
            Paint paint = new Paint();
            this.C0 = paint;
            paint.setAntiAlias(true);
            this.C0.setFilterBitmap(true);
            this.C0.setDither(true);
        }
        if ((this.D0 == null || this.E0 == null) && this.t) {
            Paint paint2 = new Paint();
            this.D0 = paint2;
            paint2.setTextSize(p0(12));
            this.D0.setColor(-65281);
            this.D0.setStyle(Paint.Style.FILL);
            Paint paint3 = new Paint();
            this.E0 = paint3;
            paint3.setColor(-65281);
            this.E0.setStyle(Paint.Style.STROKE);
            this.E0.setStrokeWidth(p0(1));
        }
    }

    @AnyThread
    public final void P(String str, Object... objArr) {
        if (this.t) {
            Log.d(M0, String.format(str, objArr));
        }
    }

    public final float Q(float f2, float f3, float f4, float f5) {
        float f6 = f2 - f3;
        float f7 = f4 - f5;
        return (float) Math.sqrt((f6 * f6) + (f7 * f7));
    }

    public final void R(PointF pointF, PointF pointF2) {
        if (!this.E) {
            PointF pointF3 = this.R;
            if (pointF3 != null) {
                pointF.x = pointF3.x;
                pointF.y = pointF3.y;
            } else {
                pointF.x = v0() / 2;
                pointF.y = u0() / 2;
            }
        }
        float min = Math.min(this.v, this.H);
        float f2 = this.K;
        boolean z = ((double) f2) <= ((double) min) * 0.9d || f2 == this.w;
        if (!z) {
            min = h0();
        }
        float f3 = min;
        int i2 = this.I;
        if (i2 == 3) {
            z0(f3, pointF);
        } else if (i2 == 2 || !z || !this.E) {
            d dVar = new d(this, f3, pointF, (f.p.c.k.n.a.g) null);
            dVar.f(false);
            dVar.d(this.J);
            d.b(dVar, 4);
            dVar.c();
        } else if (i2 == 1) {
            d dVar2 = new d(this, f3, pointF, pointF2, null);
            dVar2.f(false);
            dVar2.d(this.J);
            d.b(dVar2, 4);
            dVar2.c();
        }
        invalidate();
    }

    public final float S(int i2, long j2, float f2, float f3, long j3) {
        if (i2 == 1) {
            return U(j2, f2, f3, j3);
        }
        if (i2 == 2) {
            return T(j2, f2, f3, j3);
        }
        throw new IllegalStateException("Unexpected easing type: " + i2);
    }

    public final float T(long j2, float f2, float f3, long j3) {
        float f4;
        float f5 = j2 / (j3 / 2.0f);
        if (f5 < 1.0f) {
            f4 = (f3 / 2.0f) * f5;
        } else {
            float f6 = f5 - 1.0f;
            f4 = (-f3) / 2.0f;
            f5 = (f6 * (f6 - 2.0f)) - 1.0f;
        }
        return (f4 * f5) + f2;
    }

    public final float U(long j2, float f2, float f3, long j3) {
        float f4 = j2 / j3;
        return ((-f3) * f4 * (f4 - 2.0f)) + f2;
    }

    public final void V(AsyncTask<Void, Void, ?> asyncTask) {
        asyncTask.executeOnExecutor(this.C, new Void[0]);
    }

    @AnyThread
    public final void W(Rect rect, Rect rect2) {
        if (getRequiredRotation() == 0) {
            rect2.set(rect);
            return;
        }
        if (getRequiredRotation() == 90) {
            int i2 = rect.top;
            int i3 = this.T;
            rect2.set(i2, i3 - rect.right, rect.bottom, i3 - rect.left);
        } else if (getRequiredRotation() != 180) {
            int i4 = this.S;
            rect2.set(i4 - rect.bottom, rect.left, i4 - rect.top, rect.right);
        } else {
            int i5 = this.S;
            int i6 = i5 - rect.right;
            int i7 = this.T;
            rect2.set(i6, i7 - rect.bottom, i5 - rect.left, i7 - rect.top);
        }
    }

    public final void X(boolean z) {
        boolean z2;
        float f2 = 0.0f;
        if (this.M == null) {
            z2 = true;
            this.M = new PointF(0.0f, 0.0f);
        } else {
            z2 = false;
        }
        if (this.G0 == null) {
            this.G0 = new i(f2, new PointF(0.0f, 0.0f), null);
        }
        this.G0.a = this.K;
        this.G0.b.set(this.M);
        Y(z, this.G0);
        this.K = this.G0.a;
        this.M.set(this.G0.b);
        if (!z2 || this.z == 4) {
            return;
        }
        this.M.set(G0(v0() / 2, u0() / 2, this.K));
    }

    public final void Y(boolean z, i iVar) {
        float max;
        int max2;
        float max3;
        if (this.y == 2 && e0()) {
            z = false;
        }
        PointF pointF = iVar.b;
        float g0 = g0(iVar.a);
        float v0 = v0() * g0;
        float u0 = u0() * g0;
        if (this.y == 3 && e0()) {
            pointF.x = Math.max(pointF.x, (getWidth() / 2) - v0);
            pointF.y = Math.max(pointF.y, (getHeight() / 2) - u0);
        } else if (z) {
            pointF.x = Math.max(pointF.x, getWidth() - v0);
            pointF.y = Math.max(pointF.y, getHeight() - u0);
        } else {
            pointF.x = Math.max(pointF.x, -v0);
            pointF.y = Math.max(pointF.y, -u0);
        }
        float paddingLeft = (getPaddingLeft() > 0 || getPaddingRight() > 0) ? getPaddingLeft() / (getPaddingLeft() + getPaddingRight()) : 0.5f;
        float paddingTop = (getPaddingTop() > 0 || getPaddingBottom() > 0) ? getPaddingTop() / (getPaddingTop() + getPaddingBottom()) : 0.5f;
        if (this.y == 3 && e0()) {
            max = Math.max(0, getWidth() / 2);
            max2 = Math.max(0, getHeight() / 2);
        } else {
            if (z) {
                max = Math.max(0.0f, (getWidth() - v0) * paddingLeft);
                max3 = Math.max(0.0f, (getHeight() - u0) * paddingTop);
                pointF.x = Math.min(pointF.x, max);
                pointF.y = Math.min(pointF.y, max3);
                iVar.a = g0;
            }
            max = Math.max(0, getWidth());
            max2 = Math.max(0, getHeight());
        }
        max3 = max2;
        pointF.x = Math.min(pointF.x, max);
        pointF.y = Math.min(pointF.y, max3);
        iVar.a = g0;
    }

    @AnyThread
    public final int Z(Context context, String str) {
        int i2;
        int i3 = 0;
        if (!str.startsWith("content")) {
            if (!str.startsWith("file:///") || str.startsWith("file:///android_asset/")) {
                return 0;
            }
            try {
                int attributeInt = new ExifInterface(str.substring(7)).getAttributeInt("Orientation", 1);
                if (attributeInt != 1 && attributeInt != 0) {
                    if (attributeInt == 6) {
                        i2 = 90;
                    } else if (attributeInt == 3) {
                        i2 = 180;
                    } else {
                        if (attributeInt != 8) {
                            Log.w(M0, "Unsupported EXIF orientation: " + attributeInt);
                            return 0;
                        }
                        i2 = BottomAppBarTopEdgeTreatment.ANGLE_UP;
                    }
                    return i2;
                }
                return 0;
            } catch (Exception unused) {
                Log.w(M0, "Could not get EXIF orientation of image");
                return 0;
            }
        }
        Cursor cursor = null;
        try {
            try {
                cursor = context.getContentResolver().query(Uri.parse(str), new String[]{"orientation"}, null, null, null);
                if (cursor != null && cursor.moveToFirst()) {
                    int i4 = cursor.getInt(0);
                    if (!N0.contains(Integer.valueOf(i4)) || i4 == -1) {
                        Log.w(M0, "Unsupported orientation: " + i4);
                    } else {
                        i3 = i4;
                    }
                }
                if (cursor == null) {
                    return i3;
                }
            } catch (Exception unused2) {
                Log.w(M0, "Could not get orientation of image from media store");
                if (cursor == null) {
                    return 0;
                }
            }
            cursor.close();
            return i3;
        } catch (Throwable th) {
            if (cursor != null) {
                cursor.close();
            }
            throw th;
        }
    }

    @NonNull
    public final Point a0(Canvas canvas) {
        return new Point(Math.min(canvas.getMaximumBitmapWidth(), this.A), Math.min(canvas.getMaximumBitmapHeight(), this.B));
    }

    public final synchronized void b0(@NonNull Point point) {
        P("initialiseBaseLayer maxTileDimensions=%dx%d", Integer.valueOf(point.x), Integer.valueOf(point.y));
        i iVar = new i(0.0f, new PointF(0.0f, 0.0f), null);
        this.G0 = iVar;
        Y(true, iVar);
        int L = L(this.G0.a);
        this.r = L;
        if (L > 1) {
            this.r = L / 2;
        }
        if (this.r != 1 || this.V != null || v0() >= point.x || u0() >= point.y) {
            c0(point);
            Iterator<j> it = this.s.get(Integer.valueOf(this.r)).iterator();
            while (it.hasNext()) {
                V(new k(this, this.k0, it.next()));
            }
            q0(true);
        } else {
            this.k0.recycle();
            this.k0 = null;
            V(new e(this, getContext(), this.m0, this.q, false));
        }
    }

    public final void c0(Point point) {
        int i2 = 0;
        int i3 = 1;
        P("initialiseTileMap maxTileDimensions=%dx%d", Integer.valueOf(point.x), Integer.valueOf(point.y));
        this.s = new LinkedHashMap();
        int i4 = this.r;
        int i5 = 1;
        int i6 = 1;
        while (true) {
            int v0 = v0() / i5;
            int u0 = u0() / i6;
            int i7 = v0 / i4;
            int i8 = u0 / i4;
            while (true) {
                if (i7 + i5 + i3 > point.x || (i7 > getWidth() * 1.25d && i4 < this.r)) {
                    i5++;
                    v0 = v0() / i5;
                    i7 = v0 / i4;
                    i3 = i3;
                    i2 = i2;
                }
            }
            while (true) {
                if (i8 + i6 + i3 > point.y || (i8 > getHeight() * 1.25d && i4 < this.r)) {
                    i6++;
                    u0 = u0() / i6;
                    i8 = u0 / i4;
                    i3 = i3;
                    i2 = i2;
                }
            }
            ArrayList arrayList = new ArrayList(i5 * i6);
            int i9 = i2;
            while (i9 < i5) {
                int i10 = i2;
                while (i10 < i6) {
                    j jVar = new j(null);
                    jVar.b = i4;
                    jVar.e = i4 == this.r ? i3 : i2;
                    jVar.a = new Rect(i9 * v0, i10 * u0, i9 == i5 + (-1) ? v0() : (i9 + 1) * v0, i10 == i6 + (-1) ? u0() : (i10 + 1) * u0);
                    jVar.f92f = new Rect(0, 0, 0, 0);
                    jVar.f93g = new Rect(jVar.a);
                    arrayList.add(jVar);
                    i10++;
                    i2 = 0;
                    i3 = 1;
                }
                i9++;
                i3 = 1;
            }
            int i11 = i2;
            this.s.put(Integer.valueOf(i4), arrayList);
            if (i4 == 1) {
                return;
            }
            i4 /= 2;
            i3 = 1;
            i2 = i11;
        }
    }

    public final boolean d0() {
        boolean z = true;
        if (this.n != null && !this.o) {
            return true;
        }
        Map<Integer, List<j>> map = this.s;
        if (map == null) {
            return false;
        }
        for (Map.Entry<Integer, List<j>> entry : map.entrySet()) {
            if (entry.getKey().intValue() == this.r) {
                for (j jVar : entry.getValue()) {
                    if (jVar.d || jVar.c == null) {
                        z = false;
                    }
                }
            }
        }
        return z;
    }

    public final boolean e0() {
        return this.x0;
    }

    @NonNull
    public final PointF f0(float f2, float f3, float f4, @NonNull PointF pointF) {
        PointF G0 = G0(f2, f3, f4);
        pointF.set(((getPaddingLeft() + (((getWidth() - getPaddingRight()) - getPaddingLeft()) / 2)) - G0.x) / f4, ((getPaddingTop() + (((getHeight() - getPaddingBottom()) - getPaddingTop()) / 2)) - G0.y) / f4);
        return pointF;
    }

    public final float g0(float f2) {
        return Math.min(this.v, Math.max(h0(), f2));
    }

    public final int getAppliedOrientation() {
        return getRequiredRotation();
    }

    @Nullable
    public final PointF getCenter() {
        return H0(getWidth() / 2, getHeight() / 2);
    }

    public float getMaxScale() {
        return this.v;
    }

    public final float getMinScale() {
        return h0();
    }

    public final int getOrientation() {
        return this.u;
    }

    public final int getSHeight() {
        return this.T;
    }

    public final int getSWidth() {
        return this.S;
    }

    public final float getScale() {
        return this.K;
    }

    @Nullable
    public final f.p.c.k.n.a.f getState() {
        if (this.M == null || this.S <= 0 || this.T <= 0) {
            return null;
        }
        return new f.p.c.k.n.a.f(getScale(), getCenter(), getOrientation());
    }

    public final float h0() {
        int paddingBottom = getPaddingBottom() + getPaddingTop();
        int paddingLeft = getPaddingLeft() + getPaddingRight();
        int i2 = this.z;
        if (i2 == 2 || i2 == 4) {
            return Math.max((getWidth() - paddingLeft) / v0(), (getHeight() - paddingBottom) / u0());
        }
        if (i2 == 3) {
            float f2 = this.w;
            if (f2 > 0.0f) {
                return f2;
            }
        }
        return Math.min((getWidth() - paddingLeft) / v0(), (getHeight() - paddingBottom) / u0());
    }

    public void i0() {
    }

    public final synchronized void j0(Bitmap bitmap, int i2, boolean z) {
        P("onImageLoaded", new Object[0]);
        if (this.S > 0 && this.T > 0 && (this.S != bitmap.getWidth() || this.T != bitmap.getHeight())) {
            s0(false);
        }
        if (this.n != null && !this.p) {
            this.n.recycle();
        }
        if (this.n != null && this.p && this.z0 != null) {
            this.z0.d();
        }
        this.o = false;
        this.p = z;
        this.n = bitmap;
        this.S = bitmap.getWidth();
        this.T = bitmap.getHeight();
        this.U = i2;
        boolean N = N();
        boolean M = M();
        if (N || M) {
            invalidate();
            requestLayout();
        }
    }

    public final synchronized void k0(Bitmap bitmap) {
        P("onPreviewLoaded", new Object[0]);
        if (this.n == null && !this.y0) {
            if (this.W != null) {
                this.n = Bitmap.createBitmap(bitmap, this.W.left, this.W.top, this.W.width(), this.W.height());
            } else {
                this.n = bitmap;
            }
            this.o = true;
            if (N()) {
                invalidate();
                requestLayout();
            }
            return;
        }
        bitmap.recycle();
    }

    public void l0() {
    }

    public final synchronized void m0() {
        P("onTileLoaded", new Object[0]);
        N();
        M();
        if (d0() && this.n != null) {
            if (!this.p) {
                this.n.recycle();
            }
            this.n = null;
            if (this.z0 != null && this.p) {
                this.z0.d();
            }
            this.o = false;
            this.p = false;
        }
        invalidate();
    }

    public final boolean n0(@androidx.annotation.NonNull android.view.MotionEvent r13) {
        throw new UnsupportedOperationException("Method not decompiled: f.p.c.k.n.a.h.n0(android.view.MotionEvent):boolean");
    }

    public final void o0() {
        Float f2;
        if (getWidth() == 0 || getHeight() == 0 || this.S <= 0 || this.T <= 0) {
            return;
        }
        if (this.Q != null && (f2 = this.P) != null) {
            this.K = f2.floatValue();
            if (this.M == null) {
                this.M = new PointF();
            }
            this.M.x = (getWidth() / 2) - (this.K * this.Q.x);
            this.M.y = (getHeight() / 2) - (this.K * this.Q.y);
            this.Q = null;
            this.P = null;
            X(true);
            q0(true);
        }
        X(false);
    }

    @Override
    public void onDraw(Canvas canvas) {
        int i2;
        int i3;
        float f2;
        int i4;
        int i5;
        int i6;
        super.onDraw(canvas);
        O();
        if (this.S == 0 || this.T == 0 || getWidth() == 0 || getHeight() == 0) {
            return;
        }
        if (this.s == null && this.k0 != null) {
            b0(a0(canvas));
        }
        if (N()) {
            o0();
            c cVar = this.w0;
            if (cVar != null && cVar.f86f != null) {
                float f3 = this.K;
                if (this.O == null) {
                    this.O = new PointF(0.0f, 0.0f);
                }
                this.O.set(this.M);
                long currentTimeMillis = System.currentTimeMillis() - this.w0.l;
                boolean z = currentTimeMillis > this.w0.h;
                long min = Math.min(currentTimeMillis, this.w0.h);
                this.K = S(this.w0.j, min, this.w0.a, this.w0.b - this.w0.a, this.w0.h);
                float S = S(this.w0.j, min, this.w0.f86f.x, this.w0.f87g.x - this.w0.f86f.x, this.w0.h);
                float S2 = S(this.w0.j, min, this.w0.f86f.y, this.w0.f87g.y - this.w0.f86f.y, this.w0.h);
                this.M.x -= D0(this.w0.d.x) - S;
                this.M.y -= E0(this.w0.d.y) - S2;
                X(z || this.w0.a == this.w0.b);
                w0(f3, this.O, this.w0.k);
                q0(z);
                if (z) {
                    if (this.w0.m != null) {
                        try {
                            this.w0.m.onComplete();
                        } catch (Exception e2) {
                            Log.w(M0, "Error thrown by animation listener", e2);
                        }
                    }
                    this.w0 = null;
                }
                invalidate();
            }
            int i7 = 35;
            int i8 = 90;
            int i9 = 180;
            if (this.s == null || !d0()) {
                i2 = 35;
                i3 = 15;
                if (this.n != null) {
                    float f4 = this.K;
                    if (this.o) {
                        f4 *= this.S / r0.getWidth();
                        f2 = this.K * (this.T / this.n.getHeight());
                    } else {
                        f2 = f4;
                    }
                    if (this.H0 == null) {
                        this.H0 = new Matrix();
                    }
                    this.H0.reset();
                    this.H0.postScale(f4, f2);
                    this.H0.postRotate(getRequiredRotation());
                    Matrix matrix = this.H0;
                    PointF pointF = this.M;
                    matrix.postTranslate(pointF.x, pointF.y);
                    if (getRequiredRotation() == 180) {
                        Matrix matrix2 = this.H0;
                        float f5 = this.K;
                        matrix2.postTranslate(this.S * f5, f5 * this.T);
                    } else if (getRequiredRotation() == 90) {
                        this.H0.postTranslate(this.K * this.T, 0.0f);
                    } else if (getRequiredRotation() == 270) {
                        this.H0.postTranslate(0.0f, this.K * this.S);
                    }
                    if (this.F0 != null) {
                        if (this.I0 == null) {
                            this.I0 = new RectF();
                        }
                        this.I0.set(0.0f, 0.0f, this.o ? this.n.getWidth() : this.S, this.o ? this.n.getHeight() : this.T);
                        this.H0.mapRect(this.I0);
                        canvas.drawRect(this.I0, this.F0);
                    }
                    canvas.drawBitmap(this.n, this.H0, this.C0);
                }
            } else {
                int min2 = Math.min(this.r, L(this.K));
                boolean z2 = false;
                for (Map.Entry<Integer, List<j>> entry : this.s.entrySet()) {
                    if (entry.getKey().intValue() == min2) {
                        for (j jVar : entry.getValue()) {
                            if (jVar.e && (jVar.d || jVar.c == null)) {
                                z2 = true;
                            }
                        }
                    }
                }
                for (Map.Entry<Integer, List<j>> entry2 : this.s.entrySet()) {
                    if (entry2.getKey().intValue() == min2 || z2) {
                        for (j jVar2 : entry2.getValue()) {
                            C0(jVar2.a, jVar2.f92f);
                            if (jVar2.d || jVar2.c == null) {
                                i4 = i9;
                                i5 = i8;
                                if (jVar2.d && this.t) {
                                    i6 = 35;
                                    canvas.drawText("LOADING", jVar2.f92f.left + p0(5), jVar2.f92f.top + p0(35), this.D0);
                                    if (!jVar2.e && this.t) {
                                        canvas.drawText("ISS " + jVar2.b + " RECT " + jVar2.a.top + "," + jVar2.a.left + "," + jVar2.a.bottom + "," + jVar2.a.right, jVar2.f92f.left + p0(5), jVar2.f92f.top + p0(15), this.D0);
                                    }
                                    i7 = i6;
                                    i9 = i4;
                                    i8 = i5;
                                }
                            } else {
                                if (this.F0 != null) {
                                    canvas.drawRect(jVar2.f92f, this.F0);
                                }
                                if (this.H0 == null) {
                                    this.H0 = new Matrix();
                                }
                                this.H0.reset();
                                i4 = i9;
                                i5 = i8;
                                y0(this.J0, 0.0f, 0.0f, jVar2.c.getWidth(), 0.0f, jVar2.c.getWidth(), jVar2.c.getHeight(), 0.0f, jVar2.c.getHeight());
                                if (getRequiredRotation() == 0) {
                                    y0(this.K0, jVar2.f92f.left, jVar2.f92f.top, jVar2.f92f.right, jVar2.f92f.top, jVar2.f92f.right, jVar2.f92f.bottom, jVar2.f92f.left, jVar2.f92f.bottom);
                                } else if (getRequiredRotation() == i5) {
                                    y0(this.K0, jVar2.f92f.right, jVar2.f92f.top, jVar2.f92f.right, jVar2.f92f.bottom, jVar2.f92f.left, jVar2.f92f.bottom, jVar2.f92f.left, jVar2.f92f.top);
                                } else if (getRequiredRotation() == i4) {
                                    y0(this.K0, jVar2.f92f.right, jVar2.f92f.bottom, jVar2.f92f.left, jVar2.f92f.bottom, jVar2.f92f.left, jVar2.f92f.top, jVar2.f92f.right, jVar2.f92f.top);
                                } else if (getRequiredRotation() == 270) {
                                    y0(this.K0, jVar2.f92f.left, jVar2.f92f.bottom, jVar2.f92f.left, jVar2.f92f.top, jVar2.f92f.right, jVar2.f92f.top, jVar2.f92f.right, jVar2.f92f.bottom);
                                }
                                this.H0.setPolyToPoly(this.J0, 0, this.K0, 0, 4);
                                canvas.drawBitmap(jVar2.c, this.H0, this.C0);
                                if (this.t) {
                                    canvas.drawRect(jVar2.f92f, this.E0);
                                }
                            }
                            i6 = 35;
                            if (!jVar2.e) {
                            }
                            i7 = i6;
                            i9 = i4;
                            i8 = i5;
                        }
                    }
                    i7 = i7;
                    i9 = i9;
                    i8 = i8;
                }
                i2 = i7;
                i3 = 15;
            }
            if (this.t) {
                canvas.drawText("Scale: " + String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.K)) + " (" + String.format(Locale.ENGLISH, "%.2f", Float.valueOf(h0())) + " - " + String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.v)) + ")", p0(5), p0(i3), this.D0);
                StringBuilder sb = new StringBuilder();
                sb.append("Translate: ");
                sb.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.M.x)));
                sb.append(":");
                sb.append(String.format(Locale.ENGLISH, "%.2f", Float.valueOf(this.M.y)));
                canvas.drawText(sb.toString(), (float) p0(5), (float) p0(30), this.D0);
                PointF center = getCenter();
                canvas.drawText("Source center: " + String.format(Locale.ENGLISH, "%.2f", Float.valueOf(center.x)) + ":" + String.format(Locale.ENGLISH, "%.2f", Float.valueOf(center.y)), p0(5), p0(45), this.D0);
                c cVar2 = this.w0;
                if (cVar2 != null) {
                    PointF B0 = B0(cVar2.c);
                    PointF B02 = B0(this.w0.e);
                    PointF B03 = B0(this.w0.d);
                    canvas.drawCircle(B0.x, B0.y, p0(10), this.E0);
                    this.E0.setColor(-65536);
                    canvas.drawCircle(B02.x, B02.y, p0(20), this.E0);
                    this.E0.setColor(-16776961);
                    canvas.drawCircle(B03.x, B03.y, p0(25), this.E0);
                    this.E0.setColor(-16711681);
                    canvas.drawCircle(getWidth() / 2, getHeight() / 2, p0(30), this.E0);
                }
                if (this.o0 != null) {
                    this.E0.setColor(-65536);
                    PointF pointF2 = this.o0;
                    canvas.drawCircle(pointF2.x, pointF2.y, p0(20), this.E0);
                }
                if (this.u0 != null) {
                    this.E0.setColor(-16776961);
                    canvas.drawCircle(D0(this.u0.x), E0(this.u0.y), p0(i2), this.E0);
                }
                if (this.v0 != null && this.g0) {
                    this.E0.setColor(-16711681);
                    PointF pointF3 = this.v0;
                    canvas.drawCircle(pointF3.x, pointF3.y, p0(30), this.E0);
                }
                this.E0.setColor(-65281);
            }
        }
    }

    @Override
    public void onMeasure(int i2, int i3) {
        int mode = View.MeasureSpec.getMode(i2);
        int mode2 = View.MeasureSpec.getMode(i3);
        int size = View.MeasureSpec.getSize(i2);
        int size2 = View.MeasureSpec.getSize(i3);
        boolean z = mode != 1073741824;
        boolean z2 = mode2 != 1073741824;
        if (this.S > 0 && this.T > 0) {
            if (z && z2) {
                size = v0();
                size2 = u0();
            } else if (z2) {
                size2 = (int) ((u0() / v0()) * size);
            } else if (z) {
                size = (int) ((v0() / u0()) * size2);
            }
        }
        setMeasuredDimension(Math.max(size, getSuggestedMinimumWidth()), Math.max(size2, getSuggestedMinimumHeight()));
    }

    @Override
    public void onSizeChanged(int i2, int i3, int i4, int i5) {
        P("onSizeChanged %dx%d -> %dx%d", Integer.valueOf(i4), Integer.valueOf(i5), Integer.valueOf(i2), Integer.valueOf(i3));
        PointF center = getCenter();
        if (!this.x0 || center == null) {
            return;
        }
        this.w0 = null;
        this.P = Float.valueOf(this.K);
        this.Q = center;
    }

    @Override
    public boolean onTouchEvent(@NonNull MotionEvent motionEvent) {
        GestureDetector gestureDetector;
        c cVar = this.w0;
        if (cVar != null && !cVar.i) {
            r0(true);
            return true;
        }
        c cVar2 = this.w0;
        if (cVar2 != null && cVar2.m != null) {
            try {
                this.w0.m.a();
            } catch (Exception e2) {
                Log.w(M0, "Error thrown by animation listener", e2);
            }
        }
        this.w0 = null;
        if (this.M == null) {
            GestureDetector gestureDetector2 = this.j0;
            if (gestureDetector2 != null) {
                gestureDetector2.onTouchEvent(motionEvent);
            }
            return true;
        }
        if (!this.g0 && ((gestureDetector = this.i0) == null || gestureDetector.onTouchEvent(motionEvent))) {
            this.e0 = false;
            this.f0 = false;
            this.h0 = 0;
            return true;
        }
        if (this.N == null) {
            this.N = new PointF(0.0f, 0.0f);
        }
        if (this.O == null) {
            this.O = new PointF(0.0f, 0.0f);
        }
        if (this.o0 == null) {
            this.o0 = new PointF(0.0f, 0.0f);
        }
        float f2 = this.K;
        this.O.set(this.M);
        boolean n0 = n0(motionEvent);
        w0(f2, this.O, 2);
        return n0 || super.onTouchEvent(motionEvent);
    }

    public final int p0(int i2) {
        return (int) (this.L0 * i2);
    }

    public final void q0(boolean z) {
        if (this.k0 == null || this.s == null) {
            return;
        }
        int min = Math.min(this.r, L(this.K));
        Iterator<Map.Entry<Integer, List<j>>> it = this.s.entrySet().iterator();
        while (it.hasNext()) {
            for (j jVar : it.next().getValue()) {
                if (jVar.b < min || (jVar.b > min && jVar.b != this.r)) {
                    jVar.e = false;
                    if (jVar.c != null) {
                        jVar.c.recycle();
                        jVar.c = null;
                    }
                }
                if (jVar.b == min) {
                    if (F0(jVar)) {
                        jVar.e = true;
                        if (!jVar.d && jVar.c == null && z) {
                            V(new k(this, this.k0, jVar));
                        }
                    } else if (jVar.b != this.r) {
                        jVar.e = false;
                        if (jVar.c != null) {
                            jVar.c.recycle();
                            jVar.c = null;
                        }
                    }
                } else if (jVar.b == this.r) {
                    jVar.e = true;
                }
            }
        }
    }

    public final void r0(boolean z) {
        ViewParent parent = getParent();
        if (parent != null) {
            parent.requestDisallowInterceptTouchEvent(z);
        }
    }

    public final void s0(boolean z) {
        g gVar;
        P("reset newImage=" + z, new Object[0]);
        this.K = 0.0f;
        this.L = 0.0f;
        this.M = null;
        this.N = null;
        this.O = null;
        this.P = Float.valueOf(0.0f);
        this.Q = null;
        this.R = null;
        this.e0 = false;
        this.f0 = false;
        this.g0 = false;
        this.h0 = 0;
        this.r = 0;
        this.o0 = null;
        this.p0 = 0.0f;
        this.r0 = 0.0f;
        this.s0 = false;
        this.u0 = null;
        this.t0 = null;
        this.v0 = null;
        this.w0 = null;
        this.G0 = null;
        this.H0 = null;
        this.I0 = null;
        if (z) {
            this.q = null;
            this.l0.writeLock().lock();
            try {
                if (this.k0 != null) {
                    this.k0.recycle();
                    this.k0 = null;
                }
                this.l0.writeLock().unlock();
                Bitmap bitmap = this.n;
                if (bitmap != null && !this.p) {
                    bitmap.recycle();
                }
                if (this.n != null && this.p && (gVar = this.z0) != null) {
                    gVar.d();
                }
                this.S = 0;
                this.T = 0;
                this.U = 0;
                this.V = null;
                this.W = null;
                this.x0 = false;
                this.y0 = false;
                this.n = null;
                this.o = false;
                this.p = false;
            } catch (Throwable th) {
                this.l0.writeLock().unlock();
                throw th;
            }
        }
        Map<Integer, List<j>> map = this.s;
        if (map != null) {
            Iterator<Map.Entry<Integer, List<j>>> it = map.entrySet().iterator();
            while (it.hasNext()) {
                for (j jVar : it.next().getValue()) {
                    jVar.e = false;
                    if (jVar.c != null) {
                        jVar.c.recycle();
                        jVar.c = null;
                    }
                }
            }
            this.s = null;
        }
        setGestureDetector(getContext());
    }

    public final void setBitmapDecoderClass(@NonNull Class<? extends f.p.c.k.n.a.c> cls) {
        if (cls == null) {
            throw new IllegalArgumentException("Decoder class cannot be set to null");
        }
        this.m0 = new f.p.c.k.n.a.a(cls);
    }

    public final void setBitmapDecoderFactory(@NonNull f.p.c.k.n.a.b<? extends f.p.c.k.n.a.c> bVar) {
        if (bVar == null) {
            throw new IllegalArgumentException("Decoder factory cannot be set to null");
        }
        this.m0 = bVar;
    }

    public final void setDebug(boolean z) {
        this.t = z;
    }

    public final void setDoubleTapZoomDpi(int i2) {
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        setDoubleTapZoomScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i2);
    }

    public final void setDoubleTapZoomDuration(int i2) {
        this.J = Math.max(0, i2);
    }

    public final void setDoubleTapZoomScale(float f2) {
        this.H = f2;
    }

    public final void setDoubleTapZoomStyle(int i2) {
        if (O0.contains(Integer.valueOf(i2))) {
            this.I = i2;
            return;
        }
        throw new IllegalArgumentException("Invalid zoom style: " + i2);
    }

    public void setEagerLoadingEnabled(boolean z) {
        this.D = z;
    }

    public void setExecutor(@NonNull Executor executor) {
        if (executor == null) {
            throw new NullPointerException("Executor must not be null");
        }
        this.C = executor;
    }

    public final void setImage(@NonNull f.p.c.k.n.a.e eVar) {
        x0(eVar, null, null);
        throw null;
    }

    public final void setMaxScale(float f2) {
        this.v = f2;
    }

    public void setMaxTileSize(int i2) {
        this.A = i2;
        this.B = i2;
    }

    public final void setMaximumDpi(int i2) {
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        setMinScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i2);
    }

    public final void setMinScale(float f2) {
        this.w = f2;
    }

    public final void setMinimumDpi(int i2) {
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        setMaxScale(((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f) / i2);
    }

    public final void setMinimumScaleType(int i2) {
        if (!R0.contains(Integer.valueOf(i2))) {
            throw new IllegalArgumentException("Invalid scale type: " + i2);
        }
        this.z = i2;
        if (e0()) {
            X(true);
            invalidate();
        }
    }

    public void setMinimumTileDpi(int i2) {
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        this.x = (int) Math.min((displayMetrics.xdpi + displayMetrics.ydpi) / 2.0f, i2);
        if (e0()) {
            s0(false);
            invalidate();
        }
    }

    public void setOnImageEventListener(g gVar) {
        this.z0 = gVar;
    }

    @Override
    public void setOnLongClickListener(View.OnLongClickListener onLongClickListener) {
    }

    public void setOnStateChangedListener(InterfaceC0061h interfaceC0061h) {
        this.A0 = interfaceC0061h;
    }

    public final void setOrientation(int i2) {
        if (!N0.contains(Integer.valueOf(i2))) {
            throw new IllegalArgumentException("Invalid orientation: " + i2);
        }
        this.u = i2;
        s0(false);
        invalidate();
        requestLayout();
    }

    public final void setPanEnabled(boolean z) {
        PointF pointF;
        this.E = z;
        if (z || (pointF = this.M) == null) {
            return;
        }
        pointF.x = (getWidth() / 2) - (this.K * (v0() / 2));
        this.M.y = (getHeight() / 2) - (this.K * (u0() / 2));
        if (e0()) {
            q0(true);
            invalidate();
        }
    }

    public final void setPanLimit(int i2) {
        if (!Q0.contains(Integer.valueOf(i2))) {
            throw new IllegalArgumentException("Invalid pan limit: " + i2);
        }
        this.y = i2;
        if (e0()) {
            X(true);
            invalidate();
        }
    }

    public final void setQuickScaleEnabled(boolean z) {
        this.G = z;
    }

    public final void setRegionDecoderClass(@NonNull Class<? extends f.p.c.k.n.a.d> cls) {
        if (cls == null) {
            throw new IllegalArgumentException("Decoder class cannot be set to null");
        }
        this.n0 = new f.p.c.k.n.a.a(cls);
    }

    public final void setRegionDecoderFactory(@NonNull f.p.c.k.n.a.b<? extends f.p.c.k.n.a.d> bVar) {
        if (bVar == null) {
            throw new IllegalArgumentException("Decoder factory cannot be set to null");
        }
        this.n0 = bVar;
    }

    public final void setTileBackgroundColor(int i2) {
        if (Color.alpha(i2) == 0) {
            this.F0 = null;
        } else {
            Paint paint = new Paint();
            this.F0 = paint;
            paint.setStyle(Paint.Style.FILL);
            this.F0.setColor(i2);
        }
        invalidate();
    }

    public final void setZoomEnabled(boolean z) {
        this.F = z;
    }

    public final void t0(f.p.c.k.n.a.f fVar) {
        if (fVar == null || !N0.contains(Integer.valueOf(fVar.b()))) {
            return;
        }
        this.u = fVar.b();
        this.P = Float.valueOf(fVar.c());
        this.Q = fVar.a();
        invalidate();
    }

    public final int u0() {
        int requiredRotation = getRequiredRotation();
        return (requiredRotation == 90 || requiredRotation == 270) ? this.S : this.T;
    }

    public final int v0() {
        int requiredRotation = getRequiredRotation();
        return (requiredRotation == 90 || requiredRotation == 270) ? this.T : this.S;
    }

    public final void w0(float f2, PointF pointF, int i2) {
        InterfaceC0061h interfaceC0061h = this.A0;
        if (interfaceC0061h != null) {
            float f3 = this.K;
            if (f3 != f2) {
                interfaceC0061h.a(f3, i2);
            }
        }
        if (this.A0 == null || this.M.equals(pointF)) {
            return;
        }
        this.A0.b(getCenter(), i2);
    }

    public final void x0(@NonNull f.p.c.k.n.a.e eVar, f.p.c.k.n.a.e eVar2, f.p.c.k.n.a.f fVar) {
        if (eVar == null) {
            throw new NullPointerException("imageSource must not be null");
        }
        s0(true);
        if (fVar != null) {
            t0(fVar);
        }
        if (eVar2 != null) {
            eVar.a();
            throw null;
        }
        eVar.a();
        throw null;
    }

    public final void y0(float[] fArr, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) {
        fArr[0] = f2;
        fArr[1] = f3;
        fArr[2] = f4;
        fArr[3] = f5;
        fArr[4] = f6;
        fArr[5] = f7;
        fArr[6] = f8;
        fArr[7] = f9;
    }

    public final void z0(float f2, @Nullable PointF pointF) {
        this.w0 = null;
        this.P = Float.valueOf(f2);
        this.Q = pointF;
        this.R = pointF;
        invalidate();
    }

    public static class c {
        public float a;
        public float b;
        public PointF c;
        public PointF d;
        public PointF e;

        public PointF f86f;

        public PointF f87g;
        public long h;
        public boolean i;
        public int j;
        public int k;
        public long l;
        public f m;

        public c() {
            this.h = 500L;
            this.i = true;
            this.j = 2;
            this.k = 1;
            this.l = System.currentTimeMillis();
        }

        public c(f.p.c.k.n.a.g gVar) {
            this();
        }
    }
}