0.129 P3: EffectCraft switch motion, VectorCraft Settings icons, FigCraft layout prototypes
- Switches slide in 160 ms on Orbit's curve (designed in EffectCraft, design/motion/switch); Reduce motion: no slide, 120 ms fade. The setting changes on the press; the animation never holds it up. - Family, Rooms (TV and phone) and Account get their own icons (design/interface/build-settings-icons.py) - Orbit Simple and Retro Cable prototypes for approval (design/layouts), not in the app Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -164,9 +164,9 @@ internal class OrbitSettings(context: Context) {
|
||||
internal enum class SettingsSection(val label: String, val line: String, val icon: Int) {
|
||||
Channels("Channels", "Turn on, make your own, suggestions", R.drawable.orbit_icon_all),
|
||||
OnScreen("On screen", "Look, subtitles, the cast, motion", R.drawable.orbit_icon_entertainment),
|
||||
Family("Family", "Profiles, PIN, Kids, Wind Down", R.drawable.orbit_icon_profile),
|
||||
Rooms("Rooms and phones", "Other TVs and paired phones", R.drawable.orbit_icon_movies),
|
||||
Account("Account", "Server, sign-in, version", R.drawable.orbit_icon_profile),
|
||||
Family("Family", "Profiles, PIN, Kids, Wind Down", R.drawable.orbit_icon_family),
|
||||
Rooms("Rooms and phones", "Other TVs and paired phones", R.drawable.orbit_icon_rooms),
|
||||
Account("Account", "Server, sign-in, version", R.drawable.orbit_icon_account),
|
||||
}
|
||||
|
||||
/** The heading a channel number sits under, matching the blocks in the guide. */
|
||||
@@ -212,17 +212,30 @@ private fun SettingLine(title: String, detail: String, button: @Composable () ->
|
||||
}
|
||||
}
|
||||
|
||||
/** A switch: a pill, green and to the right when on. Focus rings it in the look's accent. */
|
||||
/**
|
||||
* A switch: a pill, green and to the right when on. Focus rings it in the look's accent.
|
||||
* Motion (0.129 stage 3, from design/motion/switch, made in EffectCraft): the thumb slides and the track turns in 160 ms on
|
||||
* Orbit's one curve. The press acts at once: [onClick] runs before any of it, and a second press mid-slide just turns it
|
||||
* round. With Reduce motion the thumb jumps and only the colour fades, in 120 ms.
|
||||
*/
|
||||
@Composable
|
||||
internal fun OnOff(on: Boolean, modifier: Modifier = Modifier, enabled: Boolean = true, onClick: () -> Unit) {
|
||||
var focused by remember { mutableStateOf(false) }
|
||||
val track = if (on) themed(Color(0xFF6EDCAA)) { Mint } else themed(Color(0xFF283C64)) { Blue }
|
||||
val target = if (on) themed(Color(0xFF6EDCAA)) { Mint } else themed(Color(0xFF283C64)) { Blue }
|
||||
val calm = Motion.reduce
|
||||
val track by androidx.compose.animation.animateColorAsState(target,
|
||||
androidx.compose.animation.core.tween(if (calm) Motion.CALM else SWITCH_MS, easing = Motion.Ease), label = "switch track")
|
||||
val along by androidx.compose.animation.core.animateFloatAsState(if (on) 1f else 0f,
|
||||
if (calm) androidx.compose.animation.core.snap() else androidx.compose.animation.core.tween(SWITCH_MS, easing = Motion.Ease), label = "switch thumb")
|
||||
Box(modifier.onFocusChanged { focused = it.isFocused }.size(64.dp, 34.dp).border(if (focused) 3.dp else 0.dp, if (focused) Yellow else Color.Transparent, RoundedCornerShape(17.dp))
|
||||
.padding(3.dp).clip(RoundedCornerShape(14.dp)).background(track.copy(alpha = if (enabled) 1f else .5f)).clickable(enabled = enabled, onClick = onClick)
|
||||
.semantics { stateDescription = if (on) "On" else "Off" }, contentAlignment = if (on) Alignment.CenterEnd else Alignment.CenterStart) {
|
||||
Box(Modifier.padding(horizontal = 4.dp).size(20.dp).clip(androidx.compose.foundation.shape.CircleShape).background(Color.White))
|
||||
.semantics { stateDescription = if (on) "On" else "Off" }, contentAlignment = Alignment.CenterStart) {
|
||||
// 58 dp inside, 4 dp either side, a 20 dp thumb: 30 dp of travel.
|
||||
Box(Modifier.offset(x = 30.dp * along).padding(horizontal = 4.dp).size(20.dp).clip(androidx.compose.foundation.shape.CircleShape).background(Color.White))
|
||||
}
|
||||
}
|
||||
/** How long the switch takes to slide, as in the EffectCraft design. */
|
||||
internal const val SWITCH_MS = 160
|
||||
|
||||
/** A card above the channel list: one of the cast, what it opens, and a line on what it's for. */
|
||||
@Composable
|
||||
|
||||
@@ -235,9 +235,16 @@ private fun ToggleRow(title: String, on: Boolean, modifier: Modifier = Modifier,
|
||||
}
|
||||
Text(if (on) "On" else "Off", color = if (on) ArcadeColours.Ink else ArcadeColours.Muted, fontSize = 13.sp, fontWeight = if (on) FontWeight.Bold else FontWeight.Normal)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Box(Modifier.size(36.dp, 18.dp).background(if (on) ArcadeColours.Cyan else ArcadeColours.Night, RoundedCornerShape(9.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(9.dp)).padding(2.dp),
|
||||
contentAlignment = if (on) Alignment.CenterEnd else Alignment.CenterStart) {
|
||||
Box(Modifier.size(14.dp).background(ArcadeColours.Ink, RoundedCornerShape(7.dp)))
|
||||
// The same motion as Orbit's settings switch (EffectCraft design, design/motion/switch): 160 ms slide and colour; with
|
||||
// Reduce motion, no slide and a 120 ms fade. The setting has already changed when it starts.
|
||||
val calm = tv.orbit.classic.Motion.reduce
|
||||
val track by androidx.compose.animation.animateColorAsState(if (on) ArcadeColours.Cyan else ArcadeColours.Night,
|
||||
androidx.compose.animation.core.tween(if (calm) tv.orbit.classic.Motion.CALM else tv.orbit.classic.SWITCH_MS, easing = tv.orbit.classic.Motion.Ease), label = "toggle track")
|
||||
val along by androidx.compose.animation.core.animateFloatAsState(if (on) 1f else 0f,
|
||||
if (calm) androidx.compose.animation.core.snap() else androidx.compose.animation.core.tween(tv.orbit.classic.SWITCH_MS, easing = tv.orbit.classic.Motion.Ease), label = "toggle thumb")
|
||||
Box(Modifier.size(36.dp, 18.dp).background(track, RoundedCornerShape(9.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(9.dp)).padding(2.dp),
|
||||
contentAlignment = Alignment.CenterStart) {
|
||||
Box(Modifier.offset(x = 18.dp * along).size(14.dp).background(ArcadeColours.Ink, RoundedCornerShape(7.dp)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user