Search in sources :

Example 1 with Emojicon

use of org.kymjs.emoji.model.Emojicon in project KJFrameForAndroid by kymjs.

the class EmojiPageFragment method initData.

private void initData(int index, int type) {
    datas = new ArrayList<Emojicon>();
    if (KJEmojiFragment.EMOJI_TAB_CONTENT > 1) {
        datas = DisplayRules.getAllByType(type);
    } else {
        List<Emojicon> dataAll = DisplayRules.getAllByType(type);
        int max = Math.min((index + 1) * KJEmojiConfig.COUNT_IN_PAGE, dataAll.size());
        for (int i = index * KJEmojiConfig.COUNT_IN_PAGE; i < max; i++) {
            datas.add(dataAll.get(i));
        }
        datas.add(new Emojicon(KJEmojiConfig.DELETE_EMOJI_ID, 1, "delete:"));
    }
}
Also used : Emojicon(org.kymjs.emoji.model.Emojicon)

Example 2 with Emojicon

use of org.kymjs.emoji.model.Emojicon in project KJFrameForAndroid by kymjs.

the class EmojiPageFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    sGrid = new GridView(getActivity());
    sGrid.setNumColumns(KJEmojiConfig.COLUMNS);
    adapter = new EmojiGridAdapter(getActivity(), datas);
    sGrid.setAdapter(adapter);
    sGrid.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            EditText editText = (EditText) getActivity().findViewById(R.id.emoji_titile_input);
            if (position + 1 != datas.size()) {
                InputHelper.input(editText, (Emojicon) parent.getAdapter().getItem(position));
            } else {
                InputHelper.backspace(editText);
            }
        }
    });
    sGrid.setSelector(new ColorDrawable(Color.TRANSPARENT));
    return sGrid;
}
Also used : EmojiGridAdapter(org.kymjs.emoji.adapter.EmojiGridAdapter) EditText(android.widget.EditText) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) ColorDrawable(android.graphics.drawable.ColorDrawable) Emojicon(org.kymjs.emoji.model.Emojicon) GridView(android.widget.GridView) GridView(android.widget.GridView) View(android.view.View) AdapterView(android.widget.AdapterView)

Aggregations

Emojicon (org.kymjs.emoji.model.Emojicon)2 ColorDrawable (android.graphics.drawable.ColorDrawable)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)1 EditText (android.widget.EditText)1 GridView (android.widget.GridView)1 EmojiGridAdapter (org.kymjs.emoji.adapter.EmojiGridAdapter)1