Prechádzať zdrojové kódy

Fixed bugs in code

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 6 rokov pred
rodič
commit
92cb537d2f

+ 6 - 7
app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java

@@ -795,6 +795,10 @@ public class ContactsController extends BaseController implements SearchView.OnQ
             view = getActivity().getLayoutInflater().inflate(R.layout.bottom_sheet, null, false);
         }
 
+        if (bottomSheet == null) {
+            bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
+        }
+
         if (showEntrySheet) {
             getChildRouter((ViewGroup) view).setRoot(
                     RouterTransaction.with(new EntryMenuController(bundle))
@@ -805,13 +809,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
                     RouterTransaction.with(new OperationsMenuController(bundle))
                             .popChangeHandler(new VerticalChangeHandler())
                             .pushChangeHandler(new VerticalChangeHandler()));
-
-            bottomSheet.setOnShowListener(dialog -> eventBus.post(new BottomSheetLockEvent(false, 0,
-                    false, false)));
-        }
-
-        if (bottomSheet == null) {
-            bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
         }
 
         bottomSheet.setOnShowListener(dialog -> {
@@ -822,6 +819,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
                         false, false));
             }
         });
+
         bottomSheet.setOnDismissListener(dialog -> getActionBar().setDisplayHomeAsUpEnabled(getRouter().getBackstackSize() > 1));
 
         bottomSheet.show();
@@ -970,6 +968,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
             }
         }
 
+        adapter.notifyDataSetChanged();
         checkAndHandleDoneMenuItem();
     }
 

+ 31 - 30
app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java

@@ -517,6 +517,7 @@ public class OperationsMenuController extends BaseController {
         if (localInvitedGroups.size() > 0) {
             localInvitedGroups.remove(0);
         }
+
         if (localInvitedUsers.size() > 0 || (localInvitedGroups.size() > 0 && currentUser.hasSpreedCapabilityWithName("invite-groups-and-mails"))) {
             if ((localInvitedGroups.size() > 0 && currentUser.hasSpreedCapabilityWithName("invite-groups-and-mails"))) {
                 for (int i = 0; i < localInvitedGroups.size(); i++) {
@@ -557,44 +558,44 @@ public class OperationsMenuController extends BaseController {
                             });
 
                 }
+            }
 
-                for (int i = 0; i < localInvitedGroups.size(); i++) {
-                    final String userId = invitedUsers.get(i);
-                    retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(currentUser.getBaseUrl(), conversation.getToken(),
-                            userId);
+            for (int i = 0; i < localInvitedUsers.size(); i++) {
+                final String userId = invitedUsers.get(i);
+                retrofitBucket = ApiUtils.getRetrofitBucketForAddParticipant(currentUser.getBaseUrl(), conversation.getToken(),
+                        userId);
 
-                    ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
-                            .subscribeOn(Schedulers.newThread())
-                            .observeOn(AndroidSchedulers.mainThread())
-                            .retry(1)
-                            .subscribe(new Observer<AddParticipantOverall>() {
-                                @Override
-                                public void onSubscribe(Disposable d) {
+                ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap())
+                        .subscribeOn(Schedulers.newThread())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .retry(1)
+                        .subscribe(new Observer<AddParticipantOverall>() {
+                            @Override
+                            public void onSubscribe(Disposable d) {
 
-                                }
+                            }
 
-                                @Override
-                                public void onNext(AddParticipantOverall addParticipantOverall) {
-                                }
+                            @Override
+                            public void onNext(AddParticipantOverall addParticipantOverall) {
+                            }
 
-                                @Override
-                                public void onError(Throwable e) {
-                                    dispose();
-                                }
+                            @Override
+                            public void onError(Throwable e) {
+                                dispose();
+                            }
 
-                                @Override
-                                public void onComplete() {
-                                    synchronized (localInvitedUsers) {
-                                        localInvitedUsers.remove(userId);
-                                    }
+                            @Override
+                            public void onComplete() {
+                                synchronized (localInvitedUsers) {
+                                    localInvitedUsers.remove(userId);
+                                }
 
-                                    if (localInvitedUsers.size() == 0) {
-                                        initiateConversation(true, null);
-                                    }
-                                    dispose();
+                                if (localInvitedGroups.size() == 0 && localInvitedUsers.size() == 0) {
+                                    initiateConversation(true, null);
                                 }
-                            });
-                }
+                                dispose();
+                            }
+                        });
             }
         } else {
             if (!currentUser.hasSpreedCapabilityWithName("chat-v2")) {