导航菜单

页面标题

页面副标题

万能钥匙 v1.1.23 - PictureClipView.java 源代码

正在查看: 万能钥匙 v1.1.23 应用的 PictureClipView.java JAVA 源代码文件

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


package com.finogeeks.lib.applet.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import com.finogeeks.lib.applet.modules.log.FLog;
import com.finogeeks.lib.applet.utils.FinFileResourceUtil;
import com.finogeeks.lib.applet.utils.x;
import gh0.i;
import kotlin.Metadata;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.n;

@Metadata(d1 = {"\u0000w\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0010\n\u0002\u0010\u0007\n\u0002\b\u0011\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0013\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\b\b*\u0001a\u0018\u00002\u00020\u0001:\u0001gB'\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0004\u0012\b\b\u0002\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b\b\u0010\tJ\u0015\u0010\r\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\n¢\u0006\u0004\b\r\u0010\u000eJ/\u0010\u0013\u001a\u00020\f2\u0006\u0010\u000f\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u00062\u0006\u0010\u0011\u001a\u00020\u00062\u0006\u0010\u0012\u001a\u00020\u0006H\u0014¢\u0006\u0004\b\u0013\u0010\u0014J\u0017\u0010\u0018\u001a\u00020\u00172\u0006\u0010\u0016\u001a\u00020\u0015H\u0017¢\u0006\u0004\b\u0018\u0010\u0019J\u0017\u0010\u001c\u001a\u00020\f2\u0006\u0010\u001b\u001a\u00020\u001aH\u0014¢\u0006\u0004\b\u001c\u0010\u001dJ\u000f\u0010\u001e\u001a\u00020\fH\u0002¢\u0006\u0004\b\u001e\u0010\u001fJ\u000f\u0010 \u001a\u00020\fH\u0002¢\u0006\u0004\b \u0010\u001fJ\u000f\u0010!\u001a\u00020\fH\u0002¢\u0006\u0004\b!\u0010\u001fJ\u000f\u0010\"\u001a\u00020\fH\u0002¢\u0006\u0004\b\"\u0010\u001fJ\u000f\u0010#\u001a\u00020\u0017H\u0002¢\u0006\u0004\b#\u0010$J\r\u0010%\u001a\u00020\f¢\u0006\u0004\b%\u0010\u001fJ\u000f\u0010&\u001a\u00020\fH\u0002¢\u0006\u0004\b&\u0010\u001fJ\u000f\u0010'\u001a\u00020\fH\u0002¢\u0006\u0004\b'\u0010\u001fJ\r\u0010(\u001a\u00020\f¢\u0006\u0004\b(\u0010\u001fJ\r\u0010)\u001a\u00020\n¢\u0006\u0004\b)\u0010*J\u001f\u0010-\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\n2\u0006\u0010,\u001a\u00020+H\u0002¢\u0006\u0004\b-\u0010.J\u001d\u00101\u001a\u00020\f2\u0006\u0010/\u001a\u00020\u00062\u0006\u00100\u001a\u00020\u0006¢\u0006\u0004\b1\u00102J\u001d\u00105\u001a\u00020\f2\u0006\u00103\u001a\u00020+2\u0006\u00104\u001a\u00020+¢\u0006\u0004\b5\u00106R\"\u00107\u001a\u00020\u00178\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b7\u00108\u001a\u0004\b7\u0010$\"\u0004\b1\u00109R\"\u0010:\u001a\u00020\u00178\u0006@\u0006X\u0086\u000e¢\u0006\u0012\n\u0004\b:\u00108\u001a\u0004\b;\u0010$\"\u0004\b<\u00109R\u0014\u0010>\u001a\u00020=8\u0002X\u0082D¢\u0006\u0006\n\u0004\b>\u0010?R\u0016\u0010\u000b\u001a\u00020\n8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u000b\u0010@R\u0016\u0010A\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bA\u0010BR\u0014\u0010D\u001a\u00020C8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bD\u0010ER\u0014\u0010G\u001a\u00020F8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bG\u0010HR\u0016\u0010I\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bI\u0010BR\u0014\u0010J\u001a\u00020F8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bJ\u0010HR\u0014\u0010K\u001a\u00020F8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bK\u0010HR\u0016\u0010L\u001a\u00020+8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bL\u0010MR\u0016\u0010N\u001a\u00020+8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bN\u0010MR\u0016\u0010O\u001a\u00020\u00178\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bO\u00108R\u0016\u0010P\u001a\u00020\u00178\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bP\u00108R\u0016\u0010Q\u001a\u00020\u00178\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bQ\u00108R\u0016\u0010R\u001a\u00020\u00178\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bR\u00108R\u0016\u0010S\u001a\u00020\u00178\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bS\u00108R\u0016\u0010T\u001a\u00020\u00178\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bT\u00108R\u0014\u0010U\u001a\u00020F8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bU\u0010HR\u0014\u0010V\u001a\u00020F8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bV\u0010HR\u0016\u0010W\u001a\u00020\n8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\bW\u0010@R\u0016\u0010X\u001a\u00020+8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bX\u0010MR\u0016\u0010Y\u001a\u00020+8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bY\u0010MR\u0014\u0010[\u001a\u00020Z8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b[\u0010\\R\u0016\u00100\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b0\u0010BR\u0016\u0010/\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b/\u0010BR\u0014\u0010]\u001a\u00020F8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b]\u0010HR\u0014\u0010_\u001a\u00020^8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b_\u0010`R\u0014\u0010b\u001a\u00020a8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bb\u0010cR\u0014\u0010d\u001a\u00020F8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bd\u0010HR\u0016\u0010e\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\be\u0010BR\u0016\u0010f\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bf\u0010B¨\u0006h"}, d2 = {"Lcom/finogeeks/lib/applet/widget/PictureClipView;", "Landroid/view/View;", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "Landroid/graphics/Bitmap;", "bitmap", "Llg0/e0;", "setBitmapResource", "(Landroid/graphics/Bitmap;)V", "w", "h", "oldw", "oldh", "onSizeChanged", "(IIII)V", "Landroid/view/MotionEvent;", FinFileResourceUtil.KEY_EVENT, "", "onTouchEvent", "(Landroid/view/MotionEvent;)Z", "Landroid/graphics/Canvas;", "canvas", "onDraw", "(Landroid/graphics/Canvas;)V", "clipBorderCenter", "()V", "computeBitmapRectF", "computeDragRectF", "fixedClipSizeMeasure", "isDragging", "()Z", "reset", "resetBitmapRectF", "resetState", "rotate", "saveBitmap", "()Landroid/graphics/Bitmap;", "", "scaleFactor", "scaleBitmap", "(Landroid/graphics/Bitmap;F)Landroid/graphics/Bitmap;", "ratioWidth", "ratioHeight", "setFixedRatioClip", "(II)V", "top", "bottom", "setPadding", "(FF)V", "isFixedRatioClip", "Z", "(Z)V", "fixedClipSizeMeasured", "getFixedClipSizeMeasured", "setFixedClipSizeMeasured", "", "TAG", "Ljava/lang/String;", "Landroid/graphics/Bitmap;", "bitmapHeight", "I", "Landroid/graphics/Matrix;", "bitmapMatrix", "Landroid/graphics/Matrix;", "Landroid/graphics/RectF;", "bitmapRectF", "Landroid/graphics/RectF;", "bitmapWidth", "bottomDragRectF", "clipRectF", "downX", "F", "downY", "isBitmapDrag", "isBottomDrag", "isLeftDrag", "isRightDrag", "isScaling", "isTopDrag", "leftDragRectF", "maxClipRectF", "orgBitmap", "paddingBottom", "paddingTop", "Landroid/graphics/Paint;", "paint", "Landroid/graphics/Paint;", "rightDragRectF", "Landroid/view/ScaleGestureDetector;", "scaleGestureDetector", "Landroid/view/ScaleGestureDetector;", "com/finogeeks/lib/applet/widget/PictureClipView$sgListener$1", "sgListener", "Lcom/finogeeks/lib/applet/widget/PictureClipView$sgListener$1;", "topDragRectF", "viewHeight", "viewWidth", "Companion", "finapplet_release"}, k = 1, mv = {1, 4, 0})
public final class PictureClipView extends View {
    private boolean A;
    private boolean B;
    private int C;
    private int D;
    private final b E;
    private final ScaleGestureDetector F;
    private final String a;
    private float b;
    private float c;
    private int d;
    private int e;
    private int f;
    private int g;
    private Bitmap h;
    private Bitmap i;
    private final Matrix j;
    private final RectF k;
    private final Paint l;
    private final RectF m;
    private final RectF n;
    private final RectF o;
    private final RectF p;
    private final RectF q;
    private final RectF r;
    private boolean s;
    private boolean t;
    private boolean u;
    private boolean v;
    private boolean w;
    private boolean x;

    private float f132y;

    private float f133z;

    public static final class a {
        private a() {
        }

        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    public static final class b extends ScaleGestureDetector.SimpleOnScaleGestureListener {
        public b() {
        }

        @Override
        public boolean onScale(ScaleGestureDetector scaleGestureDetector) {
            n.j(scaleGestureDetector, "detector");
            PictureClipView.this.x = true;
            float f = x.a(PictureClipView.this.j)[0];
            float scaleFactor = scaleGestureDetector.getScaleFactor();
            if (f * scaleFactor <= 0.1f) {
                scaleFactor = 0.1f / f;
            }
            if (f * scaleFactor >= 2.0f) {
                scaleFactor = 2.0f / f;
            }
            PictureClipView.this.j.setScale(scaleFactor, scaleFactor, scaleGestureDetector.getFocusX(), scaleGestureDetector.getFocusY());
            FLog.d$default(PictureClipView.this.a, "onScale scaleFactor=" + scaleFactor, null, 4, null);
            PictureClipView.this.j.mapRect(PictureClipView.this.k);
            return true;
        }
    }

    static {
        new a(null);
    }

    public PictureClipView(Context context) {
        this(context, null, 0, 6, null);
    }

    public PictureClipView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0, 4, null);
    }

    public PictureClipView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        n.j(context, "context");
        this.a = "PictureClipView";
        this.j = new Matrix();
        this.k = new RectF();
        this.l = new Paint(1);
        this.m = new RectF();
        this.n = new RectF();
        this.o = new RectF();
        this.p = new RectF();
        this.q = new RectF();
        this.r = new RectF();
        this.C = 1;
        this.D = 1;
        b bVar = new b();
        this.E = bVar;
        this.F = new ScaleGestureDetector(context, bVar);
    }

    public PictureClipView(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
        this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
    }

    private final Bitmap a(Bitmap bitmap, float f) {
        int d = i.d((int) (bitmap.getWidth() * f), 1);
        int d2 = i.d((int) (bitmap.getHeight() * f), 1);
        FLog.d$default(this.a, "saveBitmap scaleBitmapwidth:" + d + " clipBitmapHeight:" + d2, null, 4, null);
        Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmap, d, d2, true);
        n.e(createScaledBitmap, "Bitmap.createScaledBitma…map, width, height, true)");
        return createScaledBitmap;
    }

    private final void d() {
        float min;
        float width = (this.d - this.m.width()) * 0.5f;
        RectF rectF = this.m;
        float f = width - rectF.left;
        float height = (this.e - rectF.height()) * 0.5f;
        RectF rectF2 = this.m;
        float f2 = height - rectF2.top;
        rectF2.offset(f, f2);
        this.k.offset(f, f2);
        FLog.d$default(this.a, "clipBorderCenter maxClipRectFW=" + this.n.width() + " ; maxClipRectFH=" + this.n.height() + " ; clipRectFW=" + this.m.width() + " ; clipRectFH=" + this.m.height(), null, 4, null);
        if (this.A) {
            min = 1.0f;
        } else {
            float width2 = this.n.width() / this.m.width();
            float height2 = this.n.height() / this.m.height();
            FLog.d$default(this.a, "clipBorderCenter  a=" + width2 + " ; b=" + height2, null, 4, null);
            min = Math.min(width2, height2);
        }
        this.j.setScale(min, min, this.m.centerX(), this.m.centerY());
        this.j.mapRect(this.k);
        this.j.mapRect(this.m);
        f();
    }

    private final void e() {
        this.n.set(75.0f, this.b + 75.0f, this.d - 75.0f, (this.e - 75.0f) - this.c);
        FLog.d$default(this.a, "viewWidth=" + this.d + " ; viewHeight=" + this.e + " ; bitmapWidth=" + this.f + " ; bitmapHeight=" + this.g + " ; maxClipRectFWidth=" + this.n.width() + " ; maxClipRectFHeight=" + this.n.height(), null, 4, null);
        float min = Math.min(this.n.width() / ((float) this.f), this.n.height() / ((float) this.g));
        String str = this.a;
        StringBuilder sb = new StringBuilder();
        sb.append("scaleFactor=");
        sb.append(min);
        FLog.d$default(str, sb.toString(), null, 4, null);
        float f = (float) this.d;
        float f2 = (f - (((float) this.f) * min)) * 0.5f;
        float f3 = (float) this.e;
        float f4 = (f3 - (((float) this.g) * min)) * 0.5f;
        this.k.set(f2, f4, f - f2, f3 - f4);
        FLog.d$default(this.a, "bitmapRectFWidth=" + this.k.width() + " ; bitmapRectFHeight=" + this.k.height(), null, 4, null);
        if (this.A) {
            return;
        }
        this.m.set(i.c(this.k.left, this.n.left), i.c(this.k.top, this.n.top), i.g(this.k.right, this.n.right), i.g(this.k.bottom, this.n.bottom));
    }

    private final void f() {
        RectF rectF = this.m;
        float f = rectF.left;
        float f2 = f - 75.0f;
        float f3 = rectF.top - 75.0f;
        float f4 = rectF.right + 75.0f;
        float f5 = rectF.bottom + 75.0f;
        this.o.set(f2, f3, f + 75.0f, f5);
        this.p.set(f2, f3, f4, this.m.top + 75.0f);
        this.q.set(this.m.right - 75.0f, f3, f4, f5);
        this.r.set(f2, this.m.bottom - 75.0f, f4, f5);
    }

    private final void g() {
        float min = Math.min(this.k.width(), (this.k.height() * this.C) / this.D);
        float f = (this.D * min) / this.C;
        FLog.d$default(this.a, "fixedClipSizeMeasure clipWidth=" + min + ", clipHeight=" + f, null, 4, null);
        float f2 = (((float) this.d) - min) * 0.5f;
        float f3 = (((float) this.e) - f) * 0.5f;
        this.m.set(f2, f3, min + f2, f + f3);
    }

    private final boolean h() {
        return this.s || this.t || this.u || this.v;
    }

    private final void i() {
        if (this.k.width() < this.m.width() || this.k.height() < this.m.height()) {
            float width = this.m.width() / this.k.width();
            float height = this.m.height() / this.k.height();
            float max = Math.max(width, height);
            float centerX = this.k.centerX();
            float centerY = this.k.centerY();
            FLog.d$default(this.a, "resetBitmapRectF scale=" + max + " ; a=" + width + " ; b=" + height, null, 4, null);
            this.j.setScale(max, max, centerX, centerY);
            this.j.mapRect(this.k);
        }
        RectF rectF = this.k;
        float f = rectF.left;
        float f2 = this.m.left;
        if (f > f2) {
            rectF.offset(f2 - f, 0.0f);
        }
        RectF rectF2 = this.k;
        float f3 = rectF2.top;
        float f4 = this.m.top;
        if (f3 > f4) {
            rectF2.offset(0.0f, f4 - f3);
        }
        RectF rectF3 = this.k;
        float f5 = rectF3.right;
        float f6 = this.m.right;
        if (f5 < f6) {
            rectF3.offset(f6 - f5, 0.0f);
        }
        RectF rectF4 = this.k;
        float f7 = rectF4.bottom;
        float f8 = this.m.bottom;
        if (f7 < f8) {
            rectF4.offset(0.0f, f8 - f7);
        }
    }

    private final void j() {
        this.s = false;
        this.t = false;
        this.u = false;
        this.v = false;
        this.w = false;
        this.x = false;
    }

    public final void a() {
        Bitmap bitmap = this.h;
        if (bitmap == null) {
            n.z("orgBitmap");
        }
        this.i = bitmap;
        if (bitmap == null) {
            n.z("bitmap");
        }
        this.f = bitmap.getWidth();
        Bitmap bitmap2 = this.i;
        if (bitmap2 == null) {
            n.z("bitmap");
        }
        this.g = bitmap2.getHeight();
        this.j.reset();
        e();
        f();
        d();
        postInvalidate();
    }

    public final void a(int i, int i2) {
        this.A = true;
        this.C = i;
        this.D = i2;
    }

    public final void b() {
        this.j.reset();
        this.j.setRotate(-90.0f, this.m.centerX(), this.m.centerY());
        this.j.mapRect(this.k);
        if (!this.A) {
            this.j.mapRect(this.m);
        }
        Bitmap bitmap = this.i;
        if (bitmap == null) {
            n.z("bitmap");
        }
        Bitmap createBitmap = Bitmap.createBitmap(bitmap, 0, 0, this.f, this.g, this.j, true);
        n.e(createBitmap, "Bitmap.createBitmap(bitm…ight, bitmapMatrix, true)");
        this.i = createBitmap;
        if (createBitmap == null) {
            n.z("bitmap");
        }
        this.f = createBitmap.getWidth();
        Bitmap bitmap2 = this.i;
        if (bitmap2 == null) {
            n.z("bitmap");
        }
        this.g = bitmap2.getHeight();
        f();
        d();
        postInvalidate();
    }

    public final Bitmap c() {
        RectF rectF = new RectF(this.m);
        RectF rectF2 = new RectF(this.k);
        if (this.A) {
            rectF.intersect(rectF2);
        }
        Paint paint = new Paint(1);
        paint.setAntiAlias(true);
        paint.setDither(true);
        paint.setFilterBitmap(true);
        int d = i.d((int) rectF.width(), 1);
        int d2 = i.d((int) rectF.height(), 1);
        Bitmap bitmap = this.i;
        if (bitmap == null) {
            n.z("bitmap");
        }
        Bitmap createBitmap = Bitmap.createBitmap(d, d2, bitmap.getConfig());
        FLog.d$default(this.a, "saveBitmap clipBitmapWidth:" + d + " clipBitmapHeight:" + d2, null, 4, null);
        Canvas canvas = new Canvas(createBitmap);
        float f = -rectF.left;
        float f2 = -rectF.top;
        rectF.offset(f, f2);
        canvas.drawRect(rectF, paint);
        paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
        rectF2.offset(f, f2);
        Bitmap bitmap2 = this.i;
        if (bitmap2 == null) {
            n.z("bitmap");
        }
        canvas.drawBitmap(bitmap2, (Rect) null, rectF2, paint);
        float width = this.f / rectF2.width();
        n.e(createBitmap, "clipBitmap");
        return a(createBitmap, width);
    }

    public final boolean getB() {
        return this.B;
    }

    @Override
    public void onDraw(Canvas canvas) {
        n.j(canvas, "canvas");
        super.onDraw(canvas);
        canvas.save();
        Bitmap bitmap = this.i;
        if (bitmap == null) {
            n.z("bitmap");
        }
        canvas.drawBitmap(bitmap, (Rect) null, this.k, (Paint) null);
        canvas.restore();
        float f = this.d;
        float f2 = this.e;
        RectF rectF = this.m;
        float f3 = rectF.left;
        float f4 = rectF.top;
        float f5 = rectF.right;
        float f6 = rectF.bottom;
        this.l.setColor(Color.parseColor(this.A ? "#60565c5c" : "#60000000"));
        canvas.drawRect(0.0f, 0.0f, f, f4, this.l);
        canvas.drawRect(0.0f, f4, f3, f6, this.l);
        canvas.drawRect(f5, f4, f, f6, this.l);
        canvas.drawRect(0.0f, f6, f, f2, this.l);
        float f7 = f6;
        this.l.setColor(-1);
        if (!this.A) {
            float f8 = 3;
            float width = this.m.width() / f8;
            float height = this.m.height() / f8;
            int i = 1;
            while (i <= 2) {
                float f9 = i;
                float f10 = f3 + (width * f9);
                canvas.drawRect(f10, f4, f10 + 2.0f, f7, this.l);
                float f11 = f4 + (f9 * height);
                canvas.drawRect(f3, f11, f5, f11 + 2.0f, this.l);
                i++;
                f7 = f7;
            }
        }
        float f12 = f7;
        float f13 = this.A ? 0.0f : 5.0f;
        canvas.drawRect(f3, f4, f5, f4 + f13, this.l);
        canvas.drawRect(f3, f4, f3 + f13, f12, this.l);
        canvas.drawRect(f5 - f13, f4, f5, f12, this.l);
        canvas.drawRect(f3, f12 - f13, f5, f12, this.l);
        if (this.A) {
            return;
        }
        float f14 = f3 - 10.0f;
        float f15 = f4 + 50.0f;
        canvas.drawRect(f14, f4, f3, f15, this.l);
        float f16 = f4 - 10.0f;
        float f17 = f3 + 50.0f;
        canvas.drawRect(f14, f16, f17, f4, this.l);
        float f18 = f5 + 10.0f;
        canvas.drawRect(f5, f4, f18, f15, this.l);
        float f19 = f5 - 50.0f;
        canvas.drawRect(f19, f16, f18, f4, this.l);
        float f20 = f12 - 50.0f;
        canvas.drawRect(f14, f20, f3, f12, this.l);
        float f21 = f12 + 10.0f;
        canvas.drawRect(f14, f12, f17, f21, this.l);
        canvas.drawRect(f5, f20, f18, f12, this.l);
        canvas.drawRect(f19, f12, f18, f21, this.l);
    }

    @Override
    public void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        this.d = w;
        this.e = h;
        e();
        if (this.A) {
            g();
        }
        f();
    }

    @Override
    @SuppressLint({"ClickableViewAccessibility"})
    public boolean onTouchEvent(MotionEvent event) {
        n.j(event, FinFileResourceUtil.KEY_EVENT);
        this.F.onTouchEvent(event);
        int actionMasked = event.getActionMasked();
        if (actionMasked == 0) {
            this.f132y = event.getX();
            this.f133z = event.getY();
            if (!this.A) {
                if (this.o.contains(event.getX(), event.getY())) {
                    this.s = true;
                    this.u = false;
                }
                if (this.p.contains(event.getX(), event.getY())) {
                    this.t = true;
                    this.v = false;
                }
                if (this.q.contains(event.getX(), event.getY())) {
                    this.s = false;
                    this.u = true;
                }
                if (this.r.contains(event.getX(), event.getY())) {
                    this.t = false;
                    this.v = true;
                }
            }
        } else if (actionMasked == 1) {
            this.f132y = 0.0f;
            this.f133z = 0.0f;
            i();
            d();
            j();
        } else if (actionMasked == 2 && !this.x && this.n.contains(event.getX(), event.getY())) {
            if (!this.w && !this.A) {
                if (this.s) {
                    this.m.left = Math.min(event.getX(), this.q.left);
                }
                if (this.t) {
                    this.m.top = Math.min(event.getY(), this.r.top);
                }
                if (this.u) {
                    this.m.right = Math.max(event.getX(), this.o.right);
                }
                if (this.v) {
                    this.m.bottom = Math.max(event.getY(), this.p.bottom);
                }
                if (this.k.width() < this.m.width()) {
                    float width = this.m.width() / this.k.width();
                    this.j.setScale(width, width, this.k.centerX(), (this.k.top - 75.0f) + this.m.centerY());
                    this.j.mapRect(this.k);
                    RectF rectF = this.k;
                    rectF.offset(this.m.left - rectF.left, 0.0f);
                }
                if (this.k.height() < this.m.height()) {
                    float height = this.m.height() / this.k.height();
                    this.j.setScale(height, height, (this.k.left - 75.0f) + this.m.centerX(), this.k.centerY());
                    this.j.mapRect(this.k);
                    RectF rectF2 = this.k;
                    rectF2.offset(0.0f, this.m.top - rectF2.top);
                }
            }
            if (!h() && this.k.contains(event.getX(), event.getY())) {
                this.w = true;
                this.k.offset(event.getX() - this.f132y, event.getY() - this.f133z);
                this.f132y = event.getX();
                this.f133z = event.getY();
            }
        }
        postInvalidate();
        return true;
    }

    public final void setBitmapResource(Bitmap bitmap) {
        n.j(bitmap, "bitmap");
        this.h = bitmap;
        this.i = bitmap;
        this.f = bitmap.getWidth();
        this.g = bitmap.getHeight();
        postInvalidate();
    }

    public final void setFixedClipSizeMeasured(boolean z10) {
        this.B = z10;
    }

    public final void setFixedRatioClip(boolean z10) {
        this.A = z10;
    }
}