110 lines
4.5 KiB
Java
110 lines
4.5 KiB
Java
package com.ubt.jimu.user.view.adapter;
|
|
|
|
import android.content.Context;
|
|
import android.text.TextUtils;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.TextView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.Unbinder;
|
|
import butterknife.internal.Utils;
|
|
import com.ubt.jimu.R;
|
|
import com.ubt.jimu.base.entities.NSLocale;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class CountryCodeAdapter extends RecyclerView.Adapter<CountryCodeViewHolder> {
|
|
private Context a;
|
|
private List<NSLocale> b;
|
|
private Callback c;
|
|
private String d;
|
|
|
|
public interface Callback {
|
|
void a(String str, String str2);
|
|
}
|
|
|
|
public class CountryCodeViewHolder extends RecyclerView.ViewHolder {
|
|
TextView codeTextView;
|
|
TextView countryTextView;
|
|
View didiverView;
|
|
|
|
public CountryCodeViewHolder(CountryCodeAdapter countryCodeAdapter, View view) {
|
|
super(view);
|
|
ButterKnife.a(this, view);
|
|
}
|
|
}
|
|
|
|
public class CountryCodeViewHolder_ViewBinding implements Unbinder {
|
|
private CountryCodeViewHolder b;
|
|
|
|
public CountryCodeViewHolder_ViewBinding(CountryCodeViewHolder countryCodeViewHolder, View view) {
|
|
this.b = countryCodeViewHolder;
|
|
countryCodeViewHolder.countryTextView = (TextView) Utils.b(view, R.id.countryTextView, "field 'countryTextView'", TextView.class);
|
|
countryCodeViewHolder.codeTextView = (TextView) Utils.b(view, R.id.codeTextView, "field 'codeTextView'", TextView.class);
|
|
countryCodeViewHolder.didiverView = Utils.a(view, R.id.divider, "field 'didiverView'");
|
|
}
|
|
|
|
@Override // butterknife.Unbinder
|
|
public void unbind() {
|
|
CountryCodeViewHolder countryCodeViewHolder = this.b;
|
|
if (countryCodeViewHolder == null) {
|
|
throw new IllegalStateException("Bindings already cleared.");
|
|
}
|
|
this.b = null;
|
|
countryCodeViewHolder.countryTextView = null;
|
|
countryCodeViewHolder.codeTextView = null;
|
|
countryCodeViewHolder.didiverView = null;
|
|
}
|
|
}
|
|
|
|
public CountryCodeAdapter(Context context, List<NSLocale> list, String str) {
|
|
this.a = context;
|
|
this.b = list;
|
|
this.d = str;
|
|
}
|
|
|
|
@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 CountryCodeViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
return new CountryCodeViewHolder(this, LayoutInflater.from(this.a).inflate(R.layout.recycler_item_country_code, viewGroup, false));
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public void onBindViewHolder(CountryCodeViewHolder countryCodeViewHolder, int i) {
|
|
final NSLocale nSLocale = this.b.get(i);
|
|
countryCodeViewHolder.countryTextView.setText(nSLocale.getName());
|
|
countryCodeViewHolder.codeTextView.setText(nSLocale.getDial_code());
|
|
countryCodeViewHolder.itemView.setOnClickListener(new View.OnClickListener() { // from class: com.ubt.jimu.user.view.adapter.CountryCodeAdapter.1
|
|
@Override // android.view.View.OnClickListener
|
|
public void onClick(View view) {
|
|
if (CountryCodeAdapter.this.c != null) {
|
|
CountryCodeAdapter.this.c.a(nSLocale.getDial_code(), nSLocale.getName());
|
|
}
|
|
}
|
|
});
|
|
if (i >= getItemCount() - 1) {
|
|
countryCodeViewHolder.didiverView.setVisibility(8);
|
|
} else {
|
|
countryCodeViewHolder.didiverView.setVisibility(0);
|
|
}
|
|
if (!TextUtils.isEmpty(this.d) && this.d.equals(nSLocale.getDial_code())) {
|
|
countryCodeViewHolder.countryTextView.setTextColor(this.a.getResources().getColor(R.color.theme_txt_light));
|
|
countryCodeViewHolder.codeTextView.setTextColor(this.a.getResources().getColor(R.color.theme_txt_light));
|
|
} else {
|
|
countryCodeViewHolder.countryTextView.setTextColor(this.a.getResources().getColor(R.color.theme_txt));
|
|
countryCodeViewHolder.codeTextView.setTextColor(this.a.getResources().getColor(R.color.theme_txt));
|
|
}
|
|
}
|
|
}
|