导航菜单

页面标题

页面副标题

FanCode v7.24.0 - b.java 源代码

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

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


package yc;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.fancode.shop.component.productrail.WebViewActivity;
import com.google.android.gms.common.internal.ImagesContract;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.Regex;
import org.jetbrains.annotations.NotNull;
import tc.b;
import yc.b;

@Metadata
public final class b extends RecyclerView.h<a> {

    @NotNull
    private final Context a;

    @NotNull
    private ArrayList<b.d> b;
    private String c;

    @NotNull
    private final Function1<b.d, Unit> d;

    @Metadata
    @SourceDebugExtension({"SMAP\nProductAdapter.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ProductAdapter.kt\ncom/fancode/shop/component/productrail/ProductAdapter$ViewHolder\n+ 2 _Arrays.kt\nkotlin/collections/ArraysKt___ArraysKt\n*L\n1#1,90:1\n11065#2:91\n11400#2,3:92\n*S KotlinDebug\n*F\n+ 1 ProductAdapter.kt\ncom/fancode/shop/component/productrail/ProductAdapter$ViewHolder\n*L\n51#1:91\n51#1:92,3\n*E\n"})
    public final class a extends RecyclerView.e0 {
        final b A;

        @NotNull
        private final ImageView u;

        @NotNull
        private final TextView v;

        @NotNull
        private final TextView w;

        @NotNull
        private final TextView x;

        @NotNull
        private final TextView y;

        @NotNull
        private final TextView z;

        public a(@NotNull b bVar, View view) {
            super(view);
            Intrinsics.checkNotNullParameter(view, "itemView");
            this.A = bVar;
            View findViewById = view.findViewById(xc.e.e);
            Intrinsics.checkNotNullExpressionValue(findViewById, "itemView.findViewById(R.id.productImage)");
            this.u = (ImageView) findViewById;
            View findViewById2 = view.findViewById(xc.e.f);
            Intrinsics.checkNotNullExpressionValue(findViewById2, "itemView.findViewById(R.id.productName)");
            this.v = (TextView) findViewById2;
            View findViewById3 = view.findViewById(xc.e.b);
            Intrinsics.checkNotNullExpressionValue(findViewById3, "itemView.findViewById(R.id.productDescription)");
            this.w = (TextView) findViewById3;
            View findViewById4 = view.findViewById(xc.e.d);
            Intrinsics.checkNotNullExpressionValue(findViewById4, "itemView.findViewById(R.id.productDiscountedPrice)");
            this.x = (TextView) findViewById4;
            View findViewById5 = view.findViewById(xc.e.a);
            Intrinsics.checkNotNullExpressionValue(findViewById5, "itemView.findViewById(R.id.productActualPrice)");
            this.y = (TextView) findViewById5;
            View findViewById6 = view.findViewById(xc.e.c);
            Intrinsics.checkNotNullExpressionValue(findViewById6, "itemView.findViewById(R.id.productDiscount)");
            this.z = (TextView) findViewById6;
        }

        public final void O(@NotNull b.d dVar) {
            Intrinsics.checkNotNullParameter(dVar, "product");
            long round = Math.round(((dVar.e() - dVar.j()) / dVar.e()) * 100);
            com.bumptech.glide.c.C(this.A.b().getApplicationContext()).load(dVar.g().a()).into(this.u);
            this.v.setText(dVar.h());
            this.w.setText(dVar.a());
            this.x.setText("₹" + dVar.j());
            if (round == 0) {
                this.y.setText("");
                this.z.setText("");
                return;
            }
            this.y.setText("₹" + dVar.e());
            TextView textView = this.y;
            textView.setPaintFlags(textView.getPaintFlags() | 16);
            this.z.setText(round + "% Off");
        }

        @NotNull
        public final String P(@NotNull String... strArr) {
            Intrinsics.checkNotNullParameter(strArr, "str");
            ArrayList arrayList = new ArrayList(strArr.length);
            for (String str : strArr) {
                Intrinsics.checkNotNull(str);
                arrayList.add(new Regex("[^A-Z0-9]+", kotlin.text.f.c).replace(str, "-"));
            }
            String lowerCase = CollectionsKt.d0(arrayList, "-", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (Function1) null, 62, (Object) null).toLowerCase(Locale.ROOT);
            Intrinsics.checkNotNullExpressionValue(lowerCase, "toLowerCase(...)");
            return lowerCase;
        }
    }

    public b(@NotNull Context context, @NotNull ArrayList<b.d> arrayList, String str, @NotNull Function1<? super b.d, Unit> function1) {
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(arrayList, "productList");
        Intrinsics.checkNotNullParameter(function1, "onProductClick");
        this.a = context;
        this.b = arrayList;
        this.c = str;
        this.d = function1;
    }

    public static final void d(a aVar, b.d dVar, b bVar, View view) {
        Intrinsics.checkNotNullParameter(aVar, "$holder");
        Intrinsics.checkNotNullParameter(dVar, "$product");
        Intrinsics.checkNotNullParameter(bVar, "this$0");
        String str = "https://www.fancode.com/shop/category/" + aVar.P(dVar.d()) + "/" + aVar.P(dVar.d(), dVar.a()) + "/" + dVar.i() + "?trafficSource=FCAndroid&webviewIntentSupported=true";
        Intent intent = new Intent(bVar.a, (Class<?>) WebViewActivity.class);
        intent.putExtra(ImagesContract.URL, str);
        intent.putExtra("refreshToken", bVar.c);
        bVar.d.invoke(dVar);
        bVar.a.startActivity(intent);
    }

    @NotNull
    public final Context b() {
        return this.a;
    }

    public void onBindViewHolder(@NotNull final a aVar, int i) {
        Intrinsics.checkNotNullParameter(aVar, "holder");
        b.d dVar = this.b.get(i);
        Intrinsics.checkNotNullExpressionValue(dVar, "productList[position]");
        aVar.O(dVar);
        b.d dVar2 = this.b.get(i);
        Intrinsics.checkNotNullExpressionValue(dVar2, "productList[position]");
        final b.d dVar3 = dVar2;
        aVar.O(dVar3);
        ((RecyclerView.e0) aVar).a.invalidate();
        ((RecyclerView.e0) aVar).a.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                b.d(b.a.this, dVar3, this, view);
            }
        });
    }

    @NotNull
    public a onCreateViewHolder(@NotNull ViewGroup viewGroup, int i) {
        Intrinsics.checkNotNullParameter(viewGroup, "parent");
        View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(xc.f.b, viewGroup, false);
        Intrinsics.checkNotNullExpressionValue(inflate, "view");
        return new a(this, inflate);
    }

    public final void f(@NotNull List<b.d> list, String str) {
        Intrinsics.checkNotNullParameter(list, "products");
        this.b = new ArrayList<>(list);
        this.c = str;
        notifyDataSetChanged();
    }

    public int getItemCount() {
        return this.b.size();
    }
}