diff --git a/CHANGELOG.md b/CHANGELOG.md index 412487e6..8a14cde1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Add HTML bookmarks as an export format +* Rework widget item layout for consistent touch targets ## [1.38.0] - 2023-11-20 diff --git a/android/src/main/kotlin/dev/msfjarvis/claw/android/glance/WidgetListEntry.kt b/android/src/main/kotlin/dev/msfjarvis/claw/android/glance/WidgetListEntry.kt index f9242469..bc36fd8f 100644 --- a/android/src/main/kotlin/dev/msfjarvis/claw/android/glance/WidgetListEntry.kt +++ b/android/src/main/kotlin/dev/msfjarvis/claw/android/glance/WidgetListEntry.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2023 Harsh Shandilya. + * Copyright © 2023-2024 Harsh Shandilya. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. @@ -14,6 +14,8 @@ import androidx.compose.ui.unit.dp import androidx.glance.GlanceComposable import androidx.glance.GlanceModifier import androidx.glance.GlanceTheme +import androidx.glance.Image +import androidx.glance.ImageProvider import androidx.glance.action.ActionParameters.Key import androidx.glance.action.actionParametersOf import androidx.glance.action.actionStartActivity @@ -26,12 +28,11 @@ import androidx.glance.layout.Box import androidx.glance.layout.Row import androidx.glance.layout.fillMaxWidth import androidx.glance.layout.padding -import androidx.glance.layout.wrapContentWidth import androidx.glance.text.Text -import androidx.glance.text.TextAlign import androidx.glance.text.TextStyle import dev.msfjarvis.claw.android.MainActivity import dev.msfjarvis.claw.android.MainActivity.Companion.NAVIGATION_KEY +import dev.msfjarvis.claw.android.R import dev.msfjarvis.claw.database.local.SavedPost private val destinationKey = Key(NAVIGATION_KEY) @@ -43,7 +44,6 @@ fun WidgetListEntry( modifier: GlanceModifier = GlanceModifier, ) { val titleStyle = MaterialTheme.typography.titleMedium - val subtitleStyle = MaterialTheme.typography.labelLarge val commentsAction = actionStartActivity(actionParametersOf(destinationKey to post.shortId)) val postAction = @@ -69,21 +69,11 @@ fun WidgetListEntry( fontStyle = titleStyle.fontStyle.toGlance(), ) ) - post.commentCount?.let { count -> - Text( - text = "$count comments", - modifier = - GlanceModifier.wrapContentWidth().padding(end = 4.dp).clickable(commentsAction), - style = - TextStyle( - color = GlanceTheme.colors.onSurfaceVariant, - fontSize = subtitleStyle.fontSize, - fontWeight = subtitleStyle.fontWeight.toGlance(), - fontStyle = subtitleStyle.fontStyle.toGlance(), - textAlign = TextAlign.End, - ) - ) - } + Image( + provider = ImageProvider(R.drawable.ic_comment), + contentDescription = "${post.commentCount ?: 0} comments", + modifier = GlanceModifier.padding(end = 4.dp).clickable(commentsAction) + ) } } } diff --git a/android/src/main/res/drawable-anydpi/ic_comment.xml b/android/src/main/res/drawable-anydpi/ic_comment.xml new file mode 100644 index 00000000..702d3eb3 --- /dev/null +++ b/android/src/main/res/drawable-anydpi/ic_comment.xml @@ -0,0 +1,18 @@ + + + +