mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-06-05 23:34:59 -06:00
android: prioritize non-built-in displays (#1667)
This commit is contained in:
parent
656ab12542
commit
15e06bd000
@ -50,7 +50,7 @@ class SecondaryDisplay(val context: Context) : DisplayManager.DisplayListener {
|
|||||||
val currentDisplayId = context.display.displayId
|
val currentDisplayId = context.display.displayId
|
||||||
val displays = dm.displays
|
val displays = dm.displays
|
||||||
val presDisplays = dm.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
|
val presDisplays = dm.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
|
||||||
return displays.firstOrNull {
|
val extDisplays = displays.filter {
|
||||||
val isPresentable = presDisplays.any { pd -> pd.displayId == it.displayId }
|
val isPresentable = presDisplays.any { pd -> pd.displayId == it.displayId }
|
||||||
val isNotDefaultOrPresentable = it.displayId != Display.DEFAULT_DISPLAY || isPresentable
|
val isNotDefaultOrPresentable = it.displayId != Display.DEFAULT_DISPLAY || isPresentable
|
||||||
isNotDefaultOrPresentable &&
|
isNotDefaultOrPresentable &&
|
||||||
@ -59,6 +59,10 @@ class SecondaryDisplay(val context: Context) : DisplayManager.DisplayListener {
|
|||||||
it.state != Display.STATE_OFF &&
|
it.state != Display.STATE_OFF &&
|
||||||
it.isValid
|
it.isValid
|
||||||
}
|
}
|
||||||
|
// if there is a display called Built-In Display or Built-In Screen, prioritize the OTHER screen
|
||||||
|
val selected = extDisplays.firstOrNull { ! it.name.contains("Built",true) }
|
||||||
|
?: extDisplays.firstOrNull()
|
||||||
|
return selected
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateDisplay() {
|
fun updateDisplay() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user