导航菜单

页面标题

页面副标题

FanCode v7.24.0 - b.java 源代码

正在查看: FanCode v7.24.0 应用的 b.java JAVA 源代码文件

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


package tk;

import android.content.Context;
import android.graphics.Canvas;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.HorizontalScrollView;
import android.widget.ScrollView;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.uimanager.events.RCTEventEmitter;
import com.facebook.react.views.view.ReactViewGroup;
import java.util.Comparator;
import kotlin.Metadata;
import kotlin.collections.i;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import org.jetbrains.annotations.NotNull;

@Metadata
@SourceDebugExtension({"SMAP\nAutoLayoutView.kt\nKotlin\n*S Kotlin\n*F\n+ 1 AutoLayoutView.kt\ncom/shopify/reactnative/flash_list/AutoLayoutView\n+ 2 _Arrays.kt\nkotlin/collections/ArraysKt___ArraysKt\n*L\n1#1,151:1\n6143#2,2:152\n*S KotlinDebug\n*F\n+ 1 AutoLayoutView.kt\ncom/shopify/reactnative/flash_list/AutoLayoutView\n*L\n67#1:152,2\n*E\n"})
public final class b extends ReactViewGroup {

    @NotNull
    private final tk.a a;
    private boolean b;
    private boolean c;
    private double d;

    @Metadata
    @SourceDebugExtension({"SMAP\nComparisons.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Comparisons.kt\nkotlin/comparisons/ComparisonsKt__ComparisonsKt$compareBy$2\n+ 2 AutoLayoutView.kt\ncom/shopify/reactnative/flash_list/AutoLayoutView\n*L\n1#1,328:1\n67#2:329\n*E\n"})
    public static final class a<T> implements Comparator {
        @Override
        public final int compare(T t, T t2) {
            return tl.a.a(Integer.valueOf(((c) t).getIndex()), Integer.valueOf(((c) t2).getIndex()));
        }
    }

    public b(@NotNull Context context) {
        super(context);
        Intrinsics.checkNotNullParameter(context, "context");
        this.a = new tk.a();
        this.d = 1.0d;
    }

    private final void b() {
        WritableMap createMap = Arguments.createMap();
        Intrinsics.checkNotNullExpressionValue(createMap, "createMap()");
        createMap.putDouble("offsetStart", this.a.d() / this.d);
        createMap.putDouble("offsetEnd", this.a.c() / this.d);
        Context context = getContext();
        Intrinsics.checkNotNull(context, "null cannot be cast to non-null type com.facebook.react.bridge.ReactContext");
        ((RCTEventEmitter) ((ReactContext) context).getJSModule(RCTEventEmitter.class)).receiveEvent(getId(), "onBlankAreaEvent", createMap);
    }

    private final void c() {
        View parentScrollView = getParentScrollView();
        if (this.c || parentScrollView == null) {
            return;
        }
        boolean z = true;
        if (!this.a.e() ? getBottom() > parentScrollView.getHeight() : getRight() > parentScrollView.getWidth()) {
            z = false;
        }
        if (z) {
            Object parent = getParent();
            View view = parent instanceof View ? (View) parent : null;
            View footer = getFooter();
            int footerDiff = getFooterDiff();
            if (footerDiff == 0 || footer == null || view == null) {
                return;
            }
            if (this.a.e()) {
                footer.offsetLeftAndRight(footerDiff);
                setRight(getRight() + footerDiff);
                view.setRight(view.getRight() + footerDiff);
            } else {
                footer.offsetTopAndBottom(footerDiff);
                setBottom(getBottom() + footerDiff);
                view.setBottom(view.getBottom() + footerDiff);
            }
        }
    }

    private final void d() {
        if (getChildCount() <= 1 || this.c) {
            return;
        }
        int childCount = getChildCount();
        c[] cVarArr = new c[childCount];
        for (int i = 0; i < childCount; i++) {
            View childAt = getChildAt(i);
            if (!(childAt instanceof c)) {
                throw new IllegalStateException("CellRendererComponent outer view should always be CellContainer. Learn more here: https://shopify.github.io/flash-list/docs/usage#cellrenderercomponent.");
            }
            cVarArr[i] = childAt;
        }
        if (childCount > 1) {
            i.p(cVarArr, new a());
        }
        tk.a aVar = this.a;
        aVar.j(aVar.e() ? getLeft() : getTop());
        this.a.a(cVarArr);
    }

    private final View getFooter() {
        ViewParent parent = getParent();
        ViewGroup viewGroup = parent instanceof ViewGroup ? (ViewGroup) parent : null;
        if (viewGroup == null) {
            return null;
        }
        int childCount = viewGroup.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View childAt = viewGroup.getChildAt(i);
            if ((childAt instanceof c) && ((c) childAt).getIndex() == -1) {
                return childAt;
            }
        }
        return null;
    }

    private final int getFooterDiff() {
        int bottom;
        int top;
        if (getChildCount() == 0) {
            this.a.i(0);
        } else if (getChildCount() == 1) {
            View childAt = getChildAt(0);
            tk.a aVar = this.a;
            aVar.i(aVar.e() ? childAt.getRight() : childAt.getBottom());
        }
        if (this.a.e()) {
            bottom = getRight();
            top = getLeft();
        } else {
            bottom = getBottom();
            top = getTop();
        }
        return this.a.f() - (bottom - top);
    }

    private final View getParentScrollView() {
        for (ViewParent viewParent = getParent(); viewParent != 0; viewParent = viewParent.getParent()) {
            if ((viewParent instanceof ScrollView) || (viewParent instanceof HorizontalScrollView)) {
                return (View) viewParent;
            }
        }
        return null;
    }

    @Override
    protected void dispatchDraw(@NotNull Canvas canvas) {
        Intrinsics.checkNotNullParameter(canvas, "canvas");
        d();
        c();
        super.dispatchDraw(canvas);
        View parentScrollView = getParentScrollView();
        if (!this.b || parentScrollView == null) {
            return;
        }
        int width = this.a.e() ? parentScrollView.getWidth() : parentScrollView.getHeight();
        int scrollX = this.a.e() ? parentScrollView.getScrollX() : parentScrollView.getScrollY();
        this.a.b(scrollX, Math.max((this.a.e() ? getLeft() : getTop()) - scrollX, 0), Math.max((width + scrollX) - (this.a.e() ? getRight() : getBottom()), 0));
        b();
    }

    @NotNull
    public final tk.a getAlShadow() {
        return this.a;
    }

    public final boolean getDisableAutoLayout() {
        return this.c;
    }

    public final boolean getEnableInstrumentation() {
        return this.b;
    }

    public final double getPixelDensity() {
        return this.d;
    }

    public final void setDisableAutoLayout(boolean z) {
        this.c = z;
    }

    public final void setEnableInstrumentation(boolean z) {
        this.b = z;
    }

    public final void setPixelDensity(double d) {
        this.d = d;
    }
}