mirror of
https://github.com/null2264/yokai.git
synced 2025-06-20 18:24:42 +00:00
chore: Vivo notch (pre-Android P) internal API [skip ci]
This commit is contained in:
parent
4a8cf8d24d
commit
fb6ee8271f
1 changed files with 16 additions and 0 deletions
|
@ -159,6 +159,22 @@ object DeviceUtil {
|
|||
}
|
||||
CutoutSupport.LEGACY -> {
|
||||
if (isVivo) {
|
||||
/*
|
||||
// REF: https://github.com/SivanLiu/VivoFramework/blob/8d31381e/Vivo_y93/src/main/java/android/util/FtDeviceInfo.java#L28-L30
|
||||
try {
|
||||
@SuppressLint("PrivateApi")
|
||||
val ftDeviceInfo = context?.classLoader
|
||||
?.loadClass("android.util.FtDeviceInfo")
|
||||
val getEarHeightMethod = ftDeviceInfo?.getMethod(
|
||||
"getEarHeight",
|
||||
Context::class.java
|
||||
)
|
||||
val notchHeight = getEarHeightMethod?.invoke(ftDeviceInfo, context) as Int
|
||||
} catch (_: Exception) {
|
||||
// fallback
|
||||
}
|
||||
*/
|
||||
|
||||
val insetCompat = context?.window?.decorView?.rootWindowInsets?.let {
|
||||
WindowInsetsCompat.toWindowInsetsCompat(it)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue