You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.4 KiB
Java
55 lines
1.4 KiB
Java
package com.rehome.zhdcoa.adapter;
|
|
|
|
import android.content.Context;
|
|
import android.view.LayoutInflater;
|
|
import android.view.ViewGroup;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import androidx.emoji.text.EmojiCompat;
|
|
import androidx.viewbinding.ViewBinding;
|
|
|
|
import com.rehome.zhdcoa.base.BaseViewBindingAdapter;
|
|
import com.rehome.zhdcoa.bean.GridViewBean;
|
|
import com.rehome.zhdcoa.databinding.AdapterEmojiBinding;
|
|
|
|
import java.util.List;
|
|
|
|
public class EmojiAdapter extends BaseViewBindingAdapter<AdapterEmojiBinding> {
|
|
|
|
private final Context context;
|
|
private final List<String> data;
|
|
|
|
public EmojiAdapter(Context context,List<String> datas) {
|
|
super(context);
|
|
this.context=context;
|
|
this.data=datas;
|
|
}
|
|
|
|
@Override
|
|
protected void handleData(int position, @NonNull AdapterEmojiBinding binding) {
|
|
String item = data.get(position);
|
|
CharSequence character = EmojiCompat.get().process(item);
|
|
binding.tv.setText(character);
|
|
}
|
|
|
|
@Override
|
|
protected AdapterEmojiBinding getBinding(@NonNull LayoutInflater inflater, ViewGroup parent) {
|
|
return AdapterEmojiBinding.inflate(inflater, parent, false);
|
|
}
|
|
|
|
@Override
|
|
public int getCount() {
|
|
return data.size();
|
|
}
|
|
|
|
@Override
|
|
public Object getItem(int position) {
|
|
return data.get(position);
|
|
}
|
|
|
|
@Override
|
|
public long getItemId(int position) {
|
|
return Long.valueOf(position);
|
|
}
|
|
}
|