Skip to content

Commit

Permalink
Simple refactoring to newer versions of the clickable text
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpamplona committed Dec 5, 2024
1 parent 0dd306b commit 51ce509
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
*/
package com.vitorpamplona.amethyst.ui.note.elements

import androidx.compose.foundation.text.ClickableText
import androidx.compose.foundation.clickable
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
Expand All @@ -34,7 +35,7 @@ import com.vitorpamplona.amethyst.ui.theme.placeholderText

@Composable
fun DisplayEditStatus(editState: EditState) {
ClickableText(
Text(
text =
buildAnnotatedString {
if (editState.showingVersion.value == editState.originalVersionId()) {
Expand All @@ -45,15 +46,12 @@ fun DisplayEditStatus(editState: EditState) {
append(stringRes(id = R.string.edited_number, editState.versionId()))
}
},
onClick = {
editState.nextModification()
},
style =
LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.placeholderText,
fontWeight = FontWeight.Bold,
),
maxLines = 1,
modifier = HalfStartPadding,
modifier = HalfStartPadding.clickable { editState.nextModification() },
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,7 @@ class AccountViewModel(
}
}

fun markDonatedInThisVersion() {
account.markDonatedInThisVersion()
}
fun markDonatedInThisVersion() = account.markDonatedInThisVersion()

fun dontTranslateFrom() = account.settings.syncedSettings.languages.dontTranslateFrom

Expand Down

0 comments on commit 51ce509

Please sign in to comment.