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,53 +29,93 @@ 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(
Mappers.NORMAL(text),
Mappers.CIRCLED(text),
Mappers.BOLD(text),
Mappers.BOLD_ITALIC(text),
Mappers.ITALIC(text),
Mappers.SANS(text),
Mappers.DOUBLESTRUCK(text),
Mappers.MONOSPACE(text),
Mappers.SERIF_BOLD(text),
Mappers.SERIF_BOLD_ITALIC(text),
Mappers.FRAKTUR(text),
Mappers.BOLD_FRAKTUR(text),
Mappers.SCRIPT(text),
Mappers.BOLD_SCRIPT(text),
Mappers.THAI(text),
Mappers.CYRILLIC(text),
Mappers.ETHIOPIC(text),
Mappers.THAI_LE(text),
Mappers.JAPANESE(text),
Mappers.CANADIAN_SYLLABIC(text),
Mappers.CANADIAN_SYLLABICS_DOTS(text),
Mappers.OLD_ITALIC(text),
Mappers.CRIMPED(text),
Mappers.WILD(text),
Mappers.CURVY(text),
Combinators.FIREWORKS(text), val wootTexts by remember {
Combinators.DOUBLE_OVERLINED(text), mutableStateOf(
Combinators.DOUBLE_UNDERLINE(text), listOf(
Combinators.OVERLINED(text), Mappers.NORMAL(text),
Combinators.STRIKETHROUGH(text), Mappers.CIRCLED(text),
Combinators.UNDERLINE(text), Mappers.BOLD(text),
Combinators.SLASHED(text), Mappers.BOLD_ITALIC(text),
Combinators.XS(text), Mappers.ITALIC(text),
Combinators.SQUIGGLES(text), Mappers.SANS(text),
Combinators.LIGHTNING(text), Mappers.DOUBLESTRUCK(text),
Combinators.UP_ARROWS(text), Mappers.MONOSPACE(text),
Combinators.VERTICAL_BRACKETS(text) Mappers.SERIF_BOLD(text),
) Mappers.SERIF_BOLD_ITALIC(text),
Mappers.FRAKTUR(text),
Mappers.BOLD_FRAKTUR(text),
Mappers.SCRIPT(text),
Mappers.BOLD_SCRIPT(text),
Mappers.THAI(text),
Mappers.CYRILLIC(text),
Mappers.ETHIOPIC(text),
Mappers.THAI_LE(text),
Mappers.JAPANESE(text),
Mappers.CANADIAN_SYLLABIC(text),
Mappers.CANADIAN_SYLLABICS_DOTS(text),
Mappers.OLD_ITALIC(text),
Mappers.CRIMPED(text),
Mappers.WILD(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.DOUBLE_OVERLINED(text),
Combinators.DOUBLE_UNDERLINE(text),
Combinators.OVERLINED(text),
Combinators.STRIKETHROUGH(text),
Combinators.UNDERLINE(text),
Combinators.SLASHED(text),
Combinators.XS(text),
Combinators.SQUIGGLES(text),
Combinators.LIGHTNING(text),
Combinators.UP_ARROWS(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