Skip to content

Commit

Permalink
add: enable tablet ui on tvs and add FEATURE_LEANBACK check for tv de…
Browse files Browse the repository at this point in the history
…tection
  • Loading branch information
hollowshiroyuki committed May 31, 2024
1 parent 6489ccf commit 6d642cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fun Context.prepareTabletUiContext(): Context {
val configuration = resources.configuration
val expected = when (Injekt.get<UiPreferences>().tabletUiMode().get()) {
TabletUiMode.AUTOMATIC ->
isTvBox(this) ||
configuration.smallestScreenWidthDp >= when (configuration.orientation) {
Configuration.ORIENTATION_PORTRAIT -> TABLET_UI_MIN_SCREEN_WIDTH_PORTRAIT_DP
else -> TABLET_UI_MIN_SCREEN_WIDTH_LANDSCAPE_DP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fun isTvBox(context: Context): Boolean {

// TV for sure
if (
pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK) ||
context.getSystemService(UiModeManager::class.java)
.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION
) {
Expand Down

0 comments on commit 6d642cb

Please sign in to comment.