删除历史记录,搜索优化完成
This commit is contained in:
parent
04b720311c
commit
b05ab47822
@ -53,6 +53,13 @@ public class SearchRecommendAdapter extends RecyclerView.Adapter {
|
|||||||
public void onChipClick(String chip) {
|
public void onChipClick(String chip) {
|
||||||
Bus.get().post(chip);
|
Bus.get().post(chip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void searchDel() {
|
||||||
|
//删除历史记录
|
||||||
|
recommendModels.remove(position);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
SearchRecommendBodyViewHolder bodyViewHolder = (SearchRecommendBodyViewHolder) holder;
|
SearchRecommendBodyViewHolder bodyViewHolder = (SearchRecommendBodyViewHolder) holder;
|
||||||
|
@ -11,6 +11,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.manager.SearchHistoryRecordManager;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -58,6 +59,15 @@ public class SearchRecommendHeardViewHolder extends RecyclerView.ViewHolder {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
searchDel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (callBack != null) {
|
||||||
|
SearchHistoryRecordManager.get(itemView.getContext()).removeAllHistoryRecord();
|
||||||
|
callBack.searchDel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,6 +75,8 @@ public class SearchRecommendHeardViewHolder extends RecyclerView.ViewHolder {
|
|||||||
*/
|
*/
|
||||||
public interface SearchRecommendHeardCallBack {
|
public interface SearchRecommendHeardCallBack {
|
||||||
void onChipClick(String chip);
|
void onChipClick(String chip);
|
||||||
|
|
||||||
|
void searchDel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private SearchRecommendHeardCallBack callBack;
|
private SearchRecommendHeardCallBack callBack;
|
||||||
|
Loading…
Reference in New Issue
Block a user