EmojiEdittext in Dialog
How to use EmojiEditText in Dialog? When i use that Edit Text in dialog it didn't show emoji layout properly.It open s Soft Keyboard & Emojis Dialog both combine. Give me solution of this please.
Same problem
I can't even manage to get the emoji popup to appear. What view do we have to pass to the EmojiconsPopup's constructor, when using dialogs? If I pass the root view of the activity in which the dialog is created and shown, the emoji popup appears on top of the keyboard and behind the dialog (and the dimmed background).
So, after further trying and debugging, it seems my only problem is the PopupWindow appearing above the keyboard instead of on top of it (I wrote "on top of" in the previous post but maybe "above" was more correct). It's as if the x: 0, y: 0 position of the view I use is not the bottom-left corner of the screen, but the bottom-left corner of the area above the keyboard, albeit the view's height is equal to the screen's height (the Rect it generates in "setSizeForSoftKeyboard()" is "left: 0; top: 38; right: 480; bottom: 800" and my phone's screen resolution is 480x800.). Is there just something stupid I'm missing? Like some setting that prevents anything from overlapping the keyboard? If it matters, I tried both "adjustPan" and "adjustResize" as "windowSoftInputMode"s, but the result is the same.
I'll continue debugging, in the meantime...
Hey there problem with emoji layout, layout not placed properly when u click on the smiley icon. Emoji keyboard appears above the key pad
Plz post your code as soon as possible. . It is good code written just need some modifications.. And it would be better if you can insert INDIAN FLAG.
I just found something! By using the "update(int x, int y, int width, int height, boolean force)" method, if you pass a negative y it will overlap the keyboard.
The lib should detect when a dialog is showing (for example with an override of the initializer in which we tell it we are using a dialog) and instead of using showAtLocation(rootView, Gravity.BOTTOM, 0, 0) it should use showAtLocation(rootView, Gravity.BOTTOM, 0, -9999), with -9999 being an arbitrary, low enough number. As long as isClippingEnabled() returns true, passing a very low number will put the popup at the bottom of the screen.
P.S. The EmojiconPopup needs two Views at this point. One to make the right calculations to see if the keyboard is open, and the dialog's root view to show the PopupWindow in it. It can't calculate things with the dialog's view because it's too small (well, unless you have a particularly tall dialog).
Edit: After the edits I made to make it work with my dialog, I noticed that when I close the keyboard, the PopupWindow for a moment "teleports" back up to where the dialog is and then disappears. It's not acceptable. The best thing would be making the popup disappear first, and then let the keyboard close. It can be done with custom code in the activities' "onBackPressed", I guess, buuut, yeah. Not an optimal solution. Edit: Nope, "onBackPressed" is too slow.
(Time for a new comment) I found a way to make the popup disappear even before the keyboard does. I modified the EmojiconEditText like so:
public class EmojiconEditText extends EditText {
private int mEmojiconSize;
private EmojiconsPopup emojiconsPopup;// <- added
...
public void setEmojiconsPopup(EmojiconsPopup emojiconsPopup) {
this.emojiconsPopup = emojiconsPopup;
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
if(emojiconsPopup != null && emojiconsPopup.isShowing())
emojiconsPopup.dismiss();
return false;
}
return super.onKeyPreIme(keyCode, event);
}
...
This way, we don't need to use this.setOnSoftKeyboardOpenCloseListener to listen for the keyboard's dismissal (well, unless we want to do something else than dismissing the popup).
The important thing is to dismiss the EmojiconPopup every time the keyboard closes.
Hey there check it out I did this and solved problem.. USE EMOTICON (emoji) LIBRARY IN ANDROID APP http://vjscrazzy.blogspot.com/2015/09/use-emoticon-emoji-library-in-android.html
you mean the last line? -1 as the y in "showAtLocation"? I'll try.
edit: I tried and the popup simply gets moved down by 1 pixel (as I suspected). does setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN) make the difference?
update: it seems my method of using a big negative number as the Y in "showAtLocation" doesn't work for every device. it fails on a Ulefone with Lollipop. I tried to call "update(0, -9999, -1, -1, true)" right after "showAtLocation" but nothing changes. I don't know how to fix it.