Search in sources :

Example 1 with EmoticonPageSetEntity

use of sj.keyboard.data.EmoticonPageSetEntity in project XhsEmoticonsKeyboard by w446108264.

the class SimpleCommonUtils method addEmojiPageSetEntity.

/**
     * 插入emoji表情集
     *
     * @param pageSetAdapter
     * @param context
     * @param emoticonClickListener
     */
public static void addEmojiPageSetEntity(PageSetAdapter pageSetAdapter, Context context, final EmoticonClickListener emoticonClickListener) {
    ArrayList<EmojiBean> emojiArray = new ArrayList<>();
    Collections.addAll(emojiArray, DefEmoticons.sEmojiArray);
    EmoticonPageSetEntity emojiPageSetEntity = new EmoticonPageSetEntity.Builder().setLine(3).setRow(7).setEmoticonList(emojiArray).setIPageViewInstantiateItem(getDefaultEmoticonPageViewInstantiateItem(new EmoticonDisplayListener<Object>() {

        @Override
        public void onBindView(int position, ViewGroup parent, EmoticonsAdapter.ViewHolder viewHolder, Object object, final boolean isDelBtn) {
            final EmojiBean emojiBean = (EmojiBean) object;
            if (emojiBean == null && !isDelBtn) {
                return;
            }
            viewHolder.ly_root.setBackgroundResource(com.keyboard.view.R.drawable.bg_emoticon);
            if (isDelBtn) {
                viewHolder.iv_emoticon.setImageResource(R.mipmap.icon_del);
            } else {
                viewHolder.iv_emoticon.setImageResource(emojiBean.icon);
            }
            viewHolder.rootView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    if (emoticonClickListener != null) {
                        emoticonClickListener.onEmoticonClick(emojiBean, Constants.EMOTICON_CLICK_TEXT, isDelBtn);
                    }
                }
            });
        }
    })).setShowDelBtn(EmoticonPageEntity.DelBtnStatus.LAST).setIconUri(ImageBase.Scheme.DRAWABLE.toUri("icon_emoji")).build();
    pageSetAdapter.add(emojiPageSetEntity);
}
Also used : EmoticonsAdapter(sj.keyboard.adpater.EmoticonsAdapter) BigEmoticonsAdapter(com.xhsemoticonskeyboard.common.adapter.emoticonadapter.BigEmoticonsAdapter) TextEmoticonsAdapter(com.xhsemoticonskeyboard.common.adapter.emoticonadapter.TextEmoticonsAdapter) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) EmoticonPageSetEntity(sj.keyboard.data.EmoticonPageSetEntity) View(android.view.View) TextView(android.widget.TextView) SimpleAppsGridView(com.xhsemoticonskeyboard.common.widget.SimpleAppsGridView) EmoticonPageView(sj.keyboard.widget.EmoticonPageView) EmojiBean(com.sj.emoji.EmojiBean)

Example 2 with EmoticonPageSetEntity

use of sj.keyboard.data.EmoticonPageSetEntity in project XhsEmoticonsKeyboard by w446108264.

the class QqUtils method addQqPageSetEntity.

public static void addQqPageSetEntity(PageSetAdapter pageSetAdapter, Context context, final EmoticonClickListener emoticonClickListener) {
    EmoticonPageSetEntity kaomojiPageSetEntity = new EmoticonPageSetEntity.Builder().setLine(3).setRow(7).setEmoticonList(ParseDataUtils.ParseQqData(DefQqEmoticons.sQqEmoticonHashMap)).setIPageViewInstantiateItem(new PageViewInstantiateListener<EmoticonPageEntity>() {

        @Override
        public View instantiateItem(ViewGroup container, int position, EmoticonPageEntity pageEntity) {
            if (pageEntity.getRootView() == null) {
                EmoticonPageView pageView = new EmoticonPageView(container.getContext());
                pageView.setNumColumns(pageEntity.getRow());
                pageEntity.setRootView(pageView);
                try {
                    EmoticonsAdapter adapter = new EmoticonsAdapter(container.getContext(), pageEntity, emoticonClickListener);
                    adapter.setItemHeightMaxRatio(1.8);
                    adapter.setOnDisPlayListener(getEmoticonDisplayListener(emoticonClickListener));
                    pageView.getEmoticonsGridView().setAdapter(adapter);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return pageEntity.getRootView();
        }
    }).setShowDelBtn(EmoticonPageEntity.DelBtnStatus.LAST).setIconUri(ImageBase.Scheme.DRAWABLE.toUri("kys")).build();
    pageSetAdapter.add(kaomojiPageSetEntity);
}
Also used : EmoticonsAdapter(sj.keyboard.adpater.EmoticonsAdapter) EmoticonPageView(sj.keyboard.widget.EmoticonPageView) PageViewInstantiateListener(sj.keyboard.interfaces.PageViewInstantiateListener) ViewGroup(android.view.ViewGroup) EmoticonPageEntity(sj.keyboard.data.EmoticonPageEntity) EmoticonPageSetEntity(sj.keyboard.data.EmoticonPageSetEntity) IOException(java.io.IOException)

Example 3 with EmoticonPageSetEntity

use of sj.keyboard.data.EmoticonPageSetEntity in project XhsEmoticonsKeyboard by w446108264.

the class SimpleCommonUtils method addWechatPageSetEntity.

/**
     * 插入微信表情集
     *
     * @param pageSetAdapter
     * @param context
     * @param emoticonClickListener
     */
public static void addWechatPageSetEntity(PageSetAdapter pageSetAdapter, Context context, EmoticonClickListener emoticonClickListener) {
    String filePath = FileUtils.getFolderPath("wxemoticons");
    EmoticonPageSetEntity<EmoticonEntity> emoticonPageSetEntity = ParseDataUtils.parseDataFromFile(context, filePath, "wxemoticons.zip", "wxemoticons.xml");
    if (emoticonPageSetEntity == null) {
        return;
    }
    EmoticonPageSetEntity pageSetEntity = new EmoticonPageSetEntity.Builder().setLine(emoticonPageSetEntity.getLine()).setRow(emoticonPageSetEntity.getRow()).setEmoticonList(emoticonPageSetEntity.getEmoticonList()).setIPageViewInstantiateItem(getEmoticonPageViewInstantiateItem(BigEmoticonsAdapter.class, emoticonClickListener)).setIconUri(ImageBase.Scheme.FILE.toUri(filePath + "/" + emoticonPageSetEntity.getIconUri())).build();
    pageSetAdapter.add(pageSetEntity);
}
Also used : SpannableStringBuilder(android.text.SpannableStringBuilder) EmoticonEntity(sj.keyboard.data.EmoticonEntity) BigEmoticonsAdapter(com.xhsemoticonskeyboard.common.adapter.emoticonadapter.BigEmoticonsAdapter) EmoticonPageSetEntity(sj.keyboard.data.EmoticonPageSetEntity)

Example 4 with EmoticonPageSetEntity

use of sj.keyboard.data.EmoticonPageSetEntity in project XhsEmoticonsKeyboard by w446108264.

the class SimpleCommonUtils method addGoodGoodStudyPageSetEntity.

/**
     * 插入我们爱学习表情集
     *
     * @param pageSetAdapter
     * @param context
     * @param emoticonClickListener
     */
public static void addGoodGoodStudyPageSetEntity(PageSetAdapter pageSetAdapter, Context context, EmoticonClickListener emoticonClickListener) {
    String filePath = FileUtils.getFolderPath("goodgoodstudy");
    EmoticonPageSetEntity<EmoticonEntity> emoticonPageSetEntity = ParseDataUtils.parseDataFromFile(context, filePath, "goodgoodstudy.zip", "goodgoodstudy.xml");
    if (emoticonPageSetEntity == null) {
        return;
    }
    EmoticonPageSetEntity pageSetEntity = new EmoticonPageSetEntity.Builder().setLine(emoticonPageSetEntity.getLine()).setRow(emoticonPageSetEntity.getRow()).setEmoticonList(emoticonPageSetEntity.getEmoticonList()).setIPageViewInstantiateItem(getEmoticonPageViewInstantiateItem(BigEmoticonsAndTitleAdapter.class, emoticonClickListener)).setIconUri(ImageBase.Scheme.FILE.toUri(filePath + "/" + emoticonPageSetEntity.getIconUri())).build();
    pageSetAdapter.add(pageSetEntity);
}
Also used : BigEmoticonsAndTitleAdapter(com.xhsemoticonskeyboard.common.adapter.emoticonadapter.BigEmoticonsAndTitleAdapter) SpannableStringBuilder(android.text.SpannableStringBuilder) EmoticonEntity(sj.keyboard.data.EmoticonEntity) EmoticonPageSetEntity(sj.keyboard.data.EmoticonPageSetEntity)

Example 5 with EmoticonPageSetEntity

use of sj.keyboard.data.EmoticonPageSetEntity in project XhsEmoticonsKeyboard by w446108264.

the class SimpleCommonUtils method addXhsPageSetEntity.

/**
     * 插入xhs表情集
     *
     * @param pageSetAdapter
     * @param context
     * @param emoticonClickListener
     */
public static void addXhsPageSetEntity(PageSetAdapter pageSetAdapter, Context context, EmoticonClickListener emoticonClickListener) {
    EmoticonPageSetEntity xhsPageSetEntity = new EmoticonPageSetEntity.Builder().setLine(3).setRow(7).setEmoticonList(ParseDataUtils.ParseXhsData(DefXhsEmoticons.xhsEmoticonArray, ImageBase.Scheme.ASSETS)).setIPageViewInstantiateItem(getDefaultEmoticonPageViewInstantiateItem(getCommonEmoticonDisplayListener(emoticonClickListener, Constants.EMOTICON_CLICK_TEXT))).setShowDelBtn(EmoticonPageEntity.DelBtnStatus.LAST).setIconUri(ImageBase.Scheme.ASSETS.toUri("xhsemoji_19.png")).build();
    pageSetAdapter.add(xhsPageSetEntity);
}
Also used : EmoticonPageSetEntity(sj.keyboard.data.EmoticonPageSetEntity)

Aggregations

EmoticonPageSetEntity (sj.keyboard.data.EmoticonPageSetEntity)8 SpannableStringBuilder (android.text.SpannableStringBuilder)3 ViewGroup (android.view.ViewGroup)3 ArrayList (java.util.ArrayList)3 EmoticonsAdapter (sj.keyboard.adpater.EmoticonsAdapter)3 EmoticonEntity (sj.keyboard.data.EmoticonEntity)3 EmoticonPageEntity (sj.keyboard.data.EmoticonPageEntity)3 EmoticonPageView (sj.keyboard.widget.EmoticonPageView)3 View (android.view.View)2 EmojiBean (com.sj.emoji.EmojiBean)2 BigEmoticonsAdapter (com.xhsemoticonskeyboard.common.adapter.emoticonadapter.BigEmoticonsAdapter)2 TextEmoticonsAdapter (com.xhsemoticonskeyboard.common.adapter.emoticonadapter.TextEmoticonsAdapter)2 IOException (java.io.IOException)2 PageViewInstantiateListener (sj.keyboard.interfaces.PageViewInstantiateListener)2 Drawable (android.graphics.drawable.Drawable)1 Editable (android.text.Editable)1 Spannable (android.text.Spannable)1 KeyEvent (android.view.KeyEvent)1 EditText (android.widget.EditText)1 TextView (android.widget.TextView)1