mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-06-14 09:00:04 +02:00
7551f0104c
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
52 lines
1.4 KiB
Kotlin
52 lines
1.4 KiB
Kotlin
package app.revanced.integrations.shared
|
|
|
|
import app.revanced.integrations.utils.Event
|
|
|
|
/**
|
|
* WatchWhile player type
|
|
*/
|
|
@Suppress("unused")
|
|
enum class PlayerType {
|
|
NONE, // this also includes when shorts are playing
|
|
HIDDEN,
|
|
WATCH_WHILE_MINIMIZED,
|
|
WATCH_WHILE_MAXIMIZED,
|
|
WATCH_WHILE_FULLSCREEN,
|
|
WATCH_WHILE_SLIDING_MAXIMIZED_FULLSCREEN,
|
|
WATCH_WHILE_SLIDING_MINIMIZED_MAXIMIZED,
|
|
WATCH_WHILE_SLIDING_MINIMIZED_DISMISSED,
|
|
WATCH_WHILE_SLIDING_FULLSCREEN_DISMISSED,
|
|
INLINE_MINIMAL,
|
|
VIRTUAL_REALITY_FULLSCREEN,
|
|
WATCH_WHILE_PICTURE_IN_PICTURE;
|
|
|
|
companion object {
|
|
/**
|
|
* safely parse from a string
|
|
*
|
|
* @param name the name to find
|
|
* @return the enum constant, or null if not found
|
|
*/
|
|
@JvmStatic
|
|
fun safeParseFromString(name: String): PlayerType? {
|
|
return values().firstOrNull { it.name == name }
|
|
}
|
|
|
|
/**
|
|
* the current player type, as reported by [app.revanced.integrations.patches.PlayerTypeHookPatch.YouTubePlayerOverlaysLayout_updatePlayerTypeHookEX]
|
|
*/
|
|
@JvmStatic
|
|
var current
|
|
get() = currentPlayerType
|
|
set(value) {
|
|
currentPlayerType = value
|
|
onChange(currentPlayerType)
|
|
}
|
|
private var currentPlayerType = NONE
|
|
|
|
/**
|
|
* player type change listener
|
|
*/
|
|
val onChange = Event<PlayerType>()
|
|
}
|
|
} |