PipUtils.java
978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.wd.common.utils;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;
/**
* Time:2023/5/17
* Author:ypf
* Description:画中画工具类
*/
public class PipUtils {
/**
* 判断是否支持画中画
*
* @return 是否支持画中画
*/
public static boolean supportPictureInPicture(Activity activity) {
if (activity == null) {
return false;
}
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && activity.getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE);
}
/**
* 判断当前是否处于小窗模式
*
* @return 是否支持画中画
*/
public static boolean isInPictureInPictureMode(Activity activity) {
if (activity == null) {
return false;
}
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && activity.isInPictureInPictureMode();
}
}