-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vector to MediaComposition call. (#220)
Co-authored-by: Walid Kayhal <[email protected]>
- Loading branch information
Showing
3 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...siness/src/main/java/ch/srgssr/pillarbox/core/business/integrationlayer/service/Vector.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2023. SRG SSR. All rights reserved. | ||
* License information is available from the LICENSE file. | ||
*/ | ||
package ch.srgssr.pillarbox.core.business.integrationlayer.service | ||
|
||
import android.content.Context | ||
import android.content.res.Configuration | ||
|
||
/** | ||
* Vector | ||
*/ | ||
object Vector { | ||
/** | ||
* TV vector | ||
*/ | ||
const val TV = "TVPLAY" | ||
|
||
/** | ||
* Mobile vector | ||
*/ | ||
const val MOBILE = "APPPLAY" | ||
|
||
/** | ||
* Get vector | ||
* | ||
* @return vector for MediaCompositionService. | ||
*/ | ||
fun Context.getVector(): String { | ||
val uiMode = resources.configuration.uiMode | ||
return if (uiMode and Configuration.UI_MODE_TYPE_MASK == Configuration.UI_MODE_TYPE_TELEVISION) { | ||
TV | ||
} else { | ||
MOBILE | ||
} | ||
} | ||
} |