| | |
| | | import androidx.recyclerview.widget.RecyclerView; |
| | | |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.ui.adapter.LanguageAdapter; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class ListDialogAdapter extends RecyclerView.Adapter<ListDialogAdapter.MyViewHolder> { |
| | | |
| | | |
| | | private List<ListDialogAdapter.DialogItemData> mList; |
| | | private List<LanguageAdapter.ItemData> mList; |
| | | private final Context mContext; |
| | | private ListDialogAdapter.OnclickListener itemOnclickListener;//点击了的监听器 |
| | | |
| | | public ListDialogAdapter(List<ListDialogAdapter.DialogItemData> list, Context context) { |
| | | public ListDialogAdapter(List<LanguageAdapter.ItemData> list, Context context) { |
| | | |
| | | this.mList = list; |
| | | this.mContext = context; |
| | |
| | | |
| | | @Override |
| | | public void onBindViewHolder(@NonNull ListDialogAdapter.MyViewHolder holder, int position) { |
| | | ListDialogAdapter.DialogItemData itemData = this.mList.get(position); |
| | | LanguageAdapter.ItemData itemData = this.mList.get(position); |
| | | holder.list_item_title_tv.setText(itemData.getTitle()); |
| | | holder.list_item_title_tv.setTextColor(mContext.getColor(R.color.text_50FFFFFF)); |
| | | holder.list_item_title_tv.setTextColor(mContext.getColor(R.color.text_FF5B5B5B)); |
| | | if (itemData.isState()) { |
| | | holder.list_item_title_tv.setTextColor(mContext.getColor(R.color.text_FFFFFFFF)); |
| | | holder.list_item_title_tv.setTextColor(mContext.getColor(R.color.text_FFACACAC)); |
| | | } |
| | | if (position == this.mList.size() - 1) { |
| | | holder.list_item_line_v.setVisibility(View.GONE); |
| | |
| | | } |
| | | |
| | | |
| | | public void setList(List<ListDialogAdapter.DialogItemData> list) { |
| | | public void setList(List<LanguageAdapter.ItemData> list) { |
| | | this.mList = list; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | public interface OnclickListener { |
| | | void onClick(int position, ListDialogAdapter.DialogItemData itemData); |
| | | void onClick(int position, LanguageAdapter.ItemData itemData); |
| | | } |
| | | |
| | | public static class DialogItemData { |
| | | |
| | | private String title; |
| | | private boolean state; |
| | | //app当前语言 |
| | | private String language = UserConfigManage.getInstance().getCurrentAppLanguage(); |
| | | |
| | | public String getLanguage() { |
| | | return language; |
| | | } |
| | | |
| | | public void setLanguage(String language) { |
| | | this.language = language; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title == null ? "" : title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public boolean isState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(boolean state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |