Change summary
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 18
1 file changed, 11 insertions(+), 7 deletions(-)
Detailed changes
@@ -1809,7 +1809,7 @@ public class ConversationFragment extends XmppFragment
if (activity == null) return;
activity.runOnUiThread(() -> {
refresh();
- refreshCommands();
+ refreshCommands(true);
});
});
}
@@ -2836,7 +2836,7 @@ public class ConversationFragment extends XmppFragment
if (commandAdapter != null && conversation != originalConversation) {
originalConversation.setupViewPager(null, null);
conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout);
- refreshCommands();
+ refreshCommands(false);
}
if (commandAdapter == null && conversation != null) {
conversation.setupViewPager(binding.conversationViewPager, binding.tabLayout);
@@ -2846,24 +2846,24 @@ public class ConversationFragment extends XmppFragment
final Element command = commandAdapter.getItem(position);
activity.startCommand(conversation.getAccount(), command.getAttributeAsJid("jid"), command.getAttribute("node"));
});
- refreshCommands();
+ refreshCommands(false);
}
return true;
}
public void refreshForNewCaps() {
- refreshCommands();
+ refreshCommands(true);
}
- protected void refreshCommands() {
+ protected void refreshCommands(boolean delayShow) {
if (commandAdapter == null) return;
Jid commandJid = conversation.getContact().resourceWhichSupport(Namespace.COMMANDS);
if (commandJid == null) {
conversation.hideViewPager();
} else {
- conversation.showViewPager();
+ if (!delayShow) conversation.showViewPager();
activity.xmppConnectionService.fetchCommands(conversation.getAccount(), commandJid, (a, iq) -> {
if (activity == null) return;
@@ -2877,7 +2877,11 @@ public class ConversationFragment extends XmppFragment
}
}
- if (commandAdapter.getCount() < 1) conversation.hideViewPager();
+ if (commandAdapter.getCount() < 1) {
+ conversation.hideViewPager();
+ } else if (delayShow) {
+ conversation.showViewPager();
+ }
});
});
}