正在查看: Credmex v3.12.2 应用的 SearchLocalDataActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Credmex v3.12.2 应用的 SearchLocalDataActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.credmex.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatEditText;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.credmex.adapters.OnItemClickListener;
import com.credmex.adapters.SearchLocalDataAdapter;
import com.credmex.commom.CommonActivity;
import com.credmex.track.ThirdPartEventUtils;
import com.credmex.widght.editTextBridge.DefaultTextWatcher;
import com.open.mx.ui.model.LabelBean;
import com.veda.supertoolkit.customtools.CollectionUtils;
import com.veda.supertoolkit.lifecycle.LifecycleEvent;
import com.veda.supertoolkit.widgets.BaseUtils;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Predicate;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.TimeUnit;
public class SearchLocalDataActivity extends CommonActivity {
public static final String LOCAL_DATA_LIST = "local_data_list";
public static final String SELECTED_DATA = "selected_data";
private ArrayList<LabelBean> D;
private ArrayList<LabelBean> E;
private SearchLocalDataAdapter F;
@BindView(2131362183)
AppCompatEditText etSearchData;
@BindView(2131362759)
RecyclerView rvDataList;
public void f0(View view, int i2, LabelBean labelBean) {
Intent intent = new Intent();
intent.putExtra(SELECTED_DATA, (Serializable) this.D.get(i2));
setResult(2001, intent);
finish();
AutoTrackHelper.trackRecyclerViewItemOnClick(view, i2, labelBean);
}
public static boolean g0(LifecycleEvent lifecycleEvent) throws Exception {
return lifecycleEvent == LifecycleEvent.d;
}
public void h0(LifecycleEvent lifecycleEvent) throws Exception {
showSoftInput(this.etSearchData);
}
public void i0(String str) {
if (CollectionUtils.a(this.E)) {
return;
}
this.D.clear();
if (str.length() == 0) {
this.D.addAll(this.E);
this.F.notifyDataSetChanged();
return;
}
Iterator<LabelBean> it = this.E.iterator();
while (it.hasNext()) {
LabelBean next = it.next();
if (next.label.toLowerCase().contains(str.toLowerCase())) {
this.D.add(next);
}
}
this.F.notifyDataSetChanged();
}
public static void startSearchLocalDataActivityForResult(Activity activity, int i2, ArrayList<LabelBean> arrayList) {
Intent intent = new Intent(activity, (Class<?>) SearchLocalDataActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable(LOCAL_DATA_LIST, arrayList);
intent.putExtras(bundle);
activity.startActivityForResult(intent, i2);
}
@Override
protected int A() {
return 0;
}
@Override
protected void D() {
super.D();
SearchLocalDataAdapter searchLocalDataAdapter = new SearchLocalDataAdapter(this, this.D);
this.F = searchLocalDataAdapter;
this.rvDataList.setAdapter(searchLocalDataAdapter);
this.F.e(new OnItemClickListener() {
public final void a(View view, int i2, Object obj) {
SearchLocalDataActivity.this.f0(view, i2, (LabelBean) obj);
}
});
}
@Override
protected void G(@NonNull Bundle bundle) {
super.G(bundle);
this.E = (ArrayList) bundle.getSerializable(LOCAL_DATA_LIST);
ArrayList<LabelBean> arrayList = new ArrayList<>();
this.D = arrayList;
arrayList.addAll(this.E);
}
@Override
@SuppressLint({"CheckResult"})
protected void K() {
super.K();
this.rvDataList.setLayoutManager(new LinearLayoutManager(this));
this.etSearchData.addTextChangedListener(new DefaultTextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
SearchLocalDataActivity.this.i0(editable.toString());
}
});
ThirdPartEventUtils.f(this.etSearchData);
duringActive(lifecycleObs()).x(new Predicate() {
public final boolean test(Object obj) {
boolean g0;
g0 = SearchLocalDataActivity.g0((LifecycleEvent) obj);
return g0;
}
}).e0(1L).o(200L, TimeUnit.MILLISECONDS).J(AndroidSchedulers.a()).W(new Consumer() {
public final void accept(Object obj) {
SearchLocalDataActivity.this.h0((LifecycleEvent) obj);
}
}, new x2());
}
@Override
protected void X(@NonNull Bundle bundle) {
super.X(bundle);
bundle.putSerializable(LOCAL_DATA_LIST, this.E);
}
@OnClick({2131362302})
public void clickBack() {
if (BaseUtils.b()) {
return;
}
finish();
}
@Override
public int getLayoutID() {
return 2131558447;
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnCreated(@NonNull Runnable runnable) {
return com.veda.supertoolkit.lifecycle.i.a(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnDestroy(@NonNull Runnable runnable) {
return com.veda.supertoolkit.lifecycle.i.b(this, runnable);
}
@Override
@SuppressLint({"CheckResult"})
public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
return com.veda.supertoolkit.lifecycle.i.c(this, lifecycleEvent, runnable);
}
}