Skip to content

Commit de84e98

Browse files
feat: add trailing chevron for submenu links in list mode (#2303)
The 14 dp link badge on the circle's corner reads fine in ring mode but is easy to miss on wide list rows where the eye is on the label. List mode now drops the corner badge and renders a quiet trailing KeyboardArrowRight chevron at the right edge of the row instead — the standard list-item affordance for "opens another screen." The previous-menu (back) item carries isLinkToMenu = true alongside isBackButton = true, so the chevron is suppressed for back buttons: its back-arrow icon and secondaryContainer circle already say what it does, and a forward-pointing chevron next to a back arrow would point the wrong way. Ring mode is untouched. Closes #2302 Co-authored-by: Owen McGirr <o.a.mcgirr@gmail.com>
1 parent 244c50e commit de84e98

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

  • app/src/main/java/com/enaboapps/switchify/service/menu

app/src/main/java/com/enaboapps/switchify/service/menu/MenuItem.kt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import androidx.compose.foundation.layout.size
1717
import androidx.compose.foundation.layout.width
1818
import androidx.compose.foundation.shape.CircleShape
1919
import androidx.compose.foundation.shape.RoundedCornerShape
20+
import androidx.compose.material.icons.Icons
21+
import androidx.compose.material.icons.automirrored.rounded.KeyboardArrowRight
2022
import androidx.compose.material3.Icon
2123
import androidx.compose.material3.MaterialTheme
2224
import androidx.compose.material3.Text
@@ -359,6 +361,12 @@ private fun RegularMenuItemList(
359361
// each item reads as a tappable tile. Outer vertical padding creates a
360362
// visible gap between adjacent row backgrounds; the clip ensures the
361363
// ripple respects the rounded shape.
364+
//
365+
// Link-to-submenu items get a trailing chevron at the row's right edge
366+
// instead of the circle's corner badge — chevron is the conventional
367+
// list affordance and is aligned with the label rather than competing
368+
// with the colored circle. The corner badge stays for ring mode where
369+
// there's nowhere else to put it.
362370
Row(
363371
modifier = Modifier
364372
.fillMaxSize()
@@ -376,16 +384,29 @@ private fun RegularMenuItemList(
376384
labelResource = labelResource,
377385
menuSize = menuSize,
378386
isBackButton = isBackButton,
379-
isLinkToMenu = isLinkToMenu
387+
isLinkToMenu = false
380388
)
381389
Spacer(modifier = Modifier.width(12.dp))
382390
Text(
383391
text = text.orEmpty(),
384392
color = MaterialTheme.colorScheme.onSurfaceVariant,
385393
fontSize = menuSize.headerLabelTextSize,
386394
maxLines = 2,
387-
overflow = TextOverflow.Ellipsis
395+
overflow = TextOverflow.Ellipsis,
396+
modifier = Modifier.weight(1f)
388397
)
398+
// The back-button item carries `isLinkToMenu = true` too (it links
399+
// to the previous menu), but a forward-pointing chevron next to its
400+
// back-arrow icon would point the wrong way. The secondaryContainer
401+
// circle and back-arrow icon already communicate the action.
402+
if (isLinkToMenu && !isBackButton) {
403+
Icon(
404+
imageVector = Icons.AutoMirrored.Rounded.KeyboardArrowRight,
405+
contentDescription = null,
406+
modifier = Modifier.size(24.dp),
407+
tint = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f)
408+
)
409+
}
389410
}
390411
}
391412

0 commit comments

Comments
 (0)