导航菜单

页面标题

页面副标题

Rilo v2.0.21 - StreamerSearchActivity.java 源代码

正在查看: Rilo v2.0.21 应用的 StreamerSearchActivity.java JAVA 源代码文件

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


package app.callpe.ui.user;

import android.content.Context;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import androidx.activity.ComponentActivity;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.recyclerview.widget.RecyclerView;
import app.callpe.adapters.StreamerSearchListAdapter;
import app.callpe.common.utils.custom.CustomLinearLayoutManager;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.StreamerModel;
import app.callpe.databinding.ActivityStreamerSearchBinding;
import app.callpe.ui.home.BaseActivity;
import app.callpe.ui.home.HomeViewModel;
import com.facebook.internal.NativeProtocol;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import java.util.List;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import timber.log.Timber;

@Metadata(d1 = {"\u0000`\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0007\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0003J \u0010\u0015\u001a\u00020\u00162\u0016\u0010\u0017\u001a\u0012\u0012\u0004\u0012\u00020\u00190\u0018j\b\u0012\u0004\u0012\u00020\u0019`\u001aH\u0002J\u0010\u0010\u001b\u001a\u00020\u00022\u0006\u0010\u001c\u001a\u00020\u001dH\u0016J\b\u0010\u001e\u001a\u00020\u0016H\u0002J\b\u0010\u001f\u001a\u00020\u0016H\u0002J\b\u0010 \u001a\u00020!H\u0002J\b\u0010\"\u001a\u00020\u0016H\u0002J\u0012\u0010#\u001a\u00020\u00162\b\u0010$\u001a\u0004\u0018\u00010%H\u0014J\b\u0010&\u001a\u00020\u0016H\u0014J\b\u0010'\u001a\u00020\u0016H\u0002J\b\u0010(\u001a\u00020\u0016H\u0002J\b\u0010)\u001a\u00020\u0016H\u0002R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u0017\u0010\n\u001a\b\u0012\u0004\u0012\u00020\f0\u000b¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u000eR\u001b\u0010\u000f\u001a\u00020\u00108BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0013\u0010\u0014\u001a\u0004\b\u0011\u0010\u0012¨\u0006*"}, d2 = {"Lapp/callpe/ui/user/StreamerSearchActivity;", "Lapp/callpe/ui/home/BaseActivity;", "Lapp/callpe/databinding/ActivityStreamerSearchBinding;", "()V", "adapter", "Lapp/callpe/adapters/StreamerSearchListAdapter;", "firstRechargeDone", "", "hideCallRate", "hideStreamerCallRate", NativeProtocol.RESULT_ARGS_PERMISSIONS, "", "", "getPermissions", "()Ljava/util/List;", "viewModel", "Lapp/callpe/ui/home/HomeViewModel;", "getViewModel", "()Lapp/callpe/ui/home/HomeViewModel;", "viewModel$delegate", "Lkotlin/Lazy;", "add", "", "list", "Ljava/util/ArrayList;", "Lapp/callpe/data/model/StreamerModel;", "Lkotlin/collections/ArrayList;", "inflateLayout", "layoutInflater", "Landroid/view/LayoutInflater;", "initValues", "observeEditTextChange", "observeEvent", "Lkotlinx/coroutines/Job;", "onClicks", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onResume", "openKeyboardAndRequestFocus", "refreshMeta", "setupRv", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class StreamerSearchActivity extends BaseActivity<ActivityStreamerSearchBinding> {
    private StreamerSearchListAdapter adapter;
    private boolean firstRechargeDone;
    private boolean hideCallRate;
    private boolean hideStreamerCallRate;
    private final List<String> permissions = CollectionsKt.listOf(new String[]{"android.permission.CAMERA", "android.permission.RECORD_AUDIO"});

    private final Lazy viewModel;

    public StreamerSearchActivity() {
        final ComponentActivity componentActivity = (ComponentActivity) this;
        final Function0 function0 = null;
        this.viewModel = new ViewModelLazy(Reflection.getOrCreateKotlinClass(HomeViewModel.class), new Function0<ViewModelStore>() {
            {
                super(0);
            }

            public final ViewModelStore m2285invoke() {
                return componentActivity.getViewModelStore();
            }
        }, new Function0<ViewModelProvider.Factory>() {
            {
                super(0);
            }

            public final ViewModelProvider.Factory m2284invoke() {
                return componentActivity.getDefaultViewModelProviderFactory();
            }
        }, new Function0<CreationExtras>() {
            {
                super(0);
            }

            public final CreationExtras m2286invoke() {
                CreationExtras creationExtras;
                Function0 function02 = function0;
                return (function02 == null || (creationExtras = (CreationExtras) function02.invoke()) == null) ? componentActivity.getDefaultViewModelCreationExtras() : creationExtras;
            }
        });
    }

    public final HomeViewModel getViewModel() {
        return (HomeViewModel) this.viewModel.getValue();
    }

    public final List<String> getPermissions() {
        return this.permissions;
    }

    @Override
    public ActivityStreamerSearchBinding inflateLayout(LayoutInflater layoutInflater) {
        Intrinsics.checkNotNullParameter(layoutInflater, "layoutInflater");
        ActivityStreamerSearchBinding inflate = ActivityStreamerSearchBinding.inflate(layoutInflater);
        Intrinsics.checkNotNullExpressionValue(inflate, "inflate(layoutInflater)");
        return inflate;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        observeEvent();
        observeEditTextChange();
        initValues();
        onClicks();
        openKeyboardAndRequestFocus();
        setupRv();
        getViewModel().getUserDetails();
    }

    private final void initValues() {
        Context context = (Context) this;
        this.firstRechargeDone = SharedPref.getBoolean(context, PrefKeys.FIRST_RECHARGE_DONE);
        boolean z = SharedPref.getBoolean(context, PrefKeys.HIDE_CALL_RATE);
        this.hideCallRate = z;
        this.hideStreamerCallRate = z;
    }

    private final void openKeyboardAndRequestFocus() {
        try {
            getBinding().searchBoxET.requestFocus();
            Object systemService = getSystemService("input_method");
            Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.view.inputmethod.InputMethodManager");
            ((InputMethodManager) systemService).showSoftInput(getBinding().searchBoxET, 1);
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    private final void onClicks() {
        getBinding().backBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                StreamerSearchActivity.onClicks$lambda$0(StreamerSearchActivity.this, view);
            }
        });
    }

    public static final void onClicks$lambda$0(StreamerSearchActivity streamerSearchActivity, View view) {
        Intrinsics.checkNotNullParameter(streamerSearchActivity, "this$0");
        streamerSearchActivity.finish();
    }

    private final void observeEditTextChange() {
        getViewModel().observeSearchQuery();
        EditText editText = getBinding().searchBoxET;
        Intrinsics.checkNotNullExpressionValue(editText, "binding.searchBoxET");
        editText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence text, int start, int count, int after) {
            }

            @Override
            public void onTextChanged(CharSequence text, int start, int before, int count) {
            }

            @Override
            public void afterTextChanged(Editable s) {
                HomeViewModel viewModel;
                String obj = StringsKt.trim(String.valueOf(s)).toString();
                viewModel = StreamerSearchActivity.this.getViewModel();
                viewModel.setSearchQuery(obj);
            }
        });
    }

    private final Job observeEvent() {
        return BuildersKt.launch$default(LifecycleOwnerKt.getLifecycleScope((LifecycleOwner) this), (CoroutineContext) null, (CoroutineStart) null, new StreamerSearchActivity$observeEvent$1(this, null), 3, (Object) null);
    }

    public final void add(ArrayList<StreamerModel> list) {
        StreamerSearchListAdapter streamerSearchListAdapter = this.adapter;
        if (streamerSearchListAdapter != null) {
            StreamerSearchListAdapter streamerSearchListAdapter2 = null;
            if (streamerSearchListAdapter == null) {
                Intrinsics.throwUninitializedPropertyAccessException("adapter");
                streamerSearchListAdapter = null;
            }
            streamerSearchListAdapter.clear();
            StreamerSearchListAdapter streamerSearchListAdapter3 = this.adapter;
            if (streamerSearchListAdapter3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("adapter");
            } else {
                streamerSearchListAdapter2 = streamerSearchListAdapter3;
            }
            streamerSearchListAdapter2.addItems(list);
        }
    }

    private final void setupRv() {
        Context context = (Context) this;
        RecyclerView.LayoutManager customLinearLayoutManager = new CustomLinearLayoutManager(context);
        boolean z = SharedPref.getBoolean(context, PrefKeys.IS_VIP);
        ((ActivityStreamerSearchBinding) getBinding()).searchedItemRv.setLayoutManager(customLinearLayoutManager);
        StreamerSearchListAdapter streamerSearchListAdapter = new StreamerSearchListAdapter(null, z, new StreamerSearchActivity$setupRv$1(this), this.hideStreamerCallRate, 1, null);
        this.adapter = streamerSearchListAdapter;
        streamerSearchListAdapter.setPaymentAppMode(BaseActivity.isPaymentAppMode);
        StreamerSearchListAdapter streamerSearchListAdapter2 = this.adapter;
        StreamerSearchListAdapter streamerSearchListAdapter3 = null;
        if (streamerSearchListAdapter2 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("adapter");
            streamerSearchListAdapter2 = null;
        }
        streamerSearchListAdapter2.setInterestKeyText(SharedPref.getString(context, PrefKeys.INTEREST_KEY_TEXT));
        RecyclerView recyclerView = ((ActivityStreamerSearchBinding) getBinding()).searchedItemRv;
        StreamerSearchListAdapter streamerSearchListAdapter4 = this.adapter;
        if (streamerSearchListAdapter4 == null) {
            Intrinsics.throwUninitializedPropertyAccessException("adapter");
        } else {
            streamerSearchListAdapter3 = streamerSearchListAdapter4;
        }
        recyclerView.setAdapter(streamerSearchListAdapter3);
    }

    public final void refreshMeta() {
        getViewModel().getUserDetails();
    }

    protected void onResume() {
        super.onResume();
        getViewModel().getUserDetails();
    }
}