Try fixing keyboard handling for some specific devices
This commit is contained in:
parent
3e7ece632b
commit
b9daa2e6cf
1 changed files with 19 additions and 7 deletions
|
@ -4183,15 +4183,27 @@ public class ConversationFragment extends XmppFragment
|
||||||
private void updateInputField(final boolean me) {
|
private void updateInputField(final boolean me) {
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(activity.getWindow().getDecorView(), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(activity.getWindow().getDecorView(), (v, insets) -> {
|
||||||
boolean isKeyboardVisible = insets.isVisible(WindowInsetsCompat.Type.ime());
|
boolean isKeyboardVisible = insets.isVisible(WindowInsetsCompat.Type.ime());
|
||||||
int keyboardHeight = 350;
|
int keyboardHeight;
|
||||||
if (activity != null && activity.xmppConnectionService != null && ViewConfiguration.get(activity).hasPermanentMenuKey()) {
|
if (activity != null && activity.xmppConnectionService != null && ViewConfiguration.get(activity).hasPermanentMenuKey() && isKeyboardVisible) {
|
||||||
keyboardHeight = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom - insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom - 24;
|
keyboardHeight = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom - insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom - 24;
|
||||||
} else if (activity != null && activity.xmppConnectionService != null) {
|
EmojiPickerView emojipickerview = (EmojiPickerView) activity.findViewById(R.id.emoji_picker);
|
||||||
|
binding.keyboardButton.setVisibility(GONE);
|
||||||
|
binding.emojiButton.setVisibility(VISIBLE);
|
||||||
|
ViewGroup.LayoutParams params = emojipickerview.getLayoutParams();
|
||||||
|
params.height = keyboardHeight;
|
||||||
|
emojipickerview.setLayoutParams(params);
|
||||||
|
binding.emojiPicker.setVisibility(VISIBLE);
|
||||||
|
} else if (activity != null && activity.xmppConnectionService != null && !ViewConfiguration.get(activity).hasPermanentMenuKey() && isKeyboardVisible) {
|
||||||
keyboardHeight = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom - insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom - 24;
|
keyboardHeight = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom - insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom - 24;
|
||||||
} else if (activity != null) {
|
EmojiPickerView emojipickerview = (EmojiPickerView) activity.findViewById(R.id.emoji_picker);
|
||||||
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
binding.keyboardButton.setVisibility(GONE);
|
||||||
}
|
binding.emojiButton.setVisibility(VISIBLE);
|
||||||
if (activity != null && activity.xmppConnectionService != null && isKeyboardVisible) {
|
ViewGroup.LayoutParams params = emojipickerview.getLayoutParams();
|
||||||
|
params.height = keyboardHeight;
|
||||||
|
emojipickerview.setLayoutParams(params);
|
||||||
|
binding.emojiPicker.setVisibility(VISIBLE);
|
||||||
|
} else if (activity != null && isKeyboardVisible) {
|
||||||
|
keyboardHeight = 350;
|
||||||
EmojiPickerView emojipickerview = (EmojiPickerView) activity.findViewById(R.id.emoji_picker);
|
EmojiPickerView emojipickerview = (EmojiPickerView) activity.findViewById(R.id.emoji_picker);
|
||||||
binding.keyboardButton.setVisibility(GONE);
|
binding.keyboardButton.setVisibility(GONE);
|
||||||
binding.emojiButton.setVisibility(VISIBLE);
|
binding.emojiButton.setVisibility(VISIBLE);
|
||||||
|
|
Loading…
Add table
Reference in a new issue