Initial commit
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package com.ubt.jimu.community.view.adapter.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.TextView;
|
||||
import com.recyclelib.adapter.BaseRecyclerAdapter;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.SearchQuizBean;
|
||||
import com.ubt.jimu.utils.TextUtils;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class AskAdapter extends BaseRecyclerAdapter<SearchQuizBean.RecordsBean> {
|
||||
private String a;
|
||||
|
||||
public AskAdapter(Context context, List<SearchQuizBean.RecordsBean> list) {
|
||||
super(context, list);
|
||||
}
|
||||
|
||||
private void a(TextView textView, String str) {
|
||||
if (StringUtils.e(str)) {
|
||||
textView.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
int indexOf = str.indexOf(this.a);
|
||||
textView.setVisibility(0);
|
||||
if (indexOf == -1) {
|
||||
textView.setText(str);
|
||||
} else {
|
||||
textView.setText(TextUtils.a(str, this.a, indexOf, this.mContext.getResources().getColor(R.color.bg_F8B220)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.adapter.BaseRecyclerAdapter
|
||||
public int layoutId() {
|
||||
return R.layout.item_search_ask;
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(BaseRecyclerAdapter.BaseViewHolder baseViewHolder, int i) {
|
||||
SearchQuizBean.RecordsBean recordsBean = (SearchQuizBean.RecordsBean) this.mList.get(i);
|
||||
TextView textView = (TextView) baseViewHolder.getView(R.id.tv_title_ask);
|
||||
TextView textView2 = (TextView) baseViewHolder.getView(R.id.tv_ask_score);
|
||||
TextView textView3 = (TextView) baseViewHolder.getView(R.id.tv_state);
|
||||
a(textView, recordsBean.getTitle());
|
||||
textView2.setText(String.format(this.mContext.getString(R.string.search_item_ask_score), recordsBean.getScore() + ""));
|
||||
if ("1".equals(recordsBean.getContent())) {
|
||||
textView3.setText(this.mContext.getString(R.string.search_item_ask_use));
|
||||
} else {
|
||||
textView3.setText(this.mContext.getString(R.string.search_item_no_use));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package com.ubt.jimu.community.view.adapter.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BasePagerAdapter<T extends View> extends PagerAdapter {
|
||||
protected List<T> a;
|
||||
|
||||
public BasePagerAdapter(Context context, List<T> list) {
|
||||
this.a = list;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public void destroyItem(ViewGroup viewGroup, int i, Object obj) {
|
||||
viewGroup.removeView(this.a.get(i));
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public int getCount() {
|
||||
List<T> list = this.a;
|
||||
if (list == null) {
|
||||
return 0;
|
||||
}
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public Object instantiateItem(ViewGroup viewGroup, int i) {
|
||||
viewGroup.addView(this.a.get(i));
|
||||
return this.a.get(i);
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public boolean isViewFromObject(View view, Object obj) {
|
||||
return view == obj;
|
||||
}
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
package com.ubt.jimu.community.view.adapter.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.recyclelib.adapter.BaseRecyclerAdapter;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.SearchContentBean;
|
||||
import com.ubt.jimu.community.view.PublishDetailActivity;
|
||||
import com.ubt.jimu.utils.GlideRoundTransform;
|
||||
import com.ubt.jimu.utils.TextUtils;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ContentAdapter extends BaseRecyclerAdapter<SearchContentBean.RecordsBean> {
|
||||
private String a;
|
||||
|
||||
public ContentAdapter(Context context, List<SearchContentBean.RecordsBean> list) {
|
||||
super(context, list);
|
||||
new GlideRoundTransform(context);
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(SearchContentBean.RecordsBean recordsBean, View view) {
|
||||
PublishDetailActivity.start(this.mContext, recordsBean.getId());
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.adapter.BaseRecyclerAdapter
|
||||
public int layoutId() {
|
||||
return R.layout.item_search_content;
|
||||
}
|
||||
|
||||
private void a(String str, String str2, TextView textView, TextView textView2) {
|
||||
if (StringUtils.e(str)) {
|
||||
textView.setVisibility(8);
|
||||
} else {
|
||||
int indexOf = str.indexOf(this.a);
|
||||
textView.setVisibility(0);
|
||||
if (indexOf == -1) {
|
||||
textView.setText(str);
|
||||
} else {
|
||||
textView.setText(TextUtils.a(str, this.a, indexOf, this.mContext.getResources().getColor(R.color.bg_F8B220)));
|
||||
}
|
||||
}
|
||||
if (StringUtils.e(str2)) {
|
||||
textView2.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
int indexOf2 = str2.indexOf(this.a);
|
||||
textView2.setVisibility(0);
|
||||
if (indexOf2 == -1) {
|
||||
textView2.setText(str2);
|
||||
} else {
|
||||
textView2.setText(TextUtils.a(str2, this.a, indexOf2, this.mContext.getResources().getColor(R.color.bg_F8B220)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(BaseRecyclerAdapter.BaseViewHolder baseViewHolder, int i) {
|
||||
final SearchContentBean.RecordsBean recordsBean = (SearchContentBean.RecordsBean) this.mList.get(i);
|
||||
ImageView imageView = (ImageView) baseViewHolder.getView(R.id.img_play_background);
|
||||
ImageView imageView2 = (ImageView) baseViewHolder.getView(R.id.img_play);
|
||||
TextView textView = (TextView) baseViewHolder.getView(R.id.tv_label);
|
||||
TextView textView2 = (TextView) baseViewHolder.getView(R.id.tv_search_title);
|
||||
TextView textView3 = (TextView) baseViewHolder.getView(R.id.tv_search_content);
|
||||
if ("1".equals(recordsBean.getPostIcon())) {
|
||||
imageView2.setVisibility(8);
|
||||
} else {
|
||||
imageView2.setVisibility(0);
|
||||
}
|
||||
RequestBuilder<Drawable> a = Glide.e(this.mContext).a(recordsBean.getPostCoverUrl());
|
||||
a.a(new RequestOptions().a(R.drawable.community_img));
|
||||
a.a(imageView);
|
||||
a(recordsBean.getTitle(), recordsBean.getDescription(), textView2, textView3);
|
||||
if (recordsBean.getTags() == null || !this.a.contains(recordsBean.getTags())) {
|
||||
textView.setVisibility(8);
|
||||
} else {
|
||||
textView.setVisibility(0);
|
||||
textView.setText(recordsBean.getTags());
|
||||
}
|
||||
baseViewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.community.view.adapter.search.a
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
ContentAdapter.this.a(recordsBean, view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
}
|
@@ -0,0 +1,300 @@
|
||||
package com.ubt.jimu.community.view.adapter.search;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.ScaleAnimation;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.ubt.jimu.JimuApplication;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.Cache;
|
||||
import com.ubt.jimu.base.entities.Constant;
|
||||
import com.ubt.jimu.base.entities.DraftsListBean;
|
||||
import com.ubt.jimu.base.entities.PublishItemBean;
|
||||
import com.ubt.jimu.blockly.feature.audio.AudioParams;
|
||||
import com.ubt.jimu.utils.SPUtils;
|
||||
import com.ubt.jimu.utils.fileUpdataTool.VideoUtils;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DraftsListAdapter extends RecyclerView.Adapter<DraftsViewHolder> {
|
||||
private Context a;
|
||||
private DraftsListBean b;
|
||||
private FrameLayout d;
|
||||
private ImageView e;
|
||||
private DraftsItemOnClickLisenter g;
|
||||
private EmptyListLisenter h;
|
||||
private String i;
|
||||
private int j;
|
||||
private List<PublishItemBean> c = new ArrayList();
|
||||
private LinkedHashMap<String, Bitmap> f = new LinkedHashMap<>();
|
||||
|
||||
public interface DraftsItemOnClickLisenter {
|
||||
void b(int i, String str);
|
||||
}
|
||||
|
||||
public class DraftsViewHolder extends RecyclerView.ViewHolder {
|
||||
View a;
|
||||
ImageView b;
|
||||
ImageView c;
|
||||
ImageView d;
|
||||
View e;
|
||||
TextView f;
|
||||
TextView g;
|
||||
ImageView h;
|
||||
FrameLayout i;
|
||||
|
||||
public DraftsViewHolder(DraftsListAdapter draftsListAdapter, View view) {
|
||||
super(view);
|
||||
this.a = view;
|
||||
this.b = (ImageView) view.findViewById(R.id.im_draft_delete);
|
||||
this.c = (ImageView) view.findViewById(R.id.im_creativity_image);
|
||||
this.d = (ImageView) view.findViewById(R.id.im_creativity_video);
|
||||
this.e = view.findViewById(R.id.view_on_long_click);
|
||||
this.i = (FrameLayout) view.findViewById(R.id.fl_drafts_delete_layout);
|
||||
this.f = (TextView) view.findViewById(R.id.tv_creativity_title);
|
||||
this.g = (TextView) view.findViewById(R.id.tv_drafts_time);
|
||||
this.h = (ImageView) view.findViewById(R.id.tv_drafts_menu);
|
||||
}
|
||||
}
|
||||
|
||||
public interface EmptyListLisenter {
|
||||
void a(Boolean bool);
|
||||
}
|
||||
|
||||
public DraftsListAdapter(Context context, int i) {
|
||||
this.i = "MULTITERM_VIDEO_IMAGE";
|
||||
this.j = 5;
|
||||
this.a = context;
|
||||
this.j = i;
|
||||
if (i == -1 || i == 1) {
|
||||
this.i = "MULTITERM_IMAGE";
|
||||
} else {
|
||||
if (i != 2) {
|
||||
return;
|
||||
}
|
||||
this.i = "MULTITERM_VIDEO";
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
List<PublishItemBean> list = this.c;
|
||||
if (list == null) {
|
||||
return 0;
|
||||
}
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public DraftsViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
return new DraftsViewHolder(this, View.inflate(this.a, R.layout.item_drafts_layout, null));
|
||||
}
|
||||
|
||||
public void a(DraftsListBean draftsListBean) {
|
||||
if (draftsListBean == null) {
|
||||
return;
|
||||
}
|
||||
this.c.clear();
|
||||
this.b = draftsListBean;
|
||||
LinkedHashMap<String, PublishItemBean> linkedHashMap = draftsListBean.getLinkedHashMap();
|
||||
if (linkedHashMap.size() == 0) {
|
||||
return;
|
||||
}
|
||||
Iterator<PublishItemBean> it = linkedHashMap.values().iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
PublishItemBean next = it.next();
|
||||
int i = this.j;
|
||||
if (i == 5) {
|
||||
this.c.add(next);
|
||||
} else if (i == 1 || i == -1 || i == 2) {
|
||||
if (this.i.equals(next.getSelectAstrict())) {
|
||||
this.c.add(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PublishItemBean> list = this.c;
|
||||
a(list);
|
||||
this.c = list;
|
||||
EmptyListLisenter emptyListLisenter = this.h;
|
||||
if (emptyListLisenter != null) {
|
||||
emptyListLisenter.a(Boolean.valueOf(this.c.size() == 0));
|
||||
}
|
||||
a();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void onBindViewHolder(final DraftsViewHolder draftsViewHolder, final int i) {
|
||||
final PublishItemBean publishItemBean = this.c.get(i);
|
||||
String title = publishItemBean.getTitle();
|
||||
String localUrl = publishItemBean.getLocalUrl();
|
||||
final String singleKey = publishItemBean.getSingleKey();
|
||||
if (!TextUtils.isEmpty(localUrl)) {
|
||||
File file = new File(localUrl);
|
||||
if ((localUrl.endsWith(".png") || localUrl.endsWith(".jpg")) && file.exists()) {
|
||||
RequestBuilder<Drawable> a = Glide.e(JimuApplication.l()).a(file);
|
||||
a.a(new RequestOptions().b());
|
||||
a.a(draftsViewHolder.c);
|
||||
}
|
||||
if ((localUrl.endsWith(".mp4") || localUrl.endsWith(".MP4") || localUrl.endsWith(AudioParams.gpp) || localUrl.endsWith(".3GP")) && file.exists()) {
|
||||
draftsViewHolder.d.setVisibility(0);
|
||||
a(draftsViewHolder, localUrl);
|
||||
}
|
||||
}
|
||||
String a2 = com.ubt.jimu.utils.TextUtils.a(this.a, publishItemBean.getAlterTime());
|
||||
draftsViewHolder.f.setText(title);
|
||||
draftsViewHolder.g.setText(a2);
|
||||
draftsViewHolder.b.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.community.view.adapter.search.DraftsListAdapter.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
DraftsListAdapter.this.a(i, publishItemBean.getSingleKey());
|
||||
if (DraftsListAdapter.this.h != null) {
|
||||
DraftsListAdapter.this.h.a(Boolean.valueOf(DraftsListAdapter.this.c.size() == 0));
|
||||
}
|
||||
}
|
||||
});
|
||||
draftsViewHolder.e.setOnLongClickListener(new View.OnLongClickListener() { // from class: com.ubt.jimu.community.view.adapter.search.DraftsListAdapter.2
|
||||
@Override // android.view.View.OnLongClickListener
|
||||
public boolean onLongClick(View view) {
|
||||
DraftsListAdapter.this.a(draftsViewHolder);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
draftsViewHolder.e.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.community.view.adapter.search.DraftsListAdapter.3
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
if (DraftsListAdapter.this.g != null) {
|
||||
DraftsListAdapter.this.g.b(i, singleKey);
|
||||
}
|
||||
}
|
||||
});
|
||||
draftsViewHolder.i.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.community.view.adapter.search.DraftsListAdapter.4
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
DraftsListAdapter.this.a();
|
||||
}
|
||||
});
|
||||
draftsViewHolder.h.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.community.view.adapter.search.DraftsListAdapter.5
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
DraftsListAdapter.this.a(draftsViewHolder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void a() {
|
||||
FrameLayout frameLayout = this.d;
|
||||
if (frameLayout != null) {
|
||||
frameLayout.setVisibility(8);
|
||||
}
|
||||
ImageView imageView = this.e;
|
||||
if (imageView != null) {
|
||||
imageView.setVisibility(8);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(final DraftsViewHolder draftsViewHolder) {
|
||||
int measuredWidth = draftsViewHolder.a.getMeasuredWidth();
|
||||
Animator createCircularReveal = ViewAnimationUtils.createCircularReveal(draftsViewHolder.i, measuredWidth / 2, draftsViewHolder.a.getMeasuredHeight() / 2, 0.0f, measuredWidth);
|
||||
createCircularReveal.setDuration(500L);
|
||||
createCircularReveal.addListener(new Animator.AnimatorListener() { // from class: com.ubt.jimu.community.view.adapter.search.DraftsListAdapter.6
|
||||
@Override // android.animation.Animator.AnimatorListener
|
||||
public void onAnimationCancel(Animator animator) {
|
||||
}
|
||||
|
||||
@Override // android.animation.Animator.AnimatorListener
|
||||
public void onAnimationEnd(Animator animator) {
|
||||
DraftsListAdapter.this.d = draftsViewHolder.i;
|
||||
DraftsListAdapter.this.e = draftsViewHolder.b;
|
||||
draftsViewHolder.b.setVisibility(0);
|
||||
ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, 1, 0.5f, 1, 0.5f);
|
||||
scaleAnimation.setDuration(200L);
|
||||
draftsViewHolder.b.startAnimation(scaleAnimation);
|
||||
}
|
||||
|
||||
@Override // android.animation.Animator.AnimatorListener
|
||||
public void onAnimationRepeat(Animator animator) {
|
||||
}
|
||||
|
||||
@Override // android.animation.Animator.AnimatorListener
|
||||
public void onAnimationStart(Animator animator) {
|
||||
DraftsListAdapter.this.a();
|
||||
draftsViewHolder.i.setVisibility(0);
|
||||
}
|
||||
});
|
||||
createCircularReveal.start();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void a(int i, String str) {
|
||||
this.c.remove(i);
|
||||
notifyItemRemoved(i);
|
||||
notifyItemRangeChanged(0, this.c.size());
|
||||
this.b.getLinkedHashMap().remove(str);
|
||||
SPUtils.a(this.a, Constant.Publish.DRAFTS, Constant.Publish.DRAFTS_KEY + Cache.getInstance().getUserId(), this.b);
|
||||
}
|
||||
|
||||
private void a(final DraftsViewHolder draftsViewHolder, final String str) {
|
||||
Bitmap bitmap = this.f.get(str);
|
||||
if (bitmap != null) {
|
||||
draftsViewHolder.c.setImageBitmap(bitmap);
|
||||
} else {
|
||||
VideoUtils.a().b(str).subscribe(new Consumer<Bitmap>() { // from class: com.ubt.jimu.community.view.adapter.search.DraftsListAdapter.7
|
||||
@Override // io.reactivex.functions.Consumer
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public void accept(Bitmap bitmap2) throws Exception {
|
||||
if (draftsViewHolder.c.getTag() == null || draftsViewHolder.c.getTag().equals(str)) {
|
||||
draftsViewHolder.c.setImageBitmap(bitmap2);
|
||||
draftsViewHolder.c.setTag(str + "jimu");
|
||||
DraftsListAdapter.this.f.put(str, bitmap2);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static List<PublishItemBean> a(List<PublishItemBean> list) {
|
||||
Collections.sort(list, new Comparator<PublishItemBean>() { // from class: com.ubt.jimu.community.view.adapter.search.DraftsListAdapter.8
|
||||
@Override // java.util.Comparator
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compare(PublishItemBean publishItemBean, PublishItemBean publishItemBean2) {
|
||||
if (publishItemBean.getAlterTime() < publishItemBean2.getAlterTime()) {
|
||||
return 1;
|
||||
}
|
||||
return publishItemBean.getAlterTime() == publishItemBean2.getAlterTime() ? 0 : -1;
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
public void a(DraftsItemOnClickLisenter draftsItemOnClickLisenter) {
|
||||
this.g = draftsItemOnClickLisenter;
|
||||
}
|
||||
|
||||
public void a(EmptyListLisenter emptyListLisenter) {
|
||||
this.h = emptyListLisenter;
|
||||
}
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
package com.ubt.jimu.community.view.adapter.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import com.recyclelib.adapter.BaseRecyclerAdapter;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.cache.SharePreferenceHelper;
|
||||
import com.ubt.jimu.community.presenter.SearchPresenter;
|
||||
import com.ubt.jimu.community.view.fragment.RecommendFragment;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SearchRecommendAdapter extends BaseRecyclerAdapter<String> {
|
||||
private SearchPresenter a;
|
||||
private final SharePreferenceHelper b;
|
||||
private String c;
|
||||
private RecommendFragment d;
|
||||
|
||||
public SearchRecommendAdapter(Context context, RecommendFragment recommendFragment, String str, List<String> list, SearchPresenter searchPresenter) {
|
||||
super(context, list);
|
||||
this.a = searchPresenter;
|
||||
this.c = str;
|
||||
this.b = new SharePreferenceHelper();
|
||||
this.d = recommendFragment;
|
||||
}
|
||||
|
||||
public /* synthetic */ void a(String str, View view) {
|
||||
a(str);
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.adapter.BaseRecyclerAdapter, androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public int getItemCount() {
|
||||
if (!this.c.equals("history")) {
|
||||
return this.mList.size();
|
||||
}
|
||||
if (this.mList.size() > 6) {
|
||||
return 6;
|
||||
}
|
||||
return this.mList.size();
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.adapter.BaseRecyclerAdapter
|
||||
public int layoutId() {
|
||||
return R.layout.item_search_rd;
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
List list = (List) this.b.readObject(SharePreferenceHelper.SP_KEY_SEARCH_HISTORY);
|
||||
if (list == null) {
|
||||
list = new ArrayList();
|
||||
list.add(str);
|
||||
} else {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= list.size()) {
|
||||
break;
|
||||
}
|
||||
if (((String) list.get(i)).equals(str)) {
|
||||
list.remove(str);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
list.add(0, str);
|
||||
}
|
||||
this.b.saveObject(SharePreferenceHelper.SP_KEY_SEARCH_HISTORY, list);
|
||||
this.a.a(str);
|
||||
this.d.b();
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(BaseRecyclerAdapter.BaseViewHolder baseViewHolder, int i) {
|
||||
final String str = (String) this.mList.get(i);
|
||||
TextView textView = (TextView) baseViewHolder.getView(R.id.tv_recommend_content);
|
||||
textView.setText(str);
|
||||
baseViewHolder.itemView.setBackgroundResource(R.drawable.slt_search_item);
|
||||
baseViewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.community.view.adapter.search.b
|
||||
@Override // android.view.View.OnClickListener
|
||||
public final void onClick(View view) {
|
||||
SearchRecommendAdapter.this.a(str, view);
|
||||
}
|
||||
});
|
||||
if (!this.c.equals("history")) {
|
||||
textView.setGravity(17);
|
||||
} else {
|
||||
textView.setGravity(16);
|
||||
baseViewHolder.getView(R.id.xl_top).setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.ubt.jimu.community.view.adapter.search;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class TabAdapter<T extends Fragment> extends FragmentPagerAdapter {
|
||||
private List<T> a;
|
||||
|
||||
public TabAdapter(FragmentManager fragmentManager, List<T> list) {
|
||||
super(fragmentManager);
|
||||
this.a = list;
|
||||
}
|
||||
|
||||
@Override // androidx.viewpager.widget.PagerAdapter
|
||||
public int getCount() {
|
||||
return this.a.size();
|
||||
}
|
||||
|
||||
@Override // androidx.fragment.app.FragmentPagerAdapter
|
||||
public Fragment getItem(int i) {
|
||||
return this.a.get(i);
|
||||
}
|
||||
}
|
@@ -0,0 +1,72 @@
|
||||
package com.ubt.jimu.community.view.adapter.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.recyclelib.adapter.BaseRecyclerAdapter;
|
||||
import com.ubt.jimu.R;
|
||||
import com.ubt.jimu.base.entities.SearchUserBean;
|
||||
import com.ubt.jimu.user.view.UserCenterActivity;
|
||||
import com.ubt.jimu.utils.GlideCircleTransform;
|
||||
import com.ubt.jimu.utils.TextUtils;
|
||||
import com.ubtech.utils.StringUtils;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class UserAdapter extends BaseRecyclerAdapter<SearchUserBean.RecordsBean> {
|
||||
private String a;
|
||||
|
||||
public UserAdapter(Context context, List<SearchUserBean.RecordsBean> list) {
|
||||
super(context, list);
|
||||
new GlideCircleTransform(this.mContext);
|
||||
}
|
||||
|
||||
@Override // com.recyclelib.adapter.BaseRecyclerAdapter
|
||||
public int layoutId() {
|
||||
return R.layout.item_search_user;
|
||||
}
|
||||
|
||||
private void a(TextView textView, String str) {
|
||||
if (StringUtils.e(str)) {
|
||||
textView.setVisibility(8);
|
||||
return;
|
||||
}
|
||||
int indexOf = str.indexOf(this.a);
|
||||
textView.setVisibility(0);
|
||||
if (indexOf == -1) {
|
||||
textView.setText(str);
|
||||
} else {
|
||||
textView.setText(TextUtils.a(str, this.a, indexOf, this.mContext.getResources().getColor(R.color.bg_F8B220)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
||||
public void onBindViewHolder(BaseRecyclerAdapter.BaseViewHolder baseViewHolder, int i) {
|
||||
final SearchUserBean.RecordsBean recordsBean = (SearchUserBean.RecordsBean) this.mList.get(i);
|
||||
ImageView imageView = (ImageView) baseViewHolder.getView(R.id.img_user_icon);
|
||||
TextView textView = (TextView) baseViewHolder.getView(R.id.tv_user_title);
|
||||
TextView textView2 = (TextView) baseViewHolder.getView(R.id.tv_user_level);
|
||||
TextView textView3 = (TextView) baseViewHolder.getView(R.id.tv_user_desc);
|
||||
RequestBuilder<Drawable> a = Glide.e(this.mContext).a(recordsBean.getUserImage());
|
||||
a.a(RequestOptions.O().h());
|
||||
a.a(imageView);
|
||||
textView2.setText(String.format(this.mContext.getString(R.string.search_item_user_desc), Integer.valueOf(recordsBean.getLevel())));
|
||||
textView3.setText(recordsBean.getTitle());
|
||||
a(textView, recordsBean.getNickName());
|
||||
baseViewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.community.view.adapter.search.UserAdapter.1
|
||||
@Override // android.view.View.OnClickListener
|
||||
public void onClick(View view) {
|
||||
UserCenterActivity.a(((BaseRecyclerAdapter) UserAdapter.this).mContext, recordsBean.getUserId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.a = str;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user