~singpolyma/cheogram-android

2cc5d3b20488d112e64fd2e917afa3e87fc1bea4 — Stephen Paul Weber 5 months ago 57f0594 2.12.1-8
Only refresh the command recycler if we need to

Otherwise every UI refresh of any kind causes text boxes to lose focus.
1 files changed, 7 insertions(+), 1 deletions(-)

M src/main/java/eu/siacs/conversations/entities/Conversation.java
M src/main/java/eu/siacs/conversations/entities/Conversation.java => src/main/java/eu/siacs/conversations/entities/Conversation.java +7 -1
@@ 1769,6 1769,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
                            if (mimeType.startsWith("image/") && "https".equals(uri.getScheme())) {
                                final Drawable d = cache.get(uri.toString());
                                if (d == null) {
                                    synchronized (CommandSession.this) {
                                        waitingForRefresh = true;
                                    }
                                    int size = (int)(xmppConnectionService.getResources().getDisplayMetrics().density * 288);
                                    Message dummy = new Message(Conversation.this, uri.toString(), Message.ENCRYPTION_NONE);
                                    dummy.setFileParams(new Message.FileParams(uri.toString()));


@@ 2589,6 2592,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
            protected WebView actionToWebview = null;
            protected int fillableFieldCount = 0;
            protected IqPacket pendingResponsePacket = null;
            protected boolean waitingForRefresh = false;

            CommandSession(String title, String node, XmppConnectionService xmppConnectionService) {
                loading();


@@ 3063,7 3067,9 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
            }

            public void refresh() {
                notifyDataSetChanged();
                synchronized(this) {
                    if (waitingForRefresh) notifyDataSetChanged();
                }
            }

            protected void loading() {