131 lines
5.4 KiB
Java
131 lines
5.4 KiB
Java
package com.ubt.jimu.user.view.adapter;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.text.TextUtils;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.Unbinder;
|
|
import butterknife.internal.Utils;
|
|
import com.bumptech.glide.Glide;
|
|
import com.bumptech.glide.RequestBuilder;
|
|
import com.bumptech.glide.request.RequestOptions;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.base.cache.Cache;
|
|
import com.ubt.jimu.base.entities.Fans;
|
|
import com.ubtech.utils.DensityUtils;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class FansAdapter extends RecyclerView.Adapter<FansViewHolder> {
|
|
private final int a;
|
|
private Context b;
|
|
private List<Fans> c;
|
|
private Callback d;
|
|
private long e = Cache.getInstance().getLoginUserIntId();
|
|
|
|
public interface Callback {
|
|
void a(int i);
|
|
|
|
void a(Fans fans, int i);
|
|
}
|
|
|
|
class FansViewHolder extends RecyclerView.ViewHolder {
|
|
ImageView actionImageView;
|
|
TextView levelTextView;
|
|
TextView nameTextView;
|
|
TextView titleKeyTextView;
|
|
ImageView userImageView;
|
|
|
|
public FansViewHolder(FansAdapter fansAdapter, View view) {
|
|
super(view);
|
|
ButterKnife.a(this, view);
|
|
}
|
|
}
|
|
|
|
public class FansViewHolder_ViewBinding implements Unbinder {
|
|
private FansViewHolder b;
|
|
|
|
public FansViewHolder_ViewBinding(FansViewHolder fansViewHolder, View view) {
|
|
this.b = fansViewHolder;
|
|
fansViewHolder.titleKeyTextView = (TextView) Utils.b(view, R.id.titleKeyTextView, "field 'titleKeyTextView'", TextView.class);
|
|
fansViewHolder.levelTextView = (TextView) Utils.b(view, R.id.levelTextView, "field 'levelTextView'", TextView.class);
|
|
fansViewHolder.nameTextView = (TextView) Utils.b(view, R.id.nameTextView, "field 'nameTextView'", TextView.class);
|
|
fansViewHolder.actionImageView = (ImageView) Utils.b(view, R.id.actionImageView, "field 'actionImageView'", ImageView.class);
|
|
fansViewHolder.userImageView = (ImageView) Utils.b(view, R.id.userImageView, "field 'userImageView'", ImageView.class);
|
|
}
|
|
|
|
@Override // butterknife.Unbinder
|
|
public void unbind() {
|
|
FansViewHolder fansViewHolder = this.b;
|
|
if (fansViewHolder == null) {
|
|
throw new IllegalStateException("Bindings already cleared.");
|
|
}
|
|
this.b = null;
|
|
fansViewHolder.titleKeyTextView = null;
|
|
fansViewHolder.levelTextView = null;
|
|
fansViewHolder.nameTextView = null;
|
|
fansViewHolder.actionImageView = null;
|
|
fansViewHolder.userImageView = null;
|
|
}
|
|
}
|
|
|
|
public FansAdapter(Context context, List<Fans> list) {
|
|
this.b = context;
|
|
this.c = list;
|
|
this.a = (int) DensityUtils.a(context, 50);
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemCount() {
|
|
return this.c.size();
|
|
}
|
|
|
|
public void a(Callback callback) {
|
|
this.d = callback;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public FansViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
return new FansViewHolder(this, LayoutInflater.from(this.b).inflate(R.layout.recycler_item_fans, viewGroup, false));
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onBindViewHolder(FansViewHolder fansViewHolder, final int i) {
|
|
final Fans fans = this.c.get(i);
|
|
fansViewHolder.nameTextView.setText(fans.getNickName());
|
|
fansViewHolder.levelTextView.setText(String.format(this.b.getString(R.string.search_item_user_desc), Integer.valueOf(fans.getLevel())));
|
|
boolean z = fans.getIsSubscribed() == 1;
|
|
fansViewHolder.actionImageView.setVisibility(this.e == fans.getUserId() ? 8 : 0);
|
|
fansViewHolder.actionImageView.setImageResource(z ? R.mipmap.ic_interest : R.mipmap.ic_have_not_interest);
|
|
fansViewHolder.titleKeyTextView.setText(TextUtils.isEmpty(fans.getTitle()) ? "" : fans.getTitle());
|
|
fansViewHolder.userImageView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.adapter.FansAdapter.1
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (FansAdapter.this.d != null) {
|
|
FansAdapter.this.d.a(i);
|
|
}
|
|
}
|
|
});
|
|
fansViewHolder.actionImageView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.adapter.FansAdapter.2
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (FansAdapter.this.d != null) {
|
|
FansAdapter.this.d.a(fans, i);
|
|
}
|
|
}
|
|
});
|
|
RequestBuilder<Drawable> a = Glide.e(this.b).a(fans.getUserImage());
|
|
RequestOptions b = RequestOptions.O().h().a(R.drawable.community_img_official).b(R.drawable.community_img_official);
|
|
int i2 = this.a;
|
|
a.a(b.a(i2, i2));
|
|
a.a(fansViewHolder.userImageView);
|
|
}
|
|
}
|