Resolve emoji keyboard layout issues
1) orientation changes are now properly handled 2) emoji panel will not overrun the actionbar and composition area in space-contentious situations (quick reply popup) Closes #3553 fixes #3501 fixes #3485 fixes #3199 // FREEBIEpull/1/head
parent
c4524ebbd1
commit
bc787f20e3
@ -1,31 +1,45 @@
|
||||
package org.thoughtcrime.securesms.components.emoji;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.components.KeyboardAwareLinearLayout;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiDrawer.EmojiEventListener;
|
||||
|
||||
public class EmojiPopup extends PopupWindow {
|
||||
private View parent;
|
||||
private static final String TAG = EmojiPopup.class.getSimpleName();
|
||||
private KeyboardAwareLinearLayout parent;
|
||||
|
||||
public EmojiPopup(View parent) {
|
||||
public EmojiPopup(KeyboardAwareLinearLayout parent) {
|
||||
super(new EmojiDrawer(parent.getContext()),
|
||||
parent.getWidth(),
|
||||
parent.getResources().getDimensionPixelSize(R.dimen.min_emoji_drawer_height));
|
||||
this.parent = parent;
|
||||
Log.w("EmojiPopup", "popup initialized with width " + parent.getWidth());
|
||||
}
|
||||
|
||||
public void setEmojiEventListener(EmojiEventListener listener) {
|
||||
((EmojiDrawer)getContentView()).setEmojiEventListener(listener);
|
||||
}
|
||||
|
||||
public void show(int height) {
|
||||
setHeight(height);
|
||||
public void show() {
|
||||
setHeight(parent.getKeyboardHeight());
|
||||
setWidth(parent.getWidth());
|
||||
parent.padForCustomKeyboard(getHeight());
|
||||
Log.w(TAG, String.format("show(%d, %d)", getWidth(), getHeight()));
|
||||
showAtLocation(parent, Gravity.BOTTOM | Gravity.LEFT, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
update(parent, 0, 0, parent.getWidth(), -1);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
public class ServiceUtil {
|
||||
public static InputMethodManager getInputMethodManager(Context context) {
|
||||
return (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
}
|
||||
|
||||
public static WindowManager getWindowManager(Context context) {
|
||||
return (WindowManager) context.getSystemService(Activity.WINDOW_SERVICE);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue