导航菜单

页面标题

页面副标题

Housing v14.7.8 - GroupView.java 源代码

正在查看: Housing v14.7.8 应用的 GroupView.java JAVA 源代码文件

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


package com.horcrux.svg;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.Region;
import android.view.View;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableMap;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.ArrayList;
import javax.annotation.Nullable;

@SuppressLint({"ViewConstructor"})
class GroupView extends RenderableView {

    @Nullable
    ReadableMap mFont;
    private k mGlyphContext;
    private Bitmap mLayerBitmap;
    private Canvas mLayerCanvas;
    private final Paint mLayerPaint;

    public GroupView(ReactContext reactContext) {
        super(reactContext);
        this.mLayerPaint = new Paint(1);
    }

    public void b(Canvas canvas, Paint paint, float f) {
        h();
        SvgView svgView = getSvgView();
        RectF rectF = new RectF();
        if (this.mOpacity != 1.0f) {
            Bitmap bitmap = this.mLayerBitmap;
            if (bitmap == null) {
                this.mLayerBitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
                this.mLayerCanvas = new Canvas(this.mLayerBitmap);
            } else {
                bitmap.recycle();
                Bitmap createBitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
                this.mLayerBitmap = createBitmap;
                this.mLayerCanvas.setBitmap(createBitmap);
            }
            this.mLayerCanvas.save();
            this.mLayerCanvas.setMatrix(canvas.getMatrix());
        } else {
            this.mLayerCanvas = canvas;
        }
        this.elements = new ArrayList<>();
        for (int i = 0; i < getChildCount(); i++) {
            Object childAt = getChildAt(i);
            if (!(childAt instanceof MaskView)) {
                if (childAt instanceof VirtualView) {
                    VirtualView virtualView = (VirtualView) childAt;
                    if (!za.a.NONE.equals(virtualView.mDisplay)) {
                        boolean z = virtualView instanceof RenderableView;
                        if (z) {
                            ((RenderableView) virtualView).mergeProperties(this);
                        }
                        int saveAndSetupCanvas = virtualView.saveAndSetupCanvas(this.mLayerCanvas, this.mCTM);
                        virtualView.render(this.mLayerCanvas, paint, f);
                        RectF clientRect = virtualView.getClientRect();
                        if (clientRect != null) {
                            rectF.union(clientRect);
                        }
                        virtualView.restoreCanvas(this.mLayerCanvas, saveAndSetupCanvas);
                        if (z) {
                            ((RenderableView) virtualView).resetProperties();
                        }
                        if (virtualView.isResponsible()) {
                            svgView.enableTouchEvents();
                        }
                        ArrayList<n> arrayList = virtualView.elements;
                        if (arrayList != null) {
                            this.elements.addAll(arrayList);
                        }
                    }
                } else if (childAt instanceof SvgView) {
                    SvgView svgView2 = (SvgView) childAt;
                    svgView2.drawChildren(canvas);
                    if (svgView2.isResponsible()) {
                        svgView.enableTouchEvents();
                    }
                }
            }
        }
        if (this.mOpacity != 1.0f) {
            this.mLayerCanvas.restore();
            int save = canvas.save();
            canvas.setMatrix(null);
            this.mLayerPaint.setAlpha((int) (this.mOpacity * 255.0f));
            canvas.drawBitmap(this.mLayerBitmap, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, this.mLayerPaint);
            canvas.restoreToCount(save);
        }
        setClientRect(rectF);
        g();
    }

    public final void c(Canvas canvas, Paint paint, float f) {
        super.draw(canvas, paint, f);
    }

    public final k d() {
        return this.mGlyphContext;
    }

    @Override
    public void draw(Canvas canvas, Paint paint, float f) {
        i(canvas);
        clip(canvas, paint);
        b(canvas, paint, f);
        renderMarkers(canvas, paint, f);
    }

    public Path e(Canvas canvas, Paint paint) {
        Region.Op op = Region.Op.UNION;
        Path path = new Path();
        Path.Op valueOf = Path.Op.valueOf(op.name());
        for (int i = 0; i < getChildCount(); i++) {
            Object childAt = getChildAt(i);
            if (!(childAt instanceof MaskView) && (childAt instanceof VirtualView)) {
                VirtualView virtualView = (VirtualView) childAt;
                Matrix matrix = virtualView.mMatrix;
                Path e = virtualView instanceof GroupView ? ((GroupView) virtualView).e(canvas, paint) : virtualView.getPath(canvas, paint);
                e.transform(matrix);
                path.op(e, valueOf);
            }
        }
        return path;
    }

    public final k f() {
        GroupView textRoot = getTextRoot();
        textRoot.getClass();
        return textRoot.mGlyphContext;
    }

    public void g() {
        f().l();
    }

    @Override
    public Path getPath(Canvas canvas, Paint paint) {
        Path path = this.mPath;
        if (path != null) {
            return path;
        }
        this.mPath = new Path();
        for (int i = 0; i < getChildCount(); i++) {
            Object childAt = getChildAt(i);
            if (!(childAt instanceof MaskView) && (childAt instanceof VirtualView)) {
                VirtualView virtualView = (VirtualView) childAt;
                this.mPath.addPath(virtualView.getPath(canvas, paint), virtualView.mMatrix);
            }
        }
        return this.mPath;
    }

    public void h() {
        k f = f();
        f.o(this, this.mFont);
        f.n();
    }

    @Override
    public int hitTest(float[] fArr) {
        int reactTagForTouch;
        VirtualView virtualView;
        int hitTest;
        if (!this.mInvertible) {
            return -1;
        }
        float[] fArr2 = new float[2];
        this.mInvMatrix.mapPoints(fArr2, fArr);
        this.mInvTransform.mapPoints(fArr2);
        int round = Math.round(fArr2[0]);
        int round2 = Math.round(fArr2[1]);
        Path clipPath = getClipPath();
        if (clipPath != null) {
            if (this.mClipRegionPath != clipPath) {
                this.mClipRegionPath = clipPath;
                RectF rectF = new RectF();
                this.mClipBounds = rectF;
                clipPath.computeBounds(rectF, true);
                this.mClipRegion = getRegion(clipPath, this.mClipBounds);
            }
            if (!this.mClipRegion.contains(round, round2)) {
                return -1;
            }
        }
        for (int childCount = getChildCount() - 1; childCount >= 0; childCount--) {
            View childAt = getChildAt(childCount);
            if (childAt instanceof VirtualView) {
                if (!(childAt instanceof MaskView) && (hitTest = (virtualView = (VirtualView) childAt).hitTest(fArr2)) != -1) {
                    return (virtualView.isResponsible() || hitTest != childAt.getId()) ? hitTest : getId();
                }
            } else if ((childAt instanceof SvgView) && (reactTagForTouch = ((SvgView) childAt).reactTagForTouch(fArr2[0], fArr2[1])) != childAt.getId()) {
                return reactTagForTouch;
            }
        }
        return -1;
    }

    public final void i(Canvas canvas) {
        RectF rectF = new RectF(canvas.getClipBounds());
        Matrix matrix = this.mMatrix;
        if (matrix != null) {
            matrix.mapRect(rectF);
        }
        this.mGlyphContext = new k(this.mScale, rectF.width(), rectF.height());
    }

    @Override
    public void resetProperties() {
        for (int i = 0; i < getChildCount(); i++) {
            Object childAt = getChildAt(i);
            if (childAt instanceof RenderableView) {
                ((RenderableView) childAt).resetProperties();
            }
        }
    }

    @Override
    public void saveDefinition() {
        if (this.mName != null) {
            getSvgView().defineTemplate(this, this.mName);
        }
        for (int i = 0; i < getChildCount(); i++) {
            Object childAt = getChildAt(i);
            if (childAt instanceof VirtualView) {
                ((VirtualView) childAt).saveDefinition();
            }
        }
    }
}