导航菜单

页面标题

页面副标题

Handling Master v2 - PictureVerifyView.java 源代码

正在查看: Handling Master v2 应用的 PictureVerifyView.java JAVA 源代码文件

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


package com.thinkup.basead.ui.guidetoclickv2.picverify;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import androidx.annotation.Nullable;
import com.thinkup.core.common.oo0.nn;
import com.thinkup.core.common.ui.component.RoundImageView;

public class PictureVerifyView extends RoundImageView {
    private static final int m0 = 6;
    private static final int mo = 20;
    private static final int n = 1;
    private static final int o0 = 2;
    private static final int om = 4;
    private static final int on = 5;
    private static final int oo = 3;
    private int mm;
    private n mn;
    private n n0;
    private Path nm;
    private Paint nn;
    private Bitmap no;
    private Paint o00;
    private long o0m;
    private long o0n;
    private Paint o0o;
    private int om0;
    private float omm;
    private float omn;
    private int omo;
    private float on0;
    private float ono;
    private int oo0;
    private o oom;
    private com.thinkup.basead.ui.guidetoclickv2.picverify.o oon;
    private boolean ooo;

    public interface o {
        void m();

        void o();
    }

    public PictureVerifyView(Context context) {
        this(context, null);
    }

    private void m(float f, float f2) {
        n nVar = this.n0;
        if (nVar != null) {
            this.mm = 2;
            nVar.o = (int) (nVar.o + f);
            nVar.m = (int) (nVar.m + f2);
            postInvalidate();
        }
    }

    private void n() {
        this.mm = 6;
        postInvalidate();
    }

    private void o() {
        if (getDrawable() == null || getWidth() <= 0 || getHeight() < 0) {
            return;
        }
        if (this.mn == null) {
            this.mn = this.oon.o(getWidth(), getHeight(), this.oo0);
        }
        if (this.n0 == null) {
            this.n0 = this.oon.m(getWidth(), getHeight(), this.oo0);
        }
        if (this.nm == null) {
            Path o2 = this.oon.o(this.oo0);
            this.nm = o2;
            n nVar = this.mn;
            o2.offset(nVar.o, nVar.m);
        }
        if (this.no == null) {
            Bitmap bitmap = null;
            if (getDrawable() != null) {
                Bitmap createBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
                Canvas canvas = new Canvas(createBitmap);
                getDrawable().setBounds(0, 0, getWidth(), getHeight());
                canvas.clipPath(this.nm);
                getDrawable().draw(canvas);
                this.oon.o(getContext(), canvas, this.nm);
                n nVar2 = this.mn;
                if (nVar2 != null) {
                    int i = nVar2.o;
                    int i2 = nVar2.m;
                    int i3 = this.oo0;
                    bitmap = Bitmap.createBitmap(createBitmap, i, i2, i3, i3);
                    createBitmap.recycle();
                }
            }
            this.no = bitmap;
        }
    }

    private void o0() {
        this.mm = 5;
        postInvalidate();
    }

    private void om() {
        n nVar;
        n nVar2 = this.n0;
        if (nVar2 == null || (nVar = this.mn) == null || Math.abs(nVar2.o - nVar.o) >= 20 || Math.abs(this.n0.m - this.mn.m) >= 20) {
            this.mm = 6;
            postInvalidate();
            return;
        }
        this.mm = 5;
        postInvalidate();
        o oVar = this.oom;
        if (oVar != null) {
            oVar.o();
        }
    }

    private Bitmap oo() {
        if (getDrawable() == null) {
            return null;
        }
        Bitmap createBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(createBitmap);
        getDrawable().setBounds(0, 0, getWidth(), getHeight());
        canvas.clipPath(this.nm);
        getDrawable().draw(canvas);
        this.oon.o(getContext(), canvas, this.nm);
        n nVar = this.mn;
        if (nVar == null) {
            return null;
        }
        int i = nVar.o;
        int i2 = nVar.m;
        int i3 = this.oo0;
        Bitmap createBitmap2 = Bitmap.createBitmap(createBitmap, i, i2, i3, i3);
        createBitmap.recycle();
        return createBitmap2;
    }

    public void callback(o oVar) {
        this.oom = oVar;
    }

    public void down(int i) {
        if (this.n0 != null) {
            this.o0m = System.currentTimeMillis();
            this.mm = 1;
            n nVar = this.n0;
            int width = getWidth() - this.oo0;
            nVar.o = (int) (((i / 100.0f) * (width - (r2 * 2))) + this.n0.n);
            postInvalidate();
        }
    }

    public void loose() {
        n nVar;
        this.mm = 3;
        this.o0n = System.currentTimeMillis();
        n nVar2 = this.n0;
        if (nVar2 == null || (nVar = this.mn) == null || Math.abs(nVar2.o - nVar.o) >= 20 || Math.abs(this.n0.m - this.mn.m) >= 20) {
            this.mm = 6;
            postInvalidate();
        } else {
            this.mm = 5;
            postInvalidate();
            o oVar = this.oom;
            if (oVar != null) {
                oVar.o();
            }
        }
        postInvalidate();
    }

    public void move(int i) {
        n nVar;
        if (this.omo == i || (nVar = this.n0) == null) {
            return;
        }
        this.omo = i;
        this.mm = 2;
        int width = getWidth() - this.oo0;
        nVar.o = (int) (((i / 100.0f) * (width - (r2 * 2))) + this.n0.n);
        postInvalidate();
    }

    @Override
    public void onDraw(Canvas canvas) {
        n nVar;
        if (getDrawable() != null && getWidth() > 0 && getHeight() >= 0) {
            if (this.mn == null) {
                this.mn = this.oon.o(getWidth(), getHeight(), this.oo0);
            }
            if (this.n0 == null) {
                this.n0 = this.oon.m(getWidth(), getHeight(), this.oo0);
            }
            if (this.nm == null) {
                Path o2 = this.oon.o(this.oo0);
                this.nm = o2;
                n nVar2 = this.mn;
                o2.offset(nVar2.o, nVar2.m);
            }
            if (this.no == null) {
                Bitmap bitmap = null;
                if (getDrawable() != null) {
                    Bitmap createBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
                    Canvas canvas2 = new Canvas(createBitmap);
                    getDrawable().setBounds(0, 0, getWidth(), getHeight());
                    canvas2.clipPath(this.nm);
                    getDrawable().draw(canvas2);
                    this.oon.o(getContext(), canvas2, this.nm);
                    n nVar3 = this.mn;
                    if (nVar3 != null) {
                        int i = nVar3.o;
                        int i2 = nVar3.m;
                        int i3 = this.oo0;
                        bitmap = Bitmap.createBitmap(createBitmap, i, i2, i3, i3);
                        createBitmap.recycle();
                    }
                }
                this.no = bitmap;
            }
        }
        if (getDrawable() == null) {
            return;
        }
        if (this.mm != 5 && this.mn != null) {
            canvas.drawPath(this.nm, this.o00);
            n nVar4 = this.mn;
            int i4 = nVar4.o;
            int i5 = nVar4.m;
            int i6 = this.oo0;
            canvas.drawRect(i4, i5, i4 + i6, i5 + i6, this.o0o);
        }
        int i7 = this.mm;
        if ((i7 == 2 || i7 == 4 || i7 == 1 || i7 == 6) && (nVar = this.n0) != null) {
            canvas.drawBitmap(this.no, nVar.o, nVar.m, this.nn);
        }
    }

    public void setBitmap(Bitmap bitmap) {
        this.nm = null;
        this.n0 = null;
        this.mn = null;
        this.no.recycle();
        this.no = null;
        setImageBitmap(bitmap);
    }

    public void setBlockSize(int i) {
        this.oo0 = i;
        this.nm = null;
        this.n0 = null;
        this.mn = null;
        this.no = null;
        postInvalidate();
    }

    public PictureVerifyView(Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public PictureVerifyView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.mm = 4;
        this.oo0 = 50;
        this.ooo = true;
        this.omo = -1;
        m mVar = new m(context);
        this.oon = mVar;
        this.o00 = mVar.o();
        Paint paint = new Paint();
        this.o0o = paint;
        paint.setColor(Color.parseColor("#B5B5B5"));
        this.o0o.setStrokeWidth(nn.o(getContext(), 1.0f));
        this.o0o.setStyle(Paint.Style.STROKE);
        this.nn = this.oon.m();
    }

    private void m() {
        this.mm = 4;
        this.no = null;
        this.mn = null;
        this.nm = null;
        postInvalidate();
    }

    private void o(float f, float f2) {
        n nVar = this.n0;
        if (nVar != null) {
            this.mm = 1;
            int i = this.oo0;
            nVar.o = (int) (f - (i / 2.0f));
            nVar.m = (int) (f2 - (i / 2.0f));
            this.o0m = System.currentTimeMillis();
            postInvalidate();
        }
    }

    private void o(com.thinkup.basead.ui.guidetoclickv2.picverify.o oVar) {
        this.oon = oVar;
    }

    private void o(boolean z) {
        this.ooo = z;
    }

    private Bitmap o(Bitmap bitmap) {
        n nVar = this.mn;
        if (nVar == null) {
            return null;
        }
        int i = nVar.o;
        int i2 = nVar.m;
        int i3 = this.oo0;
        Bitmap createBitmap = Bitmap.createBitmap(bitmap, i, i2, i3, i3);
        bitmap.recycle();
        return createBitmap;
    }
}