update 分享搜索功能

This commit is contained in:
zlzw 2024-03-21 15:04:08 +08:00
parent 9e80e77297
commit 1442d05262

View File

@ -1,6 +1,8 @@
package com.yunbao.share.ui; package com.yunbao.share.ui;
import android.content.Context; import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText; import android.widget.EditText;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -10,6 +12,7 @@ import com.lxj.xpopup.XPopup;
import com.pdlive.shayu.R; import com.pdlive.shayu.R;
import com.yunbao.common.dialog.AbsDialogFullScreenPopupWindow; import com.yunbao.common.dialog.AbsDialogFullScreenPopupWindow;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.share.adapters.InternalShareAdapter; import com.yunbao.share.adapters.InternalShareAdapter;
@ -82,6 +85,37 @@ public class AppInternalShareDialog extends AbsDialogFullScreenPopupWindow {
initRefreshView(); initRefreshView();
refreshData(); refreshData();
search.addTextChangedListener(new TextWatcher() {
List<SingleConversation> 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);
}
});
} }