Merge pull request '1.0.1' (#24) from develop into master

Reviewed-on: #24
This commit is contained in:
Sergei Poljanski 2024-12-13 19:57:18 +00:00
commit 210d1c9ac0

View file

@ -1388,7 +1388,7 @@ public class ConversationFragment extends XmppFragment
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
if (savedInstanceState == null) {
if (savedInstanceState == null && conversation != null) {
conversation.jumpToLatest();
}
}
@ -3233,10 +3233,19 @@ public class ConversationFragment extends XmppFragment
.setOpenConversation(this.conversation);
if (commandAdapter != null && conversation != originalConversation) {
View currentFocus = null;
if (activity != null) {
currentFocus = activity.getCurrentFocus();
}
conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout, originalConversation);
refreshCommands();
maybeRestoreMessageInputFocus(currentFocus);
}
if (commandAdapter == null && conversation != null) {
View currentFocus = null;
if (activity != null) {
currentFocus = activity.getCurrentFocus();
}
conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout, null);
commandAdapter = new CommandAdapter((XmppActivity) getActivity());
binding.commandsView.setAdapter(commandAdapter);
@ -3247,6 +3256,7 @@ public class ConversationFragment extends XmppFragment
activity.startCommand(conversation.getAccount(), command.getAttributeAsJid("jid"), command.getAttribute("node"));
});
refreshCommands();
maybeRestoreMessageInputFocus(currentFocus);
}
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() {
lastMessageUuid = null;
hideUnreadMessagesCount();