|
@@ -20,10 +20,10 @@ import java.util.Date
|
|
|
object ContextExt {
|
|
object ContextExt {
|
|
|
|
|
|
|
|
val Context.isTV: Boolean
|
|
val Context.isTV: Boolean
|
|
|
- get() {
|
|
|
|
|
|
|
+ get() = runCatching {
|
|
|
val uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
|
|
val uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
|
|
|
return uiModeManager.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION
|
|
return uiModeManager.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION
|
|
|
- }
|
|
|
|
|
|
|
+ }.getOrNull() ?: false
|
|
|
|
|
|
|
|
val Context.timeAsString: String
|
|
val Context.timeAsString: String
|
|
|
get() = DateFormat.getTimeFormat(this).format(Date())
|
|
get() = DateFormat.getTimeFormat(this).format(Date())
|