导航菜单

页面标题

页面副标题

Bhakti v5.4.0 - InviteContactBottomSheet.java 源代码

正在查看: Bhakti v5.4.0 应用的 InviteContactBottomSheet.java JAVA 源代码文件

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


package com.vlv.aravali.views.fragments;

import Ai.EN.gYVEuEOn;
import Vj.F7;
import android.content.ContentResolver;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
import android.provider.ContactsContract;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.QuickContactBadge;
import android.widget.TextView;
import androidx.appcompat.widget.SearchView;
import androidx.databinding.DataBinderMapperImpl;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import com.vlv.aravali.KukuFMApplication;
import com.vlv.aravali.model.response.ReferralDataResponse;
import com.vlv.aravali.views.activities.BaseActivity;
import com.vlv.aravali.views.widgets.BottomSheetListView;
import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;

@Metadata
public final class InviteContactBottomSheet extends jb.g implements W2.a, AdapterView.OnItemClickListener {
    public static final int $stable = 8;
    public static final P0 Companion = new P0();
    public static final String START_BUNDLE = "start_bundle";
    private F7 binding;
    private Q0 contactAdapter;
    private final int contactIdIndex;
    private Cursor mAllContactCursor;
    private Cursor mCurrentCursor;
    private Fragment mParentFragment;
    private ReferralDataResponse mReferralDataResponse;
    private String mSearchQuery = "";
    private final String[] projection = {"_id", "lookup", "display_name", "photo_thumb_uri", "has_phone_number", "data1", "account_type"};
    private final int contactKeyIndex = 1;
    private final int searchIndex = 2;
    private final String selection = "account_type LIKE ? AND (display_name LIKE ? OR data1 LIKE ?)";
    private String searchString = "";
    private String mDefaultSearchString = "";

    @Metadata
    public static final class ViewHolder {
        public static final int $stable = 8;
        private TextView displayName;
        private QuickContactBadge quickContact;

        public ViewHolder() {
            this(null, 0 == true ? 1 : 0, 3, 0 == true ? 1 : 0);
        }

        public static ViewHolder copy$default(ViewHolder viewHolder, TextView textView, QuickContactBadge quickContactBadge, int i, Object obj) {
            if ((i & 1) != 0) {
                textView = viewHolder.displayName;
            }
            if ((i & 2) != 0) {
                quickContactBadge = viewHolder.quickContact;
            }
            return viewHolder.copy(textView, quickContactBadge);
        }

        public final TextView component1() {
            return this.displayName;
        }

        public final QuickContactBadge component2() {
            return this.quickContact;
        }

        public final ViewHolder copy(TextView textView, QuickContactBadge quickContactBadge) {
            return new ViewHolder(textView, quickContactBadge);
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof ViewHolder)) {
                return false;
            }
            ViewHolder viewHolder = (ViewHolder) obj;
            return Intrinsics.c(this.displayName, viewHolder.displayName) && Intrinsics.c(this.quickContact, viewHolder.quickContact);
        }

        public final TextView getDisplayName() {
            return this.displayName;
        }

        public final QuickContactBadge getQuickContact() {
            return this.quickContact;
        }

        public int hashCode() {
            TextView textView = this.displayName;
            int hashCode = (textView == null ? 0 : textView.hashCode()) * 31;
            QuickContactBadge quickContactBadge = this.quickContact;
            return hashCode + (quickContactBadge != null ? quickContactBadge.hashCode() : 0);
        }

        public final void setDisplayName(TextView textView) {
            this.displayName = textView;
        }

        public final void setQuickContact(QuickContactBadge quickContactBadge) {
            this.quickContact = quickContactBadge;
        }

        public String toString() {
            return "ViewHolder(displayName=" + this.displayName + ", quickContact=" + this.quickContact + ")";
        }

        public ViewHolder(TextView textView, QuickContactBadge quickContactBadge) {
            this.displayName = textView;
            this.quickContact = quickContactBadge;
        }

        public ViewHolder(TextView textView, QuickContactBadge quickContactBadge, int i, DefaultConstructorMarker defaultConstructorMarker) {
            this((i & 1) != 0 ? null : textView, (i & 2) != 0 ? null : quickContactBadge);
        }
    }

    private final void getBundleData() {
        Bundle arguments = getArguments();
        if (arguments != null) {
            Parcelable parcelable = arguments.getParcelable("start_bundle");
            Intrinsics.f(parcelable, "null cannot be cast to non-null type com.vlv.aravali.model.response.ReferralDataResponse");
            this.mReferralDataResponse = (ReferralDataResponse) parcelable;
        }
    }

    public final void getSearchResults(String str) {
        this.mSearchQuery = str;
        W2.b.a(this).c(this.searchIndex);
        W2.b.a(this).b(this.searchIndex, this);
    }

    public final void hideSearchResults() {
        if (Intrinsics.c(this.mAllContactCursor, this.mCurrentCursor)) {
            return;
        }
        try {
            Q0 q0 = this.contactAdapter;
            if (q0 != null) {
                q0.i((Cursor) null);
            }
            Q0 q02 = this.contactAdapter;
            if (q02 != null) {
                q02.i(this.mAllContactCursor);
            }
        } catch (Exception e) {
            xq.b bVar = xq.d.a;
            e.printStackTrace();
            bVar.d("Exception: " + Unit.a, new Object[0]);
        }
    }

    private final void initViews() {
        Q0 q0;
        F7 f7 = this.binding;
        if (f7 != null) {
            FragmentActivity activity = getActivity();
            BottomSheetListView bottomSheetListView = f7.Y;
            if (activity != null) {
                t2.a q02 = new Q0(this, activity);
                bottomSheetListView.setAdapter((ListAdapter) q02);
                q0 = q02;
            } else {
                q0 = null;
            }
            this.contactAdapter = q0;
            bottomSheetListView.setOnItemClickListener(this);
            ReferralDataResponse referralDataResponse = this.mReferralDataResponse;
            if (referralDataResponse == null) {
                Intrinsics.m("mReferralDataResponse");
                throw null;
            }
            f7.X.setText(referralDataResponse.getSub_heading());
            SearchView searchView = f7.Z;
            View findViewById = searchView.findViewById(2131364465);
            Intrinsics.checkNotNullExpressionValue(findViewById, "findViewById(...)");
            ((ImageView) findViewById).setOnClickListener(new Y(1, this, f7));
            searchView.setOnQueryTextListener(new C1810k(1, this, f7));
        }
    }

    public static final void initViews$lambda$4$lambda$3(InviteContactBottomSheet inviteContactBottomSheet, F7 f7, View view) {
        inviteContactBottomSheet.setSearchText("");
        f7.Z.clearFocus();
        inviteContactBottomSheet.hideSearchResults();
    }

    public final Bitmap loadContactPhotoThumbnail(String str) {
        AssetFileDescriptor assetFileDescriptor;
        ContentResolver contentResolver;
        AssetFileDescriptor assetFileDescriptor2 = null;
        r0 = null;
        Bitmap decodeFileDescriptor = null;
        try {
            Uri parse = Uri.parse(str);
            Intrinsics.e(parse);
            FragmentActivity activity = getActivity();
            assetFileDescriptor = (activity == null || (contentResolver = activity.getContentResolver()) == null) ? null : contentResolver.openAssetFileDescriptor(parse, "r");
            if (assetFileDescriptor != null) {
                try {
                    FileDescriptor fileDescriptor = assetFileDescriptor.getFileDescriptor();
                    if (fileDescriptor != null) {
                        decodeFileDescriptor = BitmapFactory.decodeFileDescriptor(fileDescriptor, null, null);
                    }
                } catch (FileNotFoundException unused) {
                    if (assetFileDescriptor != null) {
                        try {
                            assetFileDescriptor.close();
                        } catch (IOException unused2) {
                        }
                    }
                    return null;
                } catch (Throwable th) {
                    assetFileDescriptor2 = assetFileDescriptor;
                    th = th;
                    if (assetFileDescriptor2 != null) {
                        try {
                            assetFileDescriptor2.close();
                        } catch (IOException unused3) {
                        }
                    }
                    throw th;
                }
            }
            if (assetFileDescriptor != null) {
                try {
                    assetFileDescriptor.close();
                } catch (IOException unused4) {
                }
            }
            return decodeFileDescriptor;
        } catch (FileNotFoundException unused5) {
            assetFileDescriptor = null;
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private final void setSearchText(String str) {
        SearchView searchView;
        F7 f7 = this.binding;
        if (f7 == null || (searchView = f7.Z) == null) {
            return;
        }
        Ri.r.H(searchView, str);
    }

    private final void shareReferralLink(Object obj, Integer num, Integer num2) {
        if (getActivity() != null && isAdded() && (getActivity() instanceof BaseActivity)) {
            V0.Companion.getClass();
            V0 v0 = new V0();
            v0.setRequiredParams(obj, num, num2);
            v0.setShareCallBack(new bb.S(this, 26));
            v0.show(getChildFragmentManager(), "ShareFragment");
        }
    }

    public static void shareReferralLink$default(InviteContactBottomSheet inviteContactBottomSheet, Object obj, Integer num, Integer num2, int i, Object obj2) {
        if ((i & 2) != 0) {
            num = null;
        }
        if ((i & 4) != 0) {
            num2 = null;
        }
        inviteContactBottomSheet.shareReferralLink(obj, num, num2);
    }

    public void onCreate(Bundle bundle) {
        super/*androidx.fragment.app.y*/.onCreate(bundle);
        if (com.vlv.aravali.audiobooks.ui.fragments.p.x(KukuFMApplication.x)) {
            setStyle(0, 2132082998);
        } else {
            setStyle(0, 2132082997);
        }
        getBundleData();
        getLoaderManager().b(this.contactIdIndex, this);
    }

    public X2.d onCreateLoader(int i, Bundle bundle) {
        String str = this.searchString;
        String[] strArr = {"com.whatsapp", str, str};
        if (i == this.contactIdIndex) {
            strArr[0] = "com.whatsapp";
            strArr[1] = Ai.o.i("%", this.mDefaultSearchString, "%");
            strArr[2] = Ai.o.i("%", this.mDefaultSearchString, "%");
            FragmentActivity activity = getActivity();
            if (activity != null) {
                return new X2.c(activity, ContactsContract.CommonDataKinds.Phone.CONTENT_URI, this.projection, this.selection, strArr, "UPPER(display_name) ASC");
            }
            throw new IllegalStateException();
        }
        if (i != this.searchIndex) {
            FragmentActivity activity2 = getActivity();
            if (activity2 != null) {
                return new X2.c(activity2, ContactsContract.CommonDataKinds.Phone.CONTENT_URI, this.projection, this.selection, strArr, (String) null);
            }
            throw new IllegalStateException();
        }
        String str2 = this.mSearchQuery;
        String[] strArr2 = {"com.whatsapp", str2, str2};
        strArr2[0] = "com.whatsapp";
        strArr2[1] = Ai.o.i("%", str2, "%");
        strArr2[2] = Ai.o.i("%", this.mSearchQuery, "%");
        FragmentActivity activity3 = getActivity();
        if (activity3 != null) {
            return new X2.c(activity3, ContactsContract.CommonDataKinds.Phone.CONTENT_URI, this.projection, this.selection, strArr2, "UPPER(display_name) ASC");
        }
        throw new IllegalStateException();
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        Intrinsics.checkNotNullParameter(layoutInflater, "inflater");
        int i = F7.i0;
        DataBinderMapperImpl dataBinderMapperImpl = x2.e.a;
        F7 f7 = (F7) x2.m.k(layoutInflater, 2131558763, viewGroup, false, (Object) null);
        this.binding = f7;
        Intrinsics.e(f7);
        View view = ((x2.m) f7).d;
        Intrinsics.checkNotNullExpressionValue(view, "getRoot(...)");
        return view;
    }

    public void onDismiss(DialogInterface dialogInterface) {
        Intrinsics.checkNotNullParameter(dialogInterface, "dialog");
        androidx.datastore.preferences.protobuf.o.r(KukuFMApplication.x, "referral_contacts_bottom_sheet_closed");
        super/*androidx.fragment.app.y*/.onDismiss(dialogInterface);
    }

    public void onLoaderReset(X2.d dVar) {
        Q0 q0;
        Intrinsics.checkNotNullParameter(dVar, "loader");
        int i = dVar.a;
        if (i == this.contactIdIndex) {
            Q0 q02 = this.contactAdapter;
            if (q02 != null) {
                q02.i((Cursor) null);
                return;
            }
            return;
        }
        if (i != this.searchIndex || (q0 = this.contactAdapter) == null) {
            return;
        }
        q0.i((Cursor) null);
    }

    public void onResume() {
        Cursor cursor;
        Q0 q0;
        super/*androidx.fragment.app.Fragment*/.onResume();
        androidx.datastore.preferences.protobuf.o.r(KukuFMApplication.x, "referral_contacts_bottom_sheet_opened");
        t2.a aVar = this.contactAdapter;
        if (aVar == null || !aVar.isEmpty() || (cursor = this.mAllContactCursor) == null || (q0 = this.contactAdapter) == null) {
            return;
        }
        q0.i(cursor);
    }

    public void onViewCreated(View view, Bundle bundle) {
        Intrinsics.checkNotNullParameter(view, "view");
        super/*androidx.fragment.app.Fragment*/.onViewCreated(view, bundle);
        initViews();
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
        Intrinsics.checkNotNullParameter(adapterView, gYVEuEOn.XtBtEpGUmCiNtqx);
        Ai.p pVar = KukuFMApplication.x;
        pVar.B().d().l("invite_contact_bottomsheet_whatsapp_clicked").d();
        pVar.B().d().l("referral_contacts_bottom_sheet_invite_clicked").d();
        PackageManager packageManager = requireContext().getPackageManager();
        Intent intent = new Intent("android.intent.action.VIEW");
        try {
            ArrayList arrayList = Qn.e.a;
            FragmentActivity requireActivity = requireActivity();
            Intrinsics.checkNotNullExpressionValue(requireActivity, "requireActivity(...)");
            if (!Qn.e.I(requireActivity, "com.whatsapp")) {
                ReferralDataResponse referralDataResponse = this.mReferralDataResponse;
                if (referralDataResponse != null) {
                    shareReferralLink$default(this, referralDataResponse, null, null, 6, null);
                    return;
                } else {
                    Intrinsics.m("mReferralDataResponse");
                    throw null;
                }
            }
            ReferralDataResponse referralDataResponse2 = this.mReferralDataResponse;
            if (referralDataResponse2 == null) {
                Intrinsics.m("mReferralDataResponse");
                throw null;
            }
            String str = "https://api.whatsapp.com/send?phone=&text=" + URLEncoder.encode(referralDataResponse2.getSharing_text(), "UTF-8");
            intent.setPackage("com.whatsapp");
            intent.setData(Uri.parse(str));
            if (intent.resolveActivity(packageManager) != null) {
                requireContext().startActivity(intent);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void onLoadFinished(X2.d dVar, Cursor cursor) {
        Intrinsics.checkNotNullParameter(dVar, "loader");
        int i = dVar.a;
        if (i == this.contactIdIndex) {
            this.mCurrentCursor = cursor;
            if (this.mAllContactCursor == null) {
                this.mAllContactCursor = cursor;
            }
            Q0 q0 = this.contactAdapter;
            if (q0 != null) {
                q0.i(cursor);
                return;
            }
            return;
        }
        if (i == this.searchIndex) {
            this.mCurrentCursor = cursor;
            Q0 q02 = this.contactAdapter;
            if (q02 != null) {
                q02.i(cursor);
            }
        }
    }
}