只有主播B才能进行消息筛选

This commit is contained in:
ningwenqiang 2024-08-29 14:23:44 +08:00
parent c7f4c1276f
commit 02387a7321
5 changed files with 24 additions and 15 deletions

View File

@ -81,14 +81,12 @@ public class MainConversationListAdapter extends ConversationListAdapter {
if (this.mFilter == mFilter)
return;
this.mFilter = mFilter;
if (allDataList !=null && !allDataList.isEmpty()){
super.setDataCollection(UiConversationCodeUtil.FilterData(mFilter, allDataList));
}
// if (allDataList !=null && !allDataList.isEmpty()){
// super.setDataCollection(UiConversationCodeUtil.FilterData(mFilter, allDataList));
// }
}
public MainConversationListAdapter(Context mContext) {
this.mContext = mContext;
}
@ -287,8 +285,7 @@ public class MainConversationListAdapter extends ConversationListAdapter {
private int listHashCode = 0;
@Override
public synchronized void setDataCollection(List<BaseUiConversation> data) {
public synchronized void setDataCollectionV2(List<BaseUiConversation> data, boolean isSearch) {
if (data.hashCode() == listHashCode) return;
listHashCode = data.hashCode();
List<BaseUiConversation> tmp = new ArrayList<>();
@ -335,15 +332,21 @@ public class MainConversationListAdapter extends ConversationListAdapter {
tmp.add(item);
}
allDataList = tmp;
if(mFilter!=FILTER_OFFLINE){
if (mFilter != FILTER_OFFLINE || isSearch == true) {
List<BaseUiConversation> showData = UiConversationCodeUtil.FilterData(mFilter, tmp);
if(!UiConversationCodeUtil.checkIsSame(showData,mDataList)){
if (!UiConversationCodeUtil.checkIsSame(showData, mDataList)) {
super.setDataCollection(showData);
}
}
}
@Override
public void setDataCollection(List<BaseUiConversation> data) {
setDataCollectionV2(data, false);
}
private List<String> tmpUids = new ArrayList<>();
public void clear() {

View File

@ -76,6 +76,11 @@ public class MainMessageChatFragment extends ConversationListFragment {
}
public void refreshData() {
mRefreshLayout.autoRefresh();
//onConversationListRefresh(mRefreshLayout)
}
public void search(String search) {
((MainConversationListAdapter) mAdapter).setSearch();
getContactsList(search);
@ -150,7 +155,7 @@ public class MainMessageChatFragment extends ConversationListFragment {
list.remove(list.size() - 1);
}
list.addAll(data);
mAdapter.setDataCollection(list);
((MainConversationListAdapter) mAdapter).setDataCollectionV2(list,true);
}
@Override
@ -172,9 +177,9 @@ public class MainMessageChatFragment extends ConversationListFragment {
@Override
protected ConversationListAdapter onResolveAdapter() {
MainConversationListAdapter adapter= new MainConversationListAdapter(getContext());
MainConversationListAdapter adapter = new MainConversationListAdapter(getContext());
// adapter.setFilter(chatViewModel.getChatFilter());
this.mAdapter =adapter;
this.mAdapter = adapter;
return this.mAdapter;
}
}

View File

@ -175,6 +175,7 @@ public class MainMessageChatListFragment extends AbsMainMessageChatListFragment
public void setFilter(int mFilter) {
mAdapter.setFilter(mFilter);
chatViewModel.setChatFilter(mFilter);
conversationListFragment.refreshData();
}

View File

@ -491,7 +491,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
tabTexts.get(0).setText(WordUtil.getNewString(chatViewModel.getTitleTextId()));
ViewGroup.LayoutParams params = tabLayouts.getLayoutParams();
params.width = LinearLayout.LayoutParams.WRAP_CONTENT;
tabExpend.get(0).setVisibility(View.VISIBLE);
//tabExpend.get(0).setVisibility(View.VISIBLE);
tabLayouts.setLayoutParams(params);
} else if (userType == 1) {//主播A
tab_icon.setVisibility(View.VISIBLE);
@ -512,7 +512,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder {
tabTexts.get(0).setText(WordUtil.getNewString(R.string.message_chat_msg_recommend));
relativeLayouts.get(1).setVisibility(View.VISIBLE);
tabTexts.get(1).setText(WordUtil.getNewString(chatViewModel.getTitleTextId()));
tabExpend.get(1).setVisibility(View.VISIBLE);
// tabExpend.get(1).setVisibility(View.VISIBLE);
} else { //主播B
tabExpend.get(0).setVisibility(View.VISIBLE);
relativeLayouts.get(0).setVisibility(View.VISIBLE);

View File

@ -367,7 +367,7 @@
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible"
app:constraint_referenced_ids="tab1,tab_icon,tab_line1"/>
app:constraint_referenced_ids="tab1,tab_line1"/>
<View
android:id="@+id/view2"