Fixed bugs in code

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-12-11 13:50:26 +01:00
parent 88298026aa
commit 92cb537d2f
2 changed files with 39 additions and 39 deletions

View file

@ -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();
}

View file

@ -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 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")) {