Search code examples
androidkeyboardemojiandroid-popupwindow

How to make effective popup view for emojicon?


I have some example Emoji Keyboard. How to create popup view look like emojiconView in softkeyboard

I have another project. I create a popup same like in Dot dash Keyboard How to implements a emoji proper view in softkeyboard.

See :

EmojiView

But my view see :

simaplepopup

How to manage this view in SoftKeyboard.

Edit 1 : Code

public void createCheatSheet() {
        LayoutInflater inflater = (LayoutInflater) service.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
        ViewGroup viewGrop = null;
        if (this.gridView == null) {
            emojiTextView = new EmojiconTextView(getContext());
            // this.gridView =
            // this.service.getLayoutInflater().inflate(R.layout.cheatsheet2,
            // null);
            LinearLayout l = (LinearLayout) this.service.getLayoutInflater().inflate(R.layout.cheatsheet2, null);
            l.addView(emojiTextView);
            viewGrop = (ViewGroup) inflater.inflate(R.layout.linearlayout, l, true);

        }
        if (emojiTextView == null) {
            // this.gridView =
            // this.service.getLayoutInflater().inflate(R.layout.cheatsheet1,
            // null);
            // emojiTextView = (EmojiconTextView)
            // gridView.findViewById(R.id.Emoji_GridView);

        }

        if (this.popupDialog == null) {
            this.popupDialog = new Dialog(this.service);

            popupDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

            popupDialog.setCancelable(true);
            // FrameLayout boatlayout = new FrameLayout(this.service);
            // emojiTextView = (EmojiconTextView)
            // gridView.findViewById(R.id.Emoji_GridView);
            //
            // FrameLayout.LayoutParams params = new
            // FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
            // LayoutParams.MATCH_PARENT);
            // boatlayout.addView(emojiTextView, params);
            // RelativeLayout.LayoutParams parentParams = new
            // RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            // LayoutParams.WRAP_CONTENT);
            // popupDialog.addContentView(boatlayout, parentParams);
            popupDialog.setCanceledOnTouchOutside(true);
            popupDialog.setContentView(viewGrop);
            // popupDialog.addContentView(emojiTextView, params);

            // emojiTextView.setOnTouchListener(new OnTouchListener() {
            // @Override
            // public boolean onTouch(View v, MotionEvent event) {
            // Toast.makeText(getContext(), "onclick",
            // Toast.LENGTH_LONG).show();
            // return true;
            // }
            // });
            PopupWindow window = new PopupWindow(gridView, 200, 200);
//          Window window = this.popupDialog.getWindow();
            WindowManager.LayoutParams lp = window.getAttributes();
            lp.token = this.getWindowToken();
            lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
            window.setAttributes(lp);

            window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        }
    }

Thanks for advance. Please share your code.


Solution

  • You follow this links :

    How to draw view on top of soft keyboard like WhatsApp?

    you are a developer but no have functionality. You create a custom view for Keyboard and you follow this project.

    AnySoftKeyboard

    https://github.com/AnySoftKeyboard/AnySoftKeyboard

    https://github.com/zeuxisoo/android-emoji-keyboard

    https://code.google.com/p/indic-keyboards/