use of me.yluo.ruisiapp.adapter.SmileyAdapter in project Ruisi by freedom10086.
the class MySmileyPicker method init.
private void init() {
View v = LayoutInflater.from(mContext).inflate(R.layout.my_smiley_view, null);
TabLayout tab = v.findViewById(R.id.mytab);
RecyclerView recyclerView = v.findViewById(R.id.recyclerView);
getSmileys();
tab.addTab(tab.newTab().setText("贴吧"));
tab.addTab(tab.newTab().setText("金馆长"));
tab.addTab(tab.newTab().setText("AC娘"));
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(mContext, 7, LinearLayoutManager.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
adapter = new SmileyAdapter(mContext, (v1, position) -> {
ImageView img = (ImageView) v1;
smileyClick(img.getDrawable(), position);
dismiss();
}, smileys);
tab.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
changeSmiley(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
recyclerView.setAdapter(adapter);
setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
setBackgroundDrawable(ContextCompat.getDrawable(mContext, R.drawable.rec_solid_primary_bg));
setFocusable(true);
setContentView(v);
}
Aggregations