fix(podcasts): compact bookmark button, drop the confirmation toast

- The bookmark toggle was a Material IconButton (48dp minimum touch
  target), so it stood taller than the titleLarge line it sits beside and
  broke the side-by-side alignment. Render it as a compact clickable glyph
  sized to a single title line (iconSize, default 20dp) so title and button
  align.
- Drop the add/remove toast — the icon flipping filled/outline is enough
  feedback — and remove the now-unused strings.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JGa1EM5KWyDo1o5Yr6sS18
This commit is contained in:
Claude
2026-07-01 14:27:40 +00:00
parent 056d54434e
commit a61ec2911c
2 changed files with 32 additions and 15 deletions
@@ -20,12 +20,21 @@
*/
package com.vitorpamplona.amethyst.ui.note.types
import androidx.compose.material3.IconButton
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.vitorpamplona.amethyst.R
import com.vitorpamplona.amethyst.commons.icons.symbols.Icon
@@ -44,13 +53,18 @@ import com.vitorpamplona.amethyst.ui.stringRes
*
* Bookmarked state is read from the public bookmark id/address **sets** (not `List<Note>`
* containment) so it reflects reliably for addressable notes and updates the moment the list
* changes; a toast confirms each add/remove so the action is never silent.
* changes — the icon flipping filled/outline is the feedback, no toast needed.
*
* Rendered as a compact clickable glyph (not a Material [androidx.compose.material3.IconButton],
* whose 48dp minimum touch target would stand taller than the title it sits beside). [iconSize]
* defaults to a single title line so it aligns when placed next to a show/episode title.
*/
@Composable
fun PodcastBookmarkButton(
note: Note,
accountViewModel: AccountViewModel,
modifier: Modifier = Modifier,
iconSize: Dp = 20.dp,
) {
val bookmarkState = accountViewModel.account.bookmarkState
@@ -66,17 +80,21 @@ fun PodcastBookmarkButton(
}
}
IconButton(
onClick = {
if (isBookmarked) {
accountViewModel.removePublicBookmark(note)
accountViewModel.toastManager.toast(R.string.bookmarks_title, R.string.podcast_bookmark_removed)
} else {
accountViewModel.addPublicBookmark(note)
accountViewModel.toastManager.toast(R.string.bookmarks_title, R.string.podcast_bookmark_added)
}
},
modifier = modifier,
Box(
modifier =
modifier
.clip(CircleShape)
.clickable(
role = Role.Button,
onClick = {
if (isBookmarked) {
accountViewModel.removePublicBookmark(note)
} else {
accountViewModel.addPublicBookmark(note)
}
},
).padding(4.dp),
contentAlignment = Alignment.Center,
) {
Icon(
symbol = if (isBookmarked) MaterialSymbols.Bookmark else MaterialSymbols.BookmarkAdd,
@@ -85,6 +103,7 @@ fun PodcastBookmarkButton(
if (isBookmarked) R.string.remove_from_public_bookmarks else R.string.add_to_public_bookmarks,
),
tint = if (isBookmarked) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.size(iconSize),
)
}
}
-2
View File
@@ -1011,8 +1011,6 @@
<string name="podcast_value_for_value">Value-for-Value</string>
<string name="podcast_value_split_percent">%1$d%%</string>
<string name="podcast_value_zap_split_hint">Zaps to this are split between:</string>
<string name="podcast_bookmark_added">Added to your bookmarks</string>
<string name="podcast_bookmark_removed">Removed from your bookmarks</string>
<string name="podcast_role_host">Host</string>
<string name="podcast_role_cohost">Co-host</string>
<string name="podcast_role_editor">Editor</string>