Browse Source

Fix a crash

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 years ago
parent
commit
ef6aad5093

+ 7 - 9
app/src/main/java/com/nextcloud/talk/controllers/ChatController.java

@@ -129,11 +129,11 @@ public class ChatController extends BaseController implements MessagesListAdapte
     @Inject
     Cache cache;
 
-    @BindView(R.id.nc_message_input)
-    MessageInput messageInput;
     @BindView(R.id.messagesList)
     MessagesList messagesList;
-    @BindView(R.id.popupBubble)
+    @BindView(R.id.nc_message_input)
+    MessageInput messageInput;
+    @BindView(R.id.nc_popup_bubble)
     PopupBubble popupBubble;
     private List<Disposable> disposableList = new ArrayList<>();
     private String conversationName;
@@ -564,13 +564,11 @@ public class ChatController extends BaseController implements MessagesListAdapte
                                     myFirstMessage = message;
                                 }
 
-                                getActivity().runOnUiThread(() -> {
-                                    if (popupBubble.isShown()) {
-                                        popupBubble.hide();
-                                    }
+                                if (popupBubble != null && popupBubble.isShown()) {
+                                    popupBubble.hide();
+                                }
 
-                                    messagesList.smoothScrollToPosition(0);
-                                });
+                                messagesList.smoothScrollToPosition(0);
                             } else {
                                 sendMessage(message, attempt + 1);
                             }

+ 1 - 1
app/src/main/res/layout/controller_chat.xml

@@ -47,7 +47,7 @@
         app:textAutoLink="all"/>
 
     <com.webianks.library.PopupBubble
-        android:id="@+id/popupBubble"
+        android:id="@+id/nc_popup_bubble"
         android:layout_margin="16dp"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"