mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
Add display choice to Android app launches
This commit is contained in:
1 parent
6a23556c03
commit
288e59e865
7 files changed
+167
-26
No files matched your search
@@ -1,5 +1,8 @@
|
||||
package com.droiddeck.launcher.input
|
||||
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.view.Display
|
||||
|
||||
/** The control surface shown on a secondary Android display during a Linux session. */
|
||||
enum class SecondScreenMode(val id: String, val label: String) {
|
||||
NONE("none", "None"),
|
||||
@@ -8,3 +11,19 @@ enum class SecondScreenMode(val id: String, val label: String) {
|
||||
}
|
||||
|
||||
data class SecondScreenDisplay(val id: Int, val label: String)
|
||||
|
||||
/** The presentation-capable displays shared by the session controls and Android app launcher. */
|
||||
object SecondScreenDisplays {
|
||||
fun available(displayManager: DisplayManager, primaryDisplayId: Int = Display.DEFAULT_DISPLAY): List<SecondScreenDisplay> =
|
||||
displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION)
|
||||
.asSequence()
|
||||
.filter { it.isValid && it.displayId != primaryDisplayId && (it.flags and Display.FLAG_PRESENTATION) != 0 }
|
||||
.map { target ->
|
||||
val mode = target.mode
|
||||
SecondScreenDisplay(
|
||||
target.displayId,
|
||||
"${target.name} · ${mode.physicalWidth}×${mode.physicalHeight}",
|
||||
)
|
||||
}
|
||||
.toList()
|
||||
}
|
||||
Reference in new issue
Block a user