@SuppressLint("InflateParams") @Override public View getView(int position, View convertView, ViewGroup container) { ViewHolder vh = null; if (convertView == null) { convertView = infalter.inflate(R.layout.view_pager_emoji, null); vh = new ViewHolder(convertView); convertView.setTag(vh); } else { vh = (ViewHolder) convertView.getTag(); } final EmojiAdapter adapter = new EmojiAdapter(container.getContext(), mPagers.get(position), mEmojiHeight); vh.gv.setAdapter(adapter); vh.gv.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (mListener == null) return; /*if (position == adapter.getCount() - 1) { mListener.onDelete(); } else {*/ mListener.onEmojiClick((Emojicon) adapter.getItem(position)); // } } }); adapter.notifyDataSetChanged(); return convertView; }
@Override public void addRecentEmoji(Context context, Emojicon emojicon) { EmojiconRecentsManager recents = EmojiconRecentsManager.getInstance(context); recents.push(emojicon); // notify dataset changed if (mAdapter != null) mAdapter.notifyDataSetChanged(); }
public EmojiconRecentsGridView( Context context, Emojicon[] emojicons, EmojiconRecents recents, EmojiconsPopup emojiconsPopup) { super(context, emojicons, recents, emojiconsPopup); EmojiconRecentsManager recents1 = EmojiconRecentsManager.getInstance(rootView.getContext()); mAdapter = new EmojiAdapter(rootView.getContext(), recents1); mAdapter.setEmojiClickListener( new OnEmojiconClickedListener() { @Override public void onEmojiconClicked(Emojicon emojicon) { if (mEmojiconPopup.onEmojiconClickedListener != null) { mEmojiconPopup.onEmojiconClickedListener.onEmojiconClicked(emojicon); } } }); GridView gridView = (GridView) rootView.findViewById(R.id.Emoji_GridView); gridView.setAdapter(mAdapter); }