Search in sources :

Example 1 with EmojiView

use of net.iGap.libs.emojiKeyboard.EmojiView in project iGap-Android by KianIranian-STDG.

the class FragmentEditImage method createEmojiView.

private void createEmojiView() {
    if (emojiView == null) {
        emojiView = new EmojiView(rootView.getContext(), false, true);
        emojiView.setVisibility(View.GONE);
        emojiView.setContentView(EmojiView.EMOJI);
        emojiView.setListener(new EmojiView.Listener() {

            @Override
            public void onBackSpace() {
                if (edtChat.length() == 0) {
                    return;
                }
                edtChat.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
            }

            @Override
            public void onStickerClick(StructIGSticker structIGSticker) {
            }

            @Override
            public void onStickerSettingClick() {
            }

            @Override
            public void onAddStickerClicked() {
            }

            @Override
            public void onEmojiSelected(String unicode) {
                int i = edtChat.getSelectionEnd();
                if (i < 0)
                    i = 0;
                try {
                    CharSequence sequence = EmojiManager.getInstance().replaceEmoji(unicode, edtChat.getPaint().getFontMetricsInt(), LayoutCreator.dp(22), false);
                    if (edtChat.getText() != null)
                        edtChat.setText(edtChat.getText().insert(i, sequence));
                    int j = i + sequence.length();
                    edtChat.setSelection(j, j);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    keyboardContainer.addView(emojiView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM));
}
Also used : KeyEvent(android.view.KeyEvent) StructIGSticker(net.iGap.fragments.emoji.struct.StructIGSticker) EmojiView(net.iGap.libs.emojiKeyboard.EmojiView)

Example 2 with EmojiView

use of net.iGap.libs.emojiKeyboard.EmojiView in project iGap-Android by KianIranian-STDG.

the class PhotoViewer method createEmojiView.

private void createEmojiView() {
    if (emojiView == null) {
        emojiView = new EmojiView(context, false, true);
        emojiView.setVisibility(View.GONE);
        emojiView.setContentView(EmojiView.EMOJI);
        emojiView.setListener(new EmojiView.Listener() {

            @Override
            public void onBackSpace() {
                if (captionEditText.length() == 0) {
                    return;
                }
                captionEditText.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
            }

            @Override
            public void onStickerClick(StructIGSticker structIGSticker) {
            }

            @Override
            public void onStickerSettingClick() {
            }

            @Override
            public void onAddStickerClicked() {
            }

            @Override
            public void onEmojiSelected(String unicode) {
                int i = captionEditText.getSelectionEnd();
                if (i < 0)
                    i = 0;
                try {
                    CharSequence sequence = EmojiManager.getInstance().replaceEmoji(unicode, captionEditText.getPaint().getFontMetricsInt(), LayoutCreator.dp(22), false);
                    if (captionEditText.getText() != null)
                        captionEditText.setText(captionEditText.getText().insert(i, sequence));
                    int j = i + sequence.length();
                    captionEditText.setSelection(j, j);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    chatKeyBoardContainer.addView(emojiView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM));
}
Also used : KeyEvent(android.view.KeyEvent) StructIGSticker(net.iGap.fragments.emoji.struct.StructIGSticker) EmojiView(net.iGap.libs.emojiKeyboard.EmojiView) IOException(java.io.IOException)

Example 3 with EmojiView

use of net.iGap.libs.emojiKeyboard.EmojiView in project iGap-Android by KianIranian-STDG.

the class StatusTextFragment method createEmojiView.

private void createEmojiView() {
    if (emojiView == null) {
        emojiView = new EmojiView(rootView.getContext(), false, true);
        emojiView.setVisibility(View.GONE);
        emojiView.setContentView(EmojiView.EMOJI);
        emojiView.setListener(new EmojiView.Listener() {

            @Override
            public void onBackSpace() {
                if (addTextEditTExt.length() == 0) {
                    return;
                }
                addTextEditTExt.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL));
            }

            @Override
            public void onStickerClick(StructIGSticker structIGSticker) {
            }

            @Override
            public void onStickerSettingClick() {
            }

            @Override
            public void onAddStickerClicked() {
            }

            @Override
            public void onEmojiSelected(String unicode) {
                int i = addTextEditTExt.getSelectionEnd();
                if (i < 0)
                    i = 0;
                try {
                    if (addTextEditTExt.getText() != null) {
                        editTextSize = 27;
                        addTextEditTExt.setTextSize(editTextSize);
                        CharSequence sequence = EmojiManager.getInstance().replaceEmoji(unicode, addTextEditTExt.getPaint().getFontMetricsInt(), LayoutCreator.dp(22), false);
                        addTextEditTExt.setText(addTextEditTExt.getText().insert(i, sequence));
                        int j = i + sequence.length();
                        addTextEditTExt.setSelection(j, j);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    chatKeyBoardContainer.addView(emojiView, LayoutCreator.createFrame(LayoutCreator.MATCH_PARENT, LayoutCreator.WRAP_CONTENT, Gravity.BOTTOM));
}
Also used : KeyEvent(android.view.KeyEvent) StructIGSticker(net.iGap.fragments.emoji.struct.StructIGSticker) EmojiView(net.iGap.libs.emojiKeyboard.EmojiView)

Aggregations

KeyEvent (android.view.KeyEvent)3 StructIGSticker (net.iGap.fragments.emoji.struct.StructIGSticker)3 EmojiView (net.iGap.libs.emojiKeyboard.EmojiView)3 IOException (java.io.IOException)1