start pip mode when back button is pressed

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2021-10-25 11:52:05 +02:00
parent 78653e7d8d
commit 2c1b45491d
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
2 changed files with 7 additions and 10 deletions

View file

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

View file

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