fix message input initial focus loss
This commit is contained in:
parent
414b0c7978
commit
44acdbd2cb
|
@ -3233,10 +3233,19 @@ public class ConversationFragment extends XmppFragment
|
||||||
.setOpenConversation(this.conversation);
|
.setOpenConversation(this.conversation);
|
||||||
|
|
||||||
if (commandAdapter != null && conversation != originalConversation) {
|
if (commandAdapter != null && conversation != originalConversation) {
|
||||||
|
View currentFocus = null;
|
||||||
|
if (activity != null) {
|
||||||
|
currentFocus = activity.getCurrentFocus();
|
||||||
|
}
|
||||||
conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout, originalConversation);
|
conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout, originalConversation);
|
||||||
refreshCommands();
|
refreshCommands();
|
||||||
|
maybeRestoreMessageInputFocus(currentFocus);
|
||||||
}
|
}
|
||||||
if (commandAdapter == null && conversation != null) {
|
if (commandAdapter == null && conversation != null) {
|
||||||
|
View currentFocus = null;
|
||||||
|
if (activity != null) {
|
||||||
|
currentFocus = activity.getCurrentFocus();
|
||||||
|
}
|
||||||
conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout, null);
|
conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout, null);
|
||||||
commandAdapter = new CommandAdapter((XmppActivity) getActivity());
|
commandAdapter = new CommandAdapter((XmppActivity) getActivity());
|
||||||
binding.commandsView.setAdapter(commandAdapter);
|
binding.commandsView.setAdapter(commandAdapter);
|
||||||
|
@ -3247,6 +3256,7 @@ public class ConversationFragment extends XmppFragment
|
||||||
activity.startCommand(conversation.getAccount(), command.getAttributeAsJid("jid"), command.getAttribute("node"));
|
activity.startCommand(conversation.getAccount(), command.getAttributeAsJid("jid"), command.getAttribute("node"));
|
||||||
});
|
});
|
||||||
refreshCommands();
|
refreshCommands();
|
||||||
|
maybeRestoreMessageInputFocus(currentFocus);
|
||||||
}
|
}
|
||||||
|
|
||||||
previousClickedReply = null;
|
previousClickedReply = null;
|
||||||
|
@ -3291,6 +3301,12 @@ public class ConversationFragment extends XmppFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void maybeRestoreMessageInputFocus(View currentFocus) {
|
||||||
|
if (currentFocus == this.binding.textinput) {
|
||||||
|
this.binding.textinput.requestFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void resetUnreadMessagesCount() {
|
private void resetUnreadMessagesCount() {
|
||||||
lastMessageUuid = null;
|
lastMessageUuid = null;
|
||||||
hideUnreadMessagesCount();
|
hideUnreadMessagesCount();
|
||||||
|
|
Loading…
Reference in a new issue