72 lines
2.7 KiB
Java
72 lines
2.7 KiB
Java
package com.ubt.jimu.controller.adapter;
|
|
|
|
import android.app.Activity;
|
|
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 com.ubt.jimu.R;
|
|
import com.ubt.jimu.controller.data.bean.AddDirectionItemBean;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class AddDirectionViewAdapter extends RecyclerView.Adapter<AddDirectionHolder> {
|
|
private List<AddDirectionItemBean> a;
|
|
private OnItemClickListener b;
|
|
|
|
class AddDirectionHolder extends RecyclerView.ViewHolder {
|
|
private ImageView a;
|
|
private TextView b;
|
|
|
|
public AddDirectionHolder(AddDirectionViewAdapter addDirectionViewAdapter, View view) {
|
|
super(view);
|
|
this.a = (ImageView) view.findViewById(R.id.im_add_wheel);
|
|
this.b = (TextView) view.findViewById(R.id.txt_name);
|
|
}
|
|
}
|
|
|
|
public interface OnItemClickListener {
|
|
void a(AddDirectionItemBean addDirectionItemBean, int i);
|
|
}
|
|
|
|
public AddDirectionViewAdapter(Activity activity, List<AddDirectionItemBean> list) {
|
|
this.a = list;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemCount() {
|
|
List<AddDirectionItemBean> list = this.a;
|
|
if (list == null) {
|
|
return 0;
|
|
}
|
|
return list.size();
|
|
}
|
|
|
|
public void a(OnItemClickListener onItemClickListener) {
|
|
this.b = onItemClickListener;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public AddDirectionHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
return new AddDirectionHolder(this, LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_add_direction, viewGroup, false));
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onBindViewHolder(AddDirectionHolder addDirectionHolder, final int i) {
|
|
final AddDirectionItemBean addDirectionItemBean = this.a.get(i);
|
|
addDirectionHolder.a.setBackgroundResource(addDirectionItemBean.a());
|
|
addDirectionHolder.b.setText(addDirectionItemBean.b());
|
|
addDirectionHolder.a.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.controller.adapter.AddDirectionViewAdapter.1
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (AddDirectionViewAdapter.this.b != null) {
|
|
AddDirectionViewAdapter.this.b.a(addDirectionItemBean, i);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|