2022-08-28 22:48:49 +05:30
|
|
|
import Defaults
|
|
|
|
import Foundation
|
2022-08-29 18:11:21 +05:30
|
|
|
#if os(iOS)
|
|
|
|
import UIKit
|
|
|
|
#endif
|
2022-08-28 22:48:49 +05:30
|
|
|
|
|
|
|
enum PlayerControlsLayout: String, CaseIterable, Defaults.Serializable {
|
2022-08-29 03:51:12 +05:30
|
|
|
case tvRegular
|
2022-08-28 22:48:49 +05:30
|
|
|
case veryLarge
|
|
|
|
case large
|
|
|
|
case medium
|
|
|
|
case small
|
|
|
|
case smaller
|
|
|
|
|
2022-08-29 18:11:21 +05:30
|
|
|
var available: Bool {
|
|
|
|
var isATV = false
|
|
|
|
var isIPad = false
|
|
|
|
#if os(tvOS)
|
|
|
|
isATV = true
|
|
|
|
#endif
|
|
|
|
#if os(iOS)
|
|
|
|
isIPad = UIDevice.current.userInterfaceIdiom == .pad
|
|
|
|
#endif
|
|
|
|
switch self {
|
|
|
|
case .tvRegular:
|
|
|
|
return isATV
|
|
|
|
case .veryLarge:
|
|
|
|
#if os(macOS)
|
|
|
|
return true
|
|
|
|
#else
|
|
|
|
return isIPad
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case .large:
|
|
|
|
return true
|
|
|
|
case .medium:
|
|
|
|
return true
|
|
|
|
case .small:
|
|
|
|
return true
|
|
|
|
case .smaller:
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-28 22:48:49 +05:30
|
|
|
var description: String {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return "TV"
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return "Very Large"
|
|
|
|
default:
|
|
|
|
return rawValue.capitalized
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var buttonsSpacing: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 80
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 40
|
|
|
|
case .large:
|
2022-09-01 00:54:46 +05:30
|
|
|
return 25
|
2022-08-28 22:48:49 +05:30
|
|
|
case .medium:
|
|
|
|
return 25
|
|
|
|
case .small:
|
|
|
|
return 20
|
|
|
|
case .smaller:
|
|
|
|
return 20
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var buttonFontSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 48
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 35
|
|
|
|
case .large:
|
|
|
|
return 28
|
|
|
|
case .medium:
|
|
|
|
return 22
|
|
|
|
case .small:
|
|
|
|
return 18
|
|
|
|
case .smaller:
|
|
|
|
return 15
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var bigButtonFontSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 65
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 55
|
|
|
|
case .large:
|
|
|
|
return 45
|
|
|
|
case .medium:
|
|
|
|
return 35
|
|
|
|
case .small:
|
|
|
|
return 30
|
|
|
|
case .smaller:
|
|
|
|
return 25
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var buttonSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 90
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 60
|
|
|
|
case .large:
|
|
|
|
return 45
|
|
|
|
case .medium:
|
|
|
|
return 35
|
|
|
|
case .small:
|
|
|
|
return 30
|
|
|
|
case .smaller:
|
|
|
|
return 25
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var bigButtonSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 100
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 85
|
|
|
|
case .large:
|
|
|
|
return 70
|
|
|
|
case .medium:
|
|
|
|
return 60
|
|
|
|
case .small:
|
|
|
|
return 60
|
|
|
|
case .smaller:
|
|
|
|
return 60
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var segmentFontSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 20
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 16
|
|
|
|
case .large:
|
|
|
|
return 12
|
|
|
|
case .medium:
|
|
|
|
return 10
|
|
|
|
case .small:
|
|
|
|
return 9
|
|
|
|
case .smaller:
|
|
|
|
return 9
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var chapterFontSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 24
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 20
|
|
|
|
case .large:
|
|
|
|
return 16
|
|
|
|
case .medium:
|
|
|
|
return 12
|
|
|
|
case .small:
|
|
|
|
return 10
|
|
|
|
case .smaller:
|
|
|
|
return 10
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var projectedTimeFontSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 30
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 25
|
|
|
|
case .large:
|
|
|
|
return 20
|
|
|
|
case .medium:
|
|
|
|
return 15
|
|
|
|
case .small:
|
|
|
|
return 13
|
|
|
|
case .smaller:
|
|
|
|
return 11
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var thumbSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 45
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 35
|
|
|
|
case .large:
|
|
|
|
return 30
|
|
|
|
case .medium:
|
|
|
|
return 20
|
|
|
|
case .small:
|
|
|
|
return 15
|
|
|
|
case .smaller:
|
|
|
|
return 13
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var timeFontSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 45
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 35
|
|
|
|
case .large:
|
|
|
|
return 28
|
|
|
|
case .medium:
|
|
|
|
return 17
|
|
|
|
case .small:
|
|
|
|
return 13
|
|
|
|
case .smaller:
|
|
|
|
return 9
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var bufferingStateFontSize: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 45
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 30
|
|
|
|
case .large:
|
|
|
|
return 24
|
|
|
|
case .medium:
|
|
|
|
return 14
|
|
|
|
case .small:
|
|
|
|
return 10
|
|
|
|
case .smaller:
|
|
|
|
return 7
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var timeLeadingEdgePadding: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 20
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 5
|
|
|
|
case .large:
|
|
|
|
return 5
|
|
|
|
case .medium:
|
|
|
|
return 5
|
|
|
|
case .small:
|
|
|
|
return 3
|
|
|
|
case .smaller:
|
|
|
|
return 3
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var timeTrailingEdgePadding: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 20
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 16
|
|
|
|
case .large:
|
|
|
|
return 14
|
|
|
|
case .medium:
|
|
|
|
return 9
|
|
|
|
case .small:
|
|
|
|
return 6
|
|
|
|
case .smaller:
|
|
|
|
return 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var timelineHeight: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 80
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 40
|
|
|
|
case .large:
|
|
|
|
return 35
|
|
|
|
case .medium:
|
|
|
|
return 30
|
|
|
|
case .small:
|
|
|
|
return 25
|
|
|
|
case .smaller:
|
|
|
|
return 20
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var seekOSDWidth: Double {
|
|
|
|
switch self {
|
2022-08-29 03:51:12 +05:30
|
|
|
case .tvRegular:
|
|
|
|
return 240
|
2022-08-28 22:48:49 +05:30
|
|
|
case .veryLarge:
|
|
|
|
return 240
|
|
|
|
case .large:
|
|
|
|
return 200
|
|
|
|
case .medium:
|
|
|
|
return 180
|
|
|
|
case .small:
|
|
|
|
return 140
|
|
|
|
case .smaller:
|
|
|
|
return 120
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var osdVerticalOffset: Double {
|
|
|
|
buttonSize
|
|
|
|
}
|
2022-08-29 03:51:12 +05:30
|
|
|
|
|
|
|
var osdProgressBarHeight: Double {
|
|
|
|
switch self {
|
|
|
|
case .tvRegular:
|
|
|
|
return 20
|
|
|
|
case .veryLarge:
|
|
|
|
return 10
|
|
|
|
case .large:
|
|
|
|
return 8
|
|
|
|
case .medium:
|
|
|
|
return 5
|
|
|
|
case .small:
|
|
|
|
return 5
|
|
|
|
case .smaller:
|
|
|
|
return 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var osdSpacing: Double {
|
|
|
|
switch self {
|
|
|
|
case .tvRegular:
|
|
|
|
return 8
|
|
|
|
case .veryLarge:
|
|
|
|
return 8
|
|
|
|
case .large:
|
|
|
|
return 6
|
|
|
|
case .medium:
|
|
|
|
return 4
|
|
|
|
case .small:
|
|
|
|
return 2
|
|
|
|
case .smaller:
|
|
|
|
return 2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var displaysTitleLine: Bool {
|
|
|
|
self == .tvRegular
|
|
|
|
}
|
|
|
|
|
|
|
|
var titleLineFontSize: Double {
|
|
|
|
60
|
|
|
|
}
|
|
|
|
|
|
|
|
var authorLineFontSize: Double {
|
|
|
|
30
|
|
|
|
}
|
2022-08-28 22:48:49 +05:30
|
|
|
}
|