Skip to content

Commit

Permalink
Expanded PiP mode
Browse files Browse the repository at this point in the history
  • Loading branch information
moneytoo committed Jun 14, 2022
1 parent 0ccfdb6 commit dad2162
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/src/main/java/com/brouken/player/PlayerActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.brouken.player;

import static android.content.pm.PackageManager.FEATURE_EXPANDED_PICTURE_IN_PICTURE;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.SuppressLint;
Expand Down Expand Up @@ -2067,7 +2069,11 @@ private void enterPiP() {
}

Rational rational = Utils.getRational(format);
// TODO: Android 13: Use setExpandedAspectRatio
if (Build.VERSION.SDK_INT >= 33 &&
getPackageManager().hasSystemFeature(FEATURE_EXPANDED_PICTURE_IN_PICTURE) &&
(rational.floatValue() > rationalLimitWide.floatValue() || rational.floatValue() < rationalLimitTall.floatValue())) {
((PictureInPictureParams.Builder)mPictureInPictureParamsBuilder).setExpandedAspectRatio(rational);
}
if (rational.floatValue() > rationalLimitWide.floatValue())
rational = rationalLimitWide;
else if (rational.floatValue() < rationalLimitTall.floatValue())
Expand Down

0 comments on commit dad2162

Please sign in to comment.