diff --git a/app/src/main/java/com/jerboa/db/AppDB.kt b/app/src/main/java/com/jerboa/db/AppDB.kt index 04cc98c79..525aab85d 100644 --- a/app/src/main/java/com/jerboa/db/AppDB.kt +++ b/app/src/main/java/com/jerboa/db/AppDB.kt @@ -15,6 +15,7 @@ import kotlinx.coroutines.launch import java.util.concurrent.Executors const val DEFAULT_FONT_SIZE = 16 +const val DEFAULT_OP_COMMENT_BADGE_RADIUS = 4 const val UPDATE_APP_CHANGELOG_UNVIEWED = "UPDATE AppSettings SET viewed_changelog = 0" @Entity @@ -74,6 +75,11 @@ data class AppSettings( defaultValue = "0", ) val showCollapsedCommentContent: Boolean, + @ColumnInfo( + name = "op_comment_badge_radius", + defaultValue = DEFAULT_OP_COMMENT_BADGE_RADIUS.toString(), + ) + val opCommentBadgeRadius: Int ) @Dao diff --git a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt index 4c09eb85c..d61fe3c08 100644 --- a/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt +++ b/app/src/main/java/com/jerboa/ui/components/settings/lookandfeel/LookAndFeelActivity.kt @@ -28,6 +28,7 @@ import com.jerboa.ThemeMode import com.jerboa.db.AppSettings import com.jerboa.db.AppSettingsViewModel import com.jerboa.db.DEFAULT_FONT_SIZE +import com.jerboa.db.DEFAULT_OP_COMMENT_BADGE_RADIUS import com.jerboa.ui.components.common.SimpleTopAppBar @OptIn(ExperimentalMaterial3Api::class) @@ -49,7 +50,10 @@ fun LookAndFeelActivity( val showBottomNavState = rememberBooleanSettingState(settings?.showBottomNav ?: true) val showCollapsedCommentContentState = rememberBooleanSettingState(settings?.showCollapsedCommentContent ?: false) - + val opCommentBadgeRadiusState = rememberFloatSettingState( + settings?.opCommentBadgeRadius?.toFloat() + ?: DEFAULT_OP_COMMENT_BADGE_RADIUS.toFloat(), + ) val snackbarHostState = remember { SnackbarHostState() } fun updateAppSettings() { @@ -63,6 +67,7 @@ fun LookAndFeelActivity( postViewMode = postViewModeState.value, showBottomNav = showBottomNavState.value, showCollapsedCommentContent = showCollapsedCommentContentState.value, + opCommentBadgeRadius = opCommentBadgeRadiusState.value.toInt(), ), ) } @@ -154,6 +159,20 @@ fun LookAndFeelActivity( }, onCheckedChange = { updateAppSettings() }, ) + SettingsSlider( + valueRange = 0f..20f, + state = opCommentBadgeRadiusState, + icon = { + Icon( + imageVector = Icons.Outlined.FormatSize, + contentDescription = "TODO", + ) + }, + title = { + Text(text = "OP comment badge radius: ${opCommentBadgeRadiusState.value.toInt()}") + }, + onValueChangeFinished = { updateAppSettings() }, + ) } }, )