mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
pip for Android 7.0
This commit is contained in:
parent
f4d160f997
commit
e90862235a
2 changed files with 10 additions and 8 deletions
|
@ -111,7 +111,7 @@ object CommonActivity {
|
||||||
//https://stackoverflow.com/questions/52594181/how-to-know-if-user-has-disabled-picture-in-picture-feature-permission
|
//https://stackoverflow.com/questions/52594181/how-to-know-if-user-has-disabled-picture-in-picture-feature-permission
|
||||||
//https://developer.android.com/guide/topics/ui/picture-in-picture
|
//https://developer.android.com/guide/topics/ui/picture-in-picture
|
||||||
canShowPipMode =
|
canShowPipMode =
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && // OS SUPPORT
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && // OS SUPPORT
|
||||||
act.packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE) && // HAS FEATURE, MIGHT BE BLOCKED DUE TO POWER DRAIN
|
act.packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE) && // HAS FEATURE, MIGHT BE BLOCKED DUE TO POWER DRAIN
|
||||||
act.hasPIPPermission() // CHECK IF FEATURE IS ENABLED IN SETTINGS
|
act.hasPIPPermission() // CHECK IF FEATURE IS ENABLED IN SETTINGS
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import android.widget.ListView
|
||||||
import androidx.annotation.AttrRes
|
import androidx.annotation.AttrRes
|
||||||
import androidx.annotation.ColorInt
|
import androidx.annotation.ColorInt
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.appcompat.view.ContextThemeWrapper
|
import androidx.appcompat.view.ContextThemeWrapper
|
||||||
import androidx.appcompat.view.menu.MenuBuilder
|
import androidx.appcompat.view.menu.MenuBuilder
|
||||||
import androidx.appcompat.widget.PopupMenu
|
import androidx.appcompat.widget.PopupMenu
|
||||||
|
@ -365,15 +364,18 @@ object UIHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
fun Context.hasPIPPermission(): Boolean {
|
fun Context.hasPIPPermission(): Boolean {
|
||||||
val appOps =
|
val appOps =
|
||||||
getSystemService(Context.APP_OPS_SERVICE) as AppOpsManager
|
getSystemService(Context.APP_OPS_SERVICE) as AppOpsManager
|
||||||
return appOps.checkOpNoThrow(
|
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
appOps.checkOpNoThrow(
|
||||||
AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
|
AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
|
||||||
android.os.Process.myUid(),
|
android.os.Process.myUid(),
|
||||||
packageName
|
packageName
|
||||||
) == AppOpsManager.MODE_ALLOWED
|
) == AppOpsManager.MODE_ALLOWED
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hideKeyboard(view: View) {
|
fun hideKeyboard(view: View) {
|
||||||
|
|
Loading…
Reference in a new issue