Add more wootexts

This commit is contained in:
Armin Friedl 2024-02-19 00:43:50 +01:00
parent 7b68feb311
commit c7f21427e5
4 changed files with 2055 additions and 64 deletions

View file

@ -12,7 +12,10 @@ enum class Combinators(private val combinator: String): Translator{
SQUIGGLES("\u033E"), SQUIGGLES("\u033E"),
LIGHTNING("\u035B"), LIGHTNING("\u035B"),
UP_ARROWS("\u034E"), UP_ARROWS("\u034E"),
VERTICAL_BRACKETS("\u0346\u033A"); VERTICAL_BRACKETS("\u0346\u033A"),
TRIANGLE("\u20e4"),
HEARTS("\u2665"),
KEYCAP("\u20E3");
override fun translate(text: String): String { override fun translate(text: String): String {
return text return text

View file

@ -0,0 +1,20 @@
package net.friedl.android.woot.translator
enum class Formatters(private val format: String): Translator {
BRACKETS("\u3010%s\u3011"),
CORNER_BRACKETS("\u300e%s\u300f"),
SHADE("%s\u2591"),
BOXED("[\u0305\u0332%s]"),
DOUBLE_BOXED("⟦%s⟧"),
ANGLE_DOTS("⦑%s⦒"),
ORNATE("%s̤̈﴿"),
TICKED_BRACKETS("⦏%ŝ⦎"),
ZIGZAG("%s͛⦚"),
TILDES("%s≋"),
DOUBLE_TYPE("%s%s");
override fun translate(text: String): String {
return String.format(format, text)
}
}

File diff suppressed because it is too large Load diff

View file

@ -16,6 +16,9 @@ import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ClipboardManager import androidx.compose.ui.platform.ClipboardManager
@ -26,14 +29,17 @@ import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import net.friedl.android.woot.R import net.friedl.android.woot.R
import net.friedl.android.woot.translator.Combinators import net.friedl.android.woot.translator.Combinators
import net.friedl.android.woot.translator.Formatters
import net.friedl.android.woot.translator.Mappers import net.friedl.android.woot.translator.Mappers
@Composable @Composable
fun WootTextList( fun WootTextList(
text: String, text: String, modifier: Modifier = Modifier
modifier: Modifier = Modifier
) { ) {
val wootTexts = listOf(
val wootTexts by remember {
mutableStateOf(
listOf(
Mappers.NORMAL(text), Mappers.NORMAL(text),
Mappers.CIRCLED(text), Mappers.CIRCLED(text),
Mappers.BOLD(text), Mappers.BOLD(text),
@ -59,6 +65,27 @@ fun WootTextList(
Mappers.CRIMPED(text), Mappers.CRIMPED(text),
Mappers.WILD(text), Mappers.WILD(text),
Mappers.CURVY(text), Mappers.CURVY(text),
Mappers.FULL_CIRCLE(text),
Mappers.FULLWIDTH(text),
Mappers.SMALL_CAPITALS(text),
Mappers.SUPERSCRIPT(text),
Mappers.SUBSCRIPT(text),
Mappers.MIRROR(text),
Mappers.UPSIDEDOWN(text),
Mappers.REGIONAL_INDICATOR(text),
Mappers.FULL_SQUARED(text),
Mappers.TAG(text),
Mappers.ACUTE_ACCENT(text),
Mappers.GRAVE_ACCENT(text),
Mappers.CIRCUMFLEX(text),
Mappers.CARON(text),
Mappers.MONEY(text),
Mappers.HOMOGLYPH(text),
Mappers.FAKE_BRAILLE(text),
Mappers.BRAILLE(text),
Mappers.BLOCKS(text),
Mappers.LEET(text),
Mappers.WINGDINGS(text),
Combinators.FIREWORKS(text), Combinators.FIREWORKS(text),
Combinators.DOUBLE_OVERLINED(text), Combinators.DOUBLE_OVERLINED(text),
@ -71,8 +98,24 @@ fun WootTextList(
Combinators.SQUIGGLES(text), Combinators.SQUIGGLES(text),
Combinators.LIGHTNING(text), Combinators.LIGHTNING(text),
Combinators.UP_ARROWS(text), Combinators.UP_ARROWS(text),
Combinators.VERTICAL_BRACKETS(text) Combinators.VERTICAL_BRACKETS(text),
Combinators.TRIANGLE(text),
Combinators.HEARTS(text),
Combinators.KEYCAP(text),
Formatters.BRACKETS(text),
Formatters.CORNER_BRACKETS(text),
Formatters.SHADE(text),
Formatters.BOXED(text),
Formatters.DOUBLE_BOXED(text),
Formatters.ANGLE_DOTS(text),
Formatters.ORNATE(text),
Formatters.TICKED_BRACKETS(text),
Formatters.ZIGZAG(text),
Formatters.TILDES(text)
) )
)
}
LazyColumn(modifier = modifier) { LazyColumn(modifier = modifier) {
items(wootTexts) { text -> items(wootTexts) { text ->
@ -83,8 +126,7 @@ fun WootTextList(
@Composable @Composable
fun WootTextCard( fun WootTextCard(
text: String, text: String, modifier: Modifier = Modifier
modifier: Modifier = Modifier
) { ) {
val cardColors = CardDefaults.cardColors( val cardColors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surface, containerColor = MaterialTheme.colorScheme.surface,
@ -103,8 +145,7 @@ fun WootTextCard(
@Composable @Composable
fun WootTextCardDetail( fun WootTextCardDetail(
text: String, text: String, modifier: Modifier = Modifier
modifier: Modifier = Modifier
) { ) {
Row( Row(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
@ -117,21 +158,18 @@ fun WootTextCardDetail(
) )
ShareTextButton( ShareTextButton(
text, text, modifier = modifier.weight(0.1f)
modifier= modifier.weight(0.1f)
) )
CopyTextButton( CopyTextButton(
text, text, modifier = modifier.weight(0.1f)
modifier = modifier.weight(0.1f)
) )
} }
} }
@Composable @Composable
fun CopyTextButton( fun CopyTextButton(
text: String, text: String, modifier: Modifier = Modifier
modifier: Modifier = Modifier
) { ) {
val clipboardManager: ClipboardManager = LocalClipboardManager.current val clipboardManager: ClipboardManager = LocalClipboardManager.current
val context = LocalContext.current val context = LocalContext.current
@ -139,9 +177,7 @@ fun CopyTextButton(
IconButton( IconButton(
onClick = { onClick = {
clipboardManager.setText(AnnotatedString(text)) clipboardManager.setText(AnnotatedString(text))
Toast Toast.makeText(context, R.string.clipboard_copy_toast, Toast.LENGTH_SHORT).show()
.makeText(context, R.string.clipboard_copy_toast, Toast.LENGTH_SHORT)
.show()
}, modifier = modifier }, modifier = modifier
) { ) {
Icon( Icon(
@ -153,8 +189,7 @@ fun CopyTextButton(
@Composable @Composable
fun ShareTextButton( fun ShareTextButton(
text: String, text: String, modifier: Modifier = Modifier
modifier: Modifier = Modifier
) { ) {
val sendIntent: Intent = Intent().apply { val sendIntent: Intent = Intent().apply {
action = Intent.ACTION_SEND action = Intent.ACTION_SEND