Browse Source

Fix #395

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

+ 2 - 6
app/src/main/java/com/nextcloud/talk/controllers/CallController.java

@@ -691,12 +691,8 @@ public class CallController extends BaseController {
     }
 
     @OnClick(R.id.callControlHangupView)
-    public void onHangupClick() {
-        if (inCall) {
-            hangup(false);
-        } else {
-            hangup(true);
-        }
+    void onHangupClick() {
+        hangup(false);
     }
 
     @OnClick(R.id.call_control_camera)

+ 1 - 1
app/src/main/java/com/nextcloud/talk/controllers/CallNotificationController.java

@@ -194,7 +194,7 @@ public class CallNotificationController extends BaseController {
     private void proceedToCall() {
         originalBundle.putString(BundleKeys.KEY_ROOM_TOKEN, currentConversation.getToken());
 
-        getRouter().setRoot(RouterTransaction.with(new CallController(originalBundle))
+        getRouter().replaceTopController(RouterTransaction.with(new CallController(originalBundle))
                 .popChangeHandler(new HorizontalChangeHandler())
                 .pushChangeHandler(new HorizontalChangeHandler()));
     }

+ 4 - 1
app/src/main/java/com/nextcloud/talk/controllers/ChatController.java

@@ -169,6 +169,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
     private boolean voiceOnly;
     private boolean isFirstMessagesProcessing = true;
     private boolean isHelloClicked;
+    private boolean isLeavingForConversation;
 
     private static final byte CONTENT_TYPE_SYSTEM_MESSAGE = 1;
 
@@ -489,6 +490,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
     protected void onAttach(@NonNull View view) {
         super.onAttach(view);
 
+        isLeavingForConversation = false;
         ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomId(roomId);
         ApplicationWideCurrentRoomHolder.getInstance().setCurrentRoomToken(roomId);
         ApplicationWideCurrentRoomHolder.getInstance().setInCall(false);
@@ -517,7 +519,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
     protected void onDetach(@NonNull View view) {
         super.onDetach(view);
         if (conversationUser.hasSpreedCapabilityWithName("no-ping")
-                && getActivity() != null && !getActivity().isChangingConfigurations()) {
+                && getActivity() != null && !getActivity().isChangingConfigurations() && !isLeavingForConversation) {
             wasDetached = true;
             leaveRoom();
         }
@@ -1013,6 +1015,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
     }
 
     private void startACall(boolean isVoiceOnlyCall) {
+        isLeavingForConversation = true;
         if (!isVoiceOnlyCall) {
             Intent videoCallIntent = getIntentForCall(false);
             if (videoCallIntent != null) {

+ 3 - 1
app/src/main/res/layout/controller_call.xml

@@ -70,7 +70,9 @@
             android:layout_height="match_parent"
             android:animateLayoutChanges="true"
             android:background="@color/grey950"
-            android:orientation="vertical"></LinearLayout>
+            android:orientation="vertical">
+
+        </LinearLayout>
 
         <FrameLayout
             android:layout_width="wrap_content"