package net.touchcapture.qr.flutterqrplus;

import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import com.journeyapps.barcodescanner.BarcodeView;
import kotlin.Metadata;
import mc.v;
import nb.g;
import org.jetbrains.annotations.Nullable;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0004\u0018\u0000 \u00152\u00020\u0001:\u0001\u0015B\u0013\b\u0016\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003¢\u0006\u0004\b\u0004\u0010\u0005B\u001d\b\u0016\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007¢\u0006\u0004\b\u0004\u0010\bB%\b\u0016\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0006\u001a\u0004\u0018\u00010\u0007\u0012\u0006\u0010\t\u001a\u00020\n¢\u0006\u0004\b\u0004\u0010\u000bJ\u0018\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0010\u001a\u00020\u000eH\u0014J\u001e\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\n2\u0006\u0010\u0014\u001a\u00020\n2\u0006\u0010\f\u001a\u00020\nR\u000e\u0010\f\u001a\u00020\nX\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0016"}, d2 = {"Lnet/touchcapture/qr/flutterqrplus/CustomFramingRectBarcodeView;", "Lcom/journeyapps/barcodescanner/BarcodeView;", "context", "Landroid/content/Context;", "<init>", "(Landroid/content/Context;)V", "attrs", "Landroid/util/AttributeSet;", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "defStyleAttr", "", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "bottomOffset", "calculateFramingRect", "Landroid/graphics/Rect;", "container", "surface", "setFramingRect", "", "rectWidth", "rectHeight", "Companion", "qr_code_scanner_plus_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
public final class CustomFramingRectBarcodeView extends BarcodeView {

    /* JADX INFO: renamed from: n0, reason: collision with root package name */
    public int f31251n0;

    public CustomFramingRectBarcodeView(@Nullable Context context) {
        super(context);
        this.f31251n0 = -1;
    }

    @Override // com.journeyapps.barcodescanner.CameraPreview
    public final Rect b(Rect rect, Rect rect2) {
        g.i(rect2, "surface");
        Rect rect3 = new Rect(rect);
        rect3.intersect(rect2);
        Rect rectB = super.b(rect, rect2);
        if (this.f31251n0 != -1) {
            Rect rect4 = new Rect(rectB);
            int i10 = rect4.bottom;
            int i11 = this.f31251n0;
            rect4.bottom = i10 - i11;
            rect4.top -= i11;
            if (rect4.intersect(rect3)) {
                return rect4;
            }
        }
        return rectB;
    }

    public final void setFramingRect(int rectWidth, int rectHeight, int bottomOffset) {
        this.f31251n0 = bottomOffset;
        setFramingRectSize(new v(rectWidth, rectHeight));
    }

    public CustomFramingRectBarcodeView(@Nullable Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f31251n0 = -1;
    }

    public CustomFramingRectBarcodeView(@Nullable Context context, @Nullable AttributeSet attributeSet, int i10) {
        super(context, attributeSet, i10);
        this.f31251n0 = -1;
    }
}
