From 92cb537d2f7bd0e00145c2426b7bf9b5d612c2ab Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Tue, 11 Dec 2018 13:50:26 +0100 Subject: [PATCH] Fixed bugs in code Signed-off-by: Mario Danic --- .../talk/controllers/ContactsController.java | 13 ++-- .../bottomsheet/OperationsMenuController.java | 65 ++++++++++--------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java index 993bdc0b9..722977d5f 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java +++ b/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(); } diff --git a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java b/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java index 71eda60bc..571cd1468 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/bottomsheet/OperationsMenuController.java +++ b/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() { - @Override - public void onSubscribe(Disposable d) { + ncApi.addParticipant(credentials, retrofitBucket.getUrl(), retrofitBucket.getQueryMap()) + .subscribeOn(Schedulers.newThread()) + .observeOn(AndroidSchedulers.mainThread()) + .retry(1) + .subscribe(new Observer() { + @Override + public void onSubscribe(Disposable d) { + } + + @Override + public void onNext(AddParticipantOverall addParticipantOverall) { + } + + @Override + public void onError(Throwable e) { + dispose(); + } + + @Override + public void onComplete() { + synchronized (localInvitedUsers) { + localInvitedUsers.remove(userId); } - @Override - public void onNext(AddParticipantOverall addParticipantOverall) { + if (localInvitedGroups.size() == 0 && localInvitedUsers.size() == 0) { + initiateConversation(true, null); } - - @Override - public void onError(Throwable e) { - dispose(); - } - - @Override - public void onComplete() { - synchronized (localInvitedUsers) { - localInvitedUsers.remove(userId); - } - - if (localInvitedUsers.size() == 0) { - initiateConversation(true, null); - } - dispose(); - } - }); - } + dispose(); + } + }); } } else { if (!currentUser.hasSpreedCapabilityWithName("chat-v2")) {