Fix input field for android < 11

This commit is contained in:
12aw 2023-11-22 19:41:39 +01:00
parent c1f1dc18c0
commit bc7f8c858a
2 changed files with 21 additions and 32 deletions

View file

@ -20,13 +20,13 @@
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 14901,
"versionCode": 14904,
"versionName": "1.7.7.4",
"outputFile": "monocles chat-1.7.7.4-git-armeabi-v7a-release.apk"
"outputFile": "monocles chat-1.7.7.4-git-arm64-v8a-release.apk"
},
{
"type": "ONE_OF_MANY",
@ -41,6 +41,19 @@
"versionName": "1.7.7.4",
"outputFile": "monocles chat-1.7.7.4-git-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 14901,
"versionName": "1.7.7.4",
"outputFile": "monocles chat-1.7.7.4-git-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
@ -53,19 +66,6 @@
"versionCode": 14902,
"versionName": "1.7.7.4",
"outputFile": "monocles chat-1.7.7.4-git-x86-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 14904,
"versionName": "1.7.7.4",
"outputFile": "monocles chat-1.7.7.4-git-arm64-v8a-release.apk"
}
],
"elementType": "File"

View file

@ -4234,20 +4234,11 @@ public class ConversationFragment extends XmppFragment
binding.threadIdenticonLayout.setLayoutParams(params);
showRecordVoiceButton();
updateSnackBar(conversation);
updateinputfield(canSendMeCommand(), null);
updateinputfield(canSendMeCommand());
}
public Point getDisplayDimensions(Context context) {
Point size = new Point();
WindowManager w = ((Activity) context).getWindowManager();
w.getDefaultDisplay().getSize(size);
return size;
}
public void updateinputfield(final boolean me, Context context) {
public void updateinputfield(final boolean me) {
if (Build.VERSION.SDK_INT > 29) {
ViewCompat.setOnApplyWindowInsetsListener(activity.getWindow().getDecorView(), (v, insets) -> {
boolean isKeyboardVisible = insets.isVisible(WindowInsetsCompat.Type.ime());
@ -4279,16 +4270,13 @@ public class ConversationFragment extends XmppFragment
return ViewCompat.onApplyWindowInsets(v, insets);
});
} else {
Point size = new Point();
WindowManager w = ((Activity) context).getWindowManager();
w.getDefaultDisplay().getSize(size);
RelativeLayout llRoot = binding.conversationsFragment; //The root layout (Linear, Relative, Contraint, etc...)
new KeyboardHeightProvider(context, activity.getWindowManager(), llRoot, new KeyboardHeightProvider.KeyboardHeightListener() {
new KeyboardHeightProvider(this.activity, activity.getWindowManager(), llRoot, new KeyboardHeightProvider.KeyboardHeightListener() {
@Override
public void onKeyboardHeightChanged(int keyboardHeight, boolean keyboardOpen, boolean isLandscape) {
Log.i("keyboard listener", "keyboardHeight: " + keyboardHeight + " keyboardOpen: " + keyboardOpen + " isLandscape: " + isLandscape);
if (activity != null && activity.xmppConnectionService != null && keyboardOpen && !isLandscape) {
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
EmojiPickerView emojipickerview = (EmojiPickerView) activity.findViewById(R.id.emoji_picker);
binding.keyboardButton.setVisibility(GONE);
binding.emojiButton.setVisibility(VISIBLE);
@ -4297,6 +4285,7 @@ public class ConversationFragment extends XmppFragment
emojipickerview.setLayoutParams(params);
binding.emojiPicker.setVisibility(VISIBLE);
} else if (activity != null && activity.xmppConnectionService != null && keyboardOpen && isLandscape) {
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
EmojiPickerView emojipickerview = (EmojiPickerView) activity.findViewById(R.id.emoji_picker);
binding.keyboardButton.setVisibility(GONE);
binding.emojiButton.setVisibility(VISIBLE);