How to add our own emoji in softkeyboard

795 views Asked by At

I am trying to figure out how the emoji (emoticon) selections are implemented on the Facebook app and the Google Hangouts app.

I have creating a softkeyboard like emoji. But then i think how apps like facebook,skype etc react on it. A lot of emoji keyboard Apps are using unicode to send their image and these codes are universal.

I am thinking that this type of keyboard can only be useful within this app and not with other apps or Operating Systems.

This keyboard is not using Unicode sequences but rather just local image assets.

My Question is

If i add my own emoji from local db and if i don't use UniCode and send it by creating a spannable ImageSpan. These Images can be sent to what's App ,Facebook and skype or not.

Because I am creating new Emoji images. Is this work .

Just need suggestion or

Does anyone have an idea of how this can be implemented. 

Or is it possible to convert my Emoji Icons to UNi Code

1

There are 1 answers

0
AudioBubble On

see this link

Softkeyboard.java

    if (primaryCode == 32) {
        LayoutInflater layoutInflater = (LayoutInflater) getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
        View popupView = layoutInflater.inflate(R.layout.popup, null);
        popupWindow = new EmojiconsPopup(popupView, this);
        // final PopupWindow popupWindow = new PopupWindow();
        popupWindow.setSizeForSoftKeyboard();
        popupWindow.setSize(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        popupWindow.showAtLocation(mInputView.getRootView(), Gravity.BOTTOM, 0, 0);

        // Bring soft keyboard up : NOT WORKING
        final InputMethodManager mInputMethodManager = (InputMethodManager) getBaseContext()
                .getSystemService(Context.INPUT_METHOD_SERVICE);

        mInputMethodManager.showSoftInput(popupView, 0);


        // If the text keyboard closes, also dismiss the emoji popup
        popupWindow.setOnSoftKeyboardOpenCloseListener(new OnSoftKeyboardOpenCloseListener() {

            @Override
            public void onKeyboardOpen(int keyBoardHeight) {

            }

            @Override
            public void onKeyboardClose() {
                if (popupWindow.isShowing())
                    popupWindow.dismiss();
            }
        });

        popupWindow.setOnEmojiconClickedListener(new OnEmojiconClickedListener() {

            @Override
            public void onEmojiconClicked(Emojicon emojicon) {
                mComposing.append(emojicon.getEmoji());
                commitTyped(getCurrentInputConnection());

                customToast("" + emojicon.getEmoji());
            }
        });

        popupWindow.setOnEmojiconBackspaceClickedListener(new OnEmojiconBackspaceClickedListener() {

            @Override
            public void onEmojiconBackspaceClicked(View v) {
                KeyEvent event = new KeyEvent(0, 0, 0, KeyEvent.KEYCODE_DEL, 0, 0, 0, 0, KeyEvent.KEYCODE_ENDCALL);
                customToast(" " + event);
                handleBackspace();
            }
        });

Some help for you..