Channel badges: flat Material star (default) + heart (favorite) icons instead of text glyphs, so favorites no longer look like the default channel
This commit is contained in:
1 parent
f5e39c0752
commit
5b9427b10d
1 file changed
+32
-2
@@ -42,7 +42,9 @@ import androidx.compose.foundation.text.KeyboardActions
|
|||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.filled.Favorite
|
||||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||||
|
import androidx.compose.material.icons.filled.Star
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
@@ -1080,6 +1082,32 @@ private fun IconImage(base64: String, size: Dp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trailing badges for a channel row: a star marks the default (home) channel,
|
||||||
|
* a heart marks a favorited channel. A channel that is both shows both.
|
||||||
|
*/
|
||||||
|
@Composable
|
||||||
|
private fun ChannelBadges(ch: ChannelInfo) {
|
||||||
|
if (ch.isDefault) {
|
||||||
|
Spacer(modifier = Modifier.width(4.dp))
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Star,
|
||||||
|
contentDescription = "Default channel",
|
||||||
|
modifier = Modifier.size(14.dp),
|
||||||
|
tint = IrisColors.textMuted,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (ch.favorite) {
|
||||||
|
Spacer(modifier = Modifier.width(4.dp))
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Filled.Favorite,
|
||||||
|
contentDescription = "Favorited",
|
||||||
|
modifier = Modifier.size(14.dp),
|
||||||
|
tint = IrisColors.textMuted,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Long-press / right-click context menu for a channel row: rename, favorite
|
* Long-press / right-click context menu for a channel row: rename, favorite
|
||||||
* (state-aware), icon (state-aware), delete. The default channel cannot be
|
* (state-aware), icon (state-aware), delete. The default channel cannot be
|
||||||
@@ -1234,12 +1262,13 @@ private fun ChannelDrawer(
|
|||||||
ChannelAvatar(ch, 28.dp)
|
ChannelAvatar(ch, 28.dp)
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
Text(
|
Text(
|
||||||
ch.name + if (ch.isDefault || ch.favorite) " ★" else "",
|
ch.name,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
)
|
)
|
||||||
|
ChannelBadges(ch)
|
||||||
}
|
}
|
||||||
ChannelContextMenu(
|
ChannelContextMenu(
|
||||||
expanded = menuOpen,
|
expanded = menuOpen,
|
||||||
@@ -1353,13 +1382,14 @@ private fun ChannelRail(
|
|||||||
ChannelAvatar(ch, 28.dp)
|
ChannelAvatar(ch, 28.dp)
|
||||||
Spacer(modifier = Modifier.width(8.dp))
|
Spacer(modifier = Modifier.width(8.dp))
|
||||||
Text(
|
Text(
|
||||||
ch.name + if (ch.isDefault || ch.favorite) " ★" else "",
|
ch.name,
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
color = if (isCurrent) IrisColors.primary else IrisColors.onSurface,
|
color = if (isCurrent) IrisColors.primary else IrisColors.onSurface,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
)
|
)
|
||||||
|
ChannelBadges(ch)
|
||||||
}
|
}
|
||||||
ChannelContextMenu(
|
ChannelContextMenu(
|
||||||
expanded = menuOpen,
|
expanded = menuOpen,
|
||||||
|
|||||||
Reference in new issue
Block a user