153 lines
5.6 KiB
Java
153 lines
5.6 KiB
Java
package com.ubt.jimu.user.feedback;
|
|
|
|
import android.content.Context;
|
|
import android.text.TextUtils;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import com.bumptech.glide.Glide;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.user.feedback.FeedBackIconAdapter;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class FeedBackIconAdapter extends RecyclerView.Adapter<IconViewHolder> {
|
|
private Context a;
|
|
private ArrayList<FeedBackIconBean> b = new ArrayList<>();
|
|
private IFBOperateImg c;
|
|
|
|
public FeedBackIconAdapter(Context context) {
|
|
this.a = context;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemCount() {
|
|
ArrayList<FeedBackIconBean> arrayList = this.b;
|
|
if (arrayList == null) {
|
|
return 0;
|
|
}
|
|
return arrayList.size();
|
|
}
|
|
|
|
public void a(IFBOperateImg iFBOperateImg) {
|
|
this.c = iFBOperateImg;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public IconViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
return new IconViewHolder(LayoutInflater.from(this.a).inflate(R.layout.recycler_feedback_icon_item, viewGroup, false));
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onBindViewHolder(IconViewHolder iconViewHolder, int i) {
|
|
FeedBackIconBean feedBackIconBean = this.b.get(i);
|
|
if (feedBackIconBean != null) {
|
|
iconViewHolder.a(feedBackIconBean, i);
|
|
}
|
|
}
|
|
|
|
private FeedBackIconBean a() {
|
|
return new FeedBackIconBean(true, "", 0, "");
|
|
}
|
|
|
|
public void a(List<FeedBackIconBean> list) {
|
|
this.b.clear();
|
|
if (list != null && list.size() != 0) {
|
|
if (6 > list.size()) {
|
|
this.b.addAll(list);
|
|
this.b.add(a());
|
|
} else {
|
|
this.b.addAll(list);
|
|
}
|
|
} else {
|
|
this.b.add(a());
|
|
}
|
|
notifyDataSetChanged();
|
|
}
|
|
|
|
class IconViewHolder extends RecyclerView.ViewHolder {
|
|
private ImageView a;
|
|
private ImageView b;
|
|
private ImageView c;
|
|
private ImageView d;
|
|
|
|
public IconViewHolder(View view) {
|
|
super(view);
|
|
this.a = (ImageView) view.findViewById(R.id.icon);
|
|
this.b = (ImageView) view.findViewById(R.id.delete_icon);
|
|
this.c = (ImageView) view.findViewById(R.id.add_icon);
|
|
this.d = (ImageView) view.findViewById(R.id.play);
|
|
}
|
|
|
|
public void a(final FeedBackIconBean feedBackIconBean, final int i) {
|
|
if (feedBackIconBean.isAddFlag()) {
|
|
this.c.setVisibility(0);
|
|
this.b.setVisibility(8);
|
|
this.d.setVisibility(8);
|
|
this.a.setVisibility(8);
|
|
this.c.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.feedback.d
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
FeedBackIconAdapter.IconViewHolder.this.a(view);
|
|
}
|
|
});
|
|
return;
|
|
}
|
|
this.c.setVisibility(8);
|
|
this.b.setVisibility(0);
|
|
this.a.setVisibility(0);
|
|
this.d.setVisibility(feedBackIconBean.getmType() == 0 ? 8 : 0);
|
|
if (!TextUtils.isEmpty(feedBackIconBean.getPath())) {
|
|
Glide.e(FeedBackIconAdapter.this.a).a(feedBackIconBean.getPath()).a(this.a);
|
|
}
|
|
this.b.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.feedback.c
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
FeedBackIconAdapter.IconViewHolder.this.a(i, view);
|
|
}
|
|
});
|
|
this.d.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.feedback.b
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
FeedBackIconAdapter.IconViewHolder.this.a(feedBackIconBean, view);
|
|
}
|
|
});
|
|
this.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.feedback.a
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
FeedBackIconAdapter.IconViewHolder.this.b(feedBackIconBean, view);
|
|
}
|
|
});
|
|
}
|
|
|
|
public /* synthetic */ void b(FeedBackIconBean feedBackIconBean, View view) {
|
|
if (FeedBackIconAdapter.this.c == null || feedBackIconBean.getmType() != 0) {
|
|
return;
|
|
}
|
|
FeedBackIconAdapter.this.c.b(feedBackIconBean);
|
|
}
|
|
|
|
public /* synthetic */ void a(View view) {
|
|
if (FeedBackIconAdapter.this.c != null) {
|
|
FeedBackIconAdapter.this.c.a();
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ void a(int i, View view) {
|
|
if (FeedBackIconAdapter.this.c != null) {
|
|
FeedBackIconAdapter.this.c.a(i);
|
|
}
|
|
}
|
|
|
|
public /* synthetic */ void a(FeedBackIconBean feedBackIconBean, View view) {
|
|
if (FeedBackIconAdapter.this.c != null) {
|
|
FeedBackIconAdapter.this.c.a(feedBackIconBean);
|
|
}
|
|
}
|
|
}
|
|
}
|