forked from Blendman974/faceclaw
Unify vertical position and display mode settings; add to onboarding
This commit is contained in:
1 parent
6b1e64c5ac
commit
5a9ca08921
36 files changed
+810
-574
No files matched your search
@@ -69,20 +69,6 @@ object Command {
|
||||
const val CONNECT = "connect"
|
||||
const val DISCONNECT = "disconnect"
|
||||
const val CLOSE_ASSISTANT = "close-assistant"
|
||||
const val DISPLAY_MODE = "display-mode"
|
||||
}
|
||||
|
||||
/** The glasses' display modes, mirroring the phone's Display > Display mode. */
|
||||
enum class DisplayMode(val wire: String, val label: String) {
|
||||
BAND("576x288", "Band · 576×288"),
|
||||
TALL("576x480", "Tall · 576×480"),
|
||||
FULL("640x480", "Full panel · 640×480");
|
||||
|
||||
fun next(): DisplayMode = entries[(ordinal + 1) % entries.size]
|
||||
|
||||
companion object {
|
||||
fun fromWire(value: String): DisplayMode? = entries.firstOrNull { it.wire == value }
|
||||
}
|
||||
}
|
||||
|
||||
data class AppEntry(val appId: String, val title: String)
|
||||
@@ -106,8 +92,6 @@ data class PhoneState(
|
||||
val locked: Boolean,
|
||||
val worn: Boolean?,
|
||||
val listening: Boolean,
|
||||
/** Display mode wire value ("576x288" | "576x480" | "640x480"). */
|
||||
val displayMode: String,
|
||||
/** Current or last-known G2 charge percentage. */
|
||||
val battery: Int?,
|
||||
val charging: Boolean,
|
||||
@@ -137,7 +121,6 @@ data class PhoneState(
|
||||
locked = o.optBoolean("locked", false),
|
||||
worn = if (o.isNull("worn")) null else o.optBoolean("worn"),
|
||||
listening = o.optBoolean("listening", false),
|
||||
displayMode = o.optString("displayMode", "576x288"),
|
||||
battery = if (o.isNull("battery")) null else o.optInt("battery", -1).takeIf { it in 0..100 },
|
||||
charging = o.optBoolean("charging", false),
|
||||
silentMode = o.optBoolean("silentMode", false),
|
||||
|
||||
@@ -21,7 +21,6 @@ import androidx.wear.compose.material.Scaffold
|
||||
import androidx.wear.compose.material.Text
|
||||
import androidx.wear.compose.material.TimeText
|
||||
import com.faceclaw.wear.Command
|
||||
import com.faceclaw.wear.DisplayMode
|
||||
import com.faceclaw.wear.Haptics
|
||||
import com.faceclaw.wear.PhoneLink
|
||||
import com.faceclaw.wear.R
|
||||
@@ -101,20 +100,6 @@ fun StatusScreen(link: PhoneLink, haptics: Haptics, onOpenSettings: () -> Unit)
|
||||
enabled = connected && !(locked && state?.canUnlock == false),
|
||||
)
|
||||
}
|
||||
item {
|
||||
val mode = DisplayMode.fromWire(state?.displayMode ?: "") ?: DisplayMode.BAND
|
||||
Chip(
|
||||
onClick = {
|
||||
haptics.click()
|
||||
link.sendCommand(Command.DISPLAY_MODE, "value" to mode.next().wire)
|
||||
},
|
||||
label = { Text("Display mode") },
|
||||
secondaryLabel = { Text(mode.label) },
|
||||
colors = ChipDefaults.secondaryChipColors(),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
enabled = connected,
|
||||
)
|
||||
}
|
||||
state?.foreground?.let { foreground ->
|
||||
item {
|
||||
Chip(
|
||||
|
||||
Reference in new issue
Block a user