From 2c1b45491d9b6a63f18a813a205954ce5796a4d2 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 25 Oct 2021 11:52:05 +0200 Subject: [PATCH] start pip mode when back button is pressed Signed-off-by: Marcel Hibbe --- .../com/nextcloud/talk/activities/MagicCallActivity.kt | 10 ++++++---- .../com/nextcloud/talk/controllers/CallController.java | 7 +------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.kt index 326bddc12..d485ee963 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/MagicCallActivity.kt @@ -89,13 +89,15 @@ class MagicCallActivity : BaseActivity() { } - @RequiresApi(Build.VERSION_CODES.O) - fun enterPipMode() { - enableKeyguard() - enterPictureInPictureMode(getPipParams()) + override fun onBackPressed() { + enterPipMode() } override fun onUserLeaveHint() { + enterPipMode() + } + + fun enterPipMode() { enableKeyguard() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { enterPictureInPictureMode(getPipParams()) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java index 3e330a143..d0954cea0 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java @@ -865,12 +865,7 @@ public class CallController extends BaseController { @OnClick(R.id.callControlEnterPip) void enterPipMode() { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O){ - ((MagicCallActivity) getActivity()).enterPipMode(); - } else{ - Log.w(TAG, "tried to enterPipMode with an android api level below 26 (Android 8). This scenario should " + - "have been avoided by hiding the PIP button!"); - } + ((MagicCallActivity) getActivity()).enterPipMode(); } @OnClick(R.id.callControlHangupView)