142 lines
6.2 KiB
Java
142 lines
6.2 KiB
Java
package com.ubt.jimu.user.view.adapter;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.RelativeLayout;
|
|
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.Rank;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class RankAdapter extends RecyclerView.Adapter<RankViewHolder> {
|
|
private Context a;
|
|
private List<Rank> b;
|
|
private Callback c;
|
|
private long d = Cache.getInstance().getLoginUserIntId();
|
|
|
|
public interface Callback {
|
|
void a(long j);
|
|
|
|
void a(Rank rank, int i);
|
|
}
|
|
|
|
public class RankViewHolder extends RecyclerView.ViewHolder {
|
|
ImageView actionImageView;
|
|
TextView levelTextView;
|
|
TextView nameTextView;
|
|
TextView rankNumTextView;
|
|
RelativeLayout rankRootView;
|
|
TextView titleKeyTextView;
|
|
ImageView userImageView;
|
|
|
|
public RankViewHolder(RankAdapter rankAdapter, View view) {
|
|
super(view);
|
|
ButterKnife.a(this, view);
|
|
}
|
|
}
|
|
|
|
public class RankViewHolder_ViewBinding implements Unbinder {
|
|
private RankViewHolder b;
|
|
|
|
public RankViewHolder_ViewBinding(RankViewHolder rankViewHolder, View view) {
|
|
this.b = rankViewHolder;
|
|
rankViewHolder.rankNumTextView = (TextView) Utils.b(view, R.id.rankNumTextView, "field 'rankNumTextView'", TextView.class);
|
|
rankViewHolder.nameTextView = (TextView) Utils.b(view, R.id.nameTextView, "field 'nameTextView'", TextView.class);
|
|
rankViewHolder.titleKeyTextView = (TextView) Utils.b(view, R.id.titleKeyTextView, "field 'titleKeyTextView'", TextView.class);
|
|
rankViewHolder.userImageView = (ImageView) Utils.b(view, R.id.userImageView, "field 'userImageView'", ImageView.class);
|
|
rankViewHolder.actionImageView = (ImageView) Utils.b(view, R.id.actionImageView, "field 'actionImageView'", ImageView.class);
|
|
rankViewHolder.rankRootView = (RelativeLayout) Utils.b(view, R.id.rankRootView, "field 'rankRootView'", RelativeLayout.class);
|
|
rankViewHolder.levelTextView = (TextView) Utils.b(view, R.id.levelTextView, "field 'levelTextView'", TextView.class);
|
|
}
|
|
|
|
@Override // butterknife.Unbinder
|
|
public void unbind() {
|
|
RankViewHolder rankViewHolder = this.b;
|
|
if (rankViewHolder == null) {
|
|
throw new IllegalStateException("Bindings already cleared.");
|
|
}
|
|
this.b = null;
|
|
rankViewHolder.rankNumTextView = null;
|
|
rankViewHolder.nameTextView = null;
|
|
rankViewHolder.titleKeyTextView = null;
|
|
rankViewHolder.userImageView = null;
|
|
rankViewHolder.actionImageView = null;
|
|
rankViewHolder.rankRootView = null;
|
|
rankViewHolder.levelTextView = null;
|
|
}
|
|
}
|
|
|
|
public RankAdapter(Context context, List<Rank> list) {
|
|
this.a = context;
|
|
this.b = list;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemCount() {
|
|
return this.b.size();
|
|
}
|
|
|
|
public void a(Callback callback) {
|
|
this.c = callback;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public RankViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
return new RankViewHolder(this, LayoutInflater.from(this.a).inflate(R.layout.recycler_item_rank, viewGroup, false));
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onBindViewHolder(RankViewHolder rankViewHolder, final int i) {
|
|
final Rank rank = this.b.get(i);
|
|
int i2 = i + 1;
|
|
if (i2 == 1) {
|
|
rankViewHolder.rankNumTextView.setBackgroundResource(R.drawable.rank_first_oval_background);
|
|
} else if (i2 == 2) {
|
|
rankViewHolder.rankNumTextView.setBackgroundResource(R.drawable.rank_second_oval_background);
|
|
} else if (i2 != 3) {
|
|
rankViewHolder.rankNumTextView.setBackgroundResource(R.drawable.rank_fourth_oval_background);
|
|
} else {
|
|
rankViewHolder.rankNumTextView.setBackgroundResource(R.drawable.rank_third_oval_background);
|
|
}
|
|
rankViewHolder.actionImageView.setVisibility(this.d == rank.getUserId() ? 8 : 0);
|
|
rankViewHolder.rankNumTextView.setText(String.valueOf(i2));
|
|
rankViewHolder.nameTextView.setText(rank.getNickName());
|
|
rankViewHolder.titleKeyTextView.setText(rank.getTitle());
|
|
rankViewHolder.levelTextView.setText(String.format(this.a.getString(R.string.search_item_user_desc), Integer.valueOf(rank.getLevel())));
|
|
rankViewHolder.actionImageView.setImageResource(rank.getIsSubscribed() == 1 ? R.mipmap.ic_interest : R.mipmap.ic_have_not_interest);
|
|
rankViewHolder.actionImageView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.adapter.RankAdapter.1
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (RankAdapter.this.c != null) {
|
|
RankAdapter.this.c.a(rank, i);
|
|
}
|
|
}
|
|
});
|
|
rankViewHolder.userImageView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.adapter.RankAdapter.2
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (RankAdapter.this.c != null) {
|
|
RankAdapter.this.c.a(rank.getUserId());
|
|
}
|
|
}
|
|
});
|
|
RequestBuilder<Drawable> a = Glide.e(this.a).a(rank.getUserImage());
|
|
a.a(RequestOptions.O().b(R.drawable.tab_base_user_default).a(R.drawable.tab_base_user_default));
|
|
a.a(rankViewHolder.userImageView);
|
|
}
|
|
}
|