diff --git a/Share/src/main/java/com/yunbao/share/ui/AppInternalShareDialog.java b/Share/src/main/java/com/yunbao/share/ui/AppInternalShareDialog.java index 6ee31a9c2..3eddcabad 100644 --- a/Share/src/main/java/com/yunbao/share/ui/AppInternalShareDialog.java +++ b/Share/src/main/java/com/yunbao/share/ui/AppInternalShareDialog.java @@ -1,6 +1,8 @@ package com.yunbao.share.ui; import android.content.Context; +import android.text.Editable; +import android.text.TextWatcher; import android.widget.EditText; import androidx.annotation.NonNull; @@ -10,6 +12,7 @@ import com.lxj.xpopup.XPopup; import com.pdlive.shayu.R; import com.yunbao.common.dialog.AbsDialogFullScreenPopupWindow; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.share.adapters.InternalShareAdapter; @@ -65,7 +68,7 @@ public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow { dismiss(); }); findViewById(R.id.btn_share).setOnClickListener(view -> { - if(adapter.getSelectPosition()==-1){ + if (adapter.getSelectPosition() == -1) { ToastUtil.show(R.string.dialog_share_failure_not_select); return; } @@ -82,6 +85,37 @@ public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow { initRefreshView(); refreshData(); + search.addTextChangedListener(new TextWatcher() { + List searchList = new ArrayList<>(); + + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) { + String key = editable.toString(); + searchList.clear(); + if (StringUtil.isEmpty(key)) { + adapter.setList(listData); + return; + } + for (SingleConversation datum : listData) { + if (datum.mCore.getConversationTitle().contains(key)) { + searchList.add(datum); + } + } + adapter.setList(searchList); + + } + + }); }