parent
1cdd0e3145
commit
9af8f716b9
@ -0,0 +1,54 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.activity.EmojiActivity">
|
||||
|
||||
<include
|
||||
android:id="@+id/toolbarView"
|
||||
layout="@layout/layout_base" />
|
||||
|
||||
<GridView
|
||||
android:id="@+id/gv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="12dp"
|
||||
android:horizontalSpacing="12dp"
|
||||
android:listSelector="@null"
|
||||
android:numColumns="4"
|
||||
android:scrollbars="none"
|
||||
android:stretchMode="columnWidth"
|
||||
android:verticalSpacing="12dp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="80dp"
|
||||
android:background="#00000000"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="30sp"
|
||||
android:text="" />
|
||||
|
||||
</LinearLayout>
|
||||
Loading…
Reference in New Issue