Fix some bugs

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-06-01 14:52:28 +02:00
parent c4ee636e0c
commit bf40f7eab8
4 changed files with 20 additions and 32 deletions

View File

@ -50,6 +50,7 @@ import android.widget.ImageView;
import com.amulyakhare.textdrawable.TextDrawable; import com.amulyakhare.textdrawable.TextDrawable;
import com.bluelinelabs.conductor.RouterTransaction; import com.bluelinelabs.conductor.RouterTransaction;
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler; import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler;
import com.bumptech.glide.load.DataSource; import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.engine.GlideException; import com.bumptech.glide.load.engine.GlideException;
@ -156,6 +157,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
private int newMessagesCount = 0; private int newMessagesCount = 0;
private Boolean startCallFromNotification; private Boolean startCallFromNotification;
private String roomId; private String roomId;
/* /*
TODO: TODO:
- check push notifications - check push notifications
@ -387,19 +389,6 @@ public class ChatController extends BaseController implements MessagesListAdapte
return conversationName; return conversationName;
} }
@Override
public boolean handleBack() {
if (getRouter().hasRootController()) {
getRouter().popToRoot(new HorizontalChangeHandler());
} else {
getRouter().setRoot(RouterTransaction.with(new MagicBottomNavigationController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
}
return true;
}
@Override @Override
public void onDestroy() { public void onDestroy() {
inChat = false; inChat = false;
@ -500,7 +489,13 @@ public class ChatController extends BaseController implements MessagesListAdapte
@Override @Override
public void onNext(GenericOverall genericOverall) { public void onNext(GenericOverall genericOverall) {
getRouter().popCurrentController(); if (getRouter().hasRootController()) {
getRouter().popToRoot(new VerticalChangeHandler());
} else {
getRouter().setRoot(RouterTransaction.with(new MagicBottomNavigationController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
}
} }
@Override @Override
@ -744,14 +739,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
public boolean onOptionsItemSelected(@NonNull MenuItem item) { public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case android.R.id.home: case android.R.id.home:
inChat = false; onDestroy();
if (getRouter().hasRootController()) {
getRouter().popToRoot(new HorizontalChangeHandler());
} else {
getRouter().setRoot(RouterTransaction.with(new MagicBottomNavigationController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
}
return true; return true;
case R.id.conversation_video_call: case R.id.conversation_video_call:

View File

@ -330,6 +330,7 @@ public class ContactsController extends BaseController implements SearchView.OnQ
} else { } else {
roomType = Room.RoomType.ROOM_GROUP_CALL; roomType = Room.RoomType.ROOM_GROUP_CALL;
} }
bundle.putParcelable(BundleKeys.KEY_CONVERSATION_TYPE, Parcels.wrap(roomType)); bundle.putParcelable(BundleKeys.KEY_CONVERSATION_TYPE, Parcels.wrap(roomType));
ArrayList<String> userIds = new ArrayList<>(); ArrayList<String> userIds = new ArrayList<>();
Set<Integer> selectedPositions = adapter.getSelectedPositionsAsSet(); Set<Integer> selectedPositions = adapter.getSelectedPositionsAsSet();
@ -789,9 +790,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
bottomSheet.setOnCancelListener(null); bottomSheet.setOnCancelListener(null);
bottomSheet.cancel(); bottomSheet.cancel();
if (bottomSheetLockEvent.isDismissView()) {
new Handler().postDelayed(() -> getRouter().popCurrentController(), 100);
}
}, bottomSheetLockEvent.getDelay()); }, bottomSheetLockEvent.getDelay());
} }
} }

View File

@ -500,7 +500,6 @@ public class OperationsMenuController extends BaseController {
@Override @Override
public void onNext(AddParticipantOverall addParticipantOverall) { public void onNext(AddParticipantOverall addParticipantOverall) {
} }
@Override @Override
@ -515,7 +514,7 @@ public class OperationsMenuController extends BaseController {
} }
if (localInvitedUsers.size() == 0) { if (localInvitedUsers.size() == 0) {
initiateConversation(false, null); initiateConversation(true, null);
} }
dispose(); dispose();
} }
@ -544,15 +543,15 @@ public class OperationsMenuController extends BaseController {
Intent conversationIntent = new Intent(getActivity(), CallActivity.class); Intent conversationIntent = new Intent(getActivity(), CallActivity.class);
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, room.getToken()); bundle.putString(BundleKeys.KEY_ROOM_TOKEN, room.getToken());
bundle.putString(BundleKeys.KEY_ROOM_ID, room.getToken()); bundle.putString(BundleKeys.KEY_ROOM_ID, room.getRoomId());
bundle.putString(BundleKeys.KEY_CONVERSATION_NAME, room.getDisplayName()); bundle.putString(BundleKeys.KEY_CONVERSATION_NAME, room.getDisplayName());
bundle.putParcelable(BundleKeys.KEY_ACTIVE_CONVERSATION, Parcels.wrap(call)); bundle.putParcelable(BundleKeys.KEY_ACTIVE_CONVERSATION, Parcels.wrap(call));
conversationIntent.putExtras(bundle); conversationIntent.putExtras(bundle);
getParentController().getParentController().getRouter().pushController((RouterTransaction.with(
new ChatController(bundle)).pushChangeHandler( getParentController().getRouter().pushController(RouterTransaction.with(new ChatController(bundle))
new HorizontalChangeHandler()) .pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()))); .popChangeHandler(new HorizontalChangeHandler()));
} else { } else {
initiateCall(); initiateCall();

View File

@ -24,6 +24,9 @@ import com.bluelinelabs.logansquare.annotation.JsonField;
import com.bluelinelabs.logansquare.annotation.JsonObject; import com.bluelinelabs.logansquare.annotation.JsonObject;
import com.nextcloud.talk.models.json.rooms.RoomsOCS; import com.nextcloud.talk.models.json.rooms.RoomsOCS;
import lombok.Data;
@Data
@JsonObject @JsonObject
public class AddParticipantOverall { public class AddParticipantOverall {
@JsonField(name = "ocs") @JsonField(name = "ocs")