Skip to content

Commit

Permalink
Show picture in picture settings screen when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
simoarpe committed Dec 17, 2024
1 parent 26fc7a1 commit 2c21d51
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
package org.chromium.chrome.browser.tabbed_mode;

import static org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher.ActivityState.RESUMED_WITH_NATIVE;
import static org.chromium.chrome.browser.util.PictureInPictureUtils.deviceSupportedPictureInPictureMode;
import static org.chromium.chrome.browser.util.PictureInPictureUtils.hasPictureInPicturePermissionEnabled;
import static org.chromium.chrome.browser.util.PictureInPictureUtils.launchPictureInPictureSettings;

import android.app.PictureInPictureParams;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
Expand Down Expand Up @@ -211,11 +213,16 @@ public void onFullscreenClick() {

@Override
public void onPictureInPictureClick() {
if (!mActivity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) {
if (!deviceSupportedPictureInPictureMode(mActivity)) {
Toast.makeText(mActivity, R.string.picture_in_picture_not_supported, Toast.LENGTH_LONG).show();
return;
}

if (!hasPictureInPicturePermissionEnabled(mActivity)) {
launchPictureInPictureSettings(mActivity);
return;
}

final Tab currentTab = mTabModelSelectorSupplier.get().getCurrentTab();
//noinspection ConstantValue
if (TabUtils.isYouTubeVideo(currentTab) && mActivity instanceof BraveActivity braveActivity) {
Expand Down

0 comments on commit 2c21d51

Please sign in to comment.