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,11 +12,14 @@ enum class Combinators(private val combinator: String): Translator{
SQUIGGLES("\u033E"),
LIGHTNING("\u035B"),
UP_ARROWS("\u034E"),
VERTICAL_BRACKETS("\u0346\u033A");
VERTICAL_BRACKETS("\u0346\u033A"),
TRIANGLE("\u20e4"),
HEARTS("\u2665"),
KEYCAP("\u20E3");
override fun translate(text: String): String {
return text
.map { "${it}${combinator}" }
.joinToString("")
}
}
}

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.Text
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.Modifier
import androidx.compose.ui.platform.ClipboardManager
@ -26,53 +29,93 @@ import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.dp
import net.friedl.android.woot.R
import net.friedl.android.woot.translator.Combinators
import net.friedl.android.woot.translator.Formatters
import net.friedl.android.woot.translator.Mappers
@Composable
fun WootTextList(
text: String,
modifier: Modifier = Modifier
text: String, 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),
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)
)
val wootTexts by remember {
mutableStateOf(
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),
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) {
items(wootTexts) { text ->
@ -83,8 +126,7 @@ fun WootTextList(
@Composable
fun WootTextCard(
text: String,
modifier: Modifier = Modifier
text: String, modifier: Modifier = Modifier
) {
val cardColors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surface,
@ -103,8 +145,7 @@ fun WootTextCard(
@Composable
fun WootTextCardDetail(
text: String,
modifier: Modifier = Modifier
text: String, modifier: Modifier = Modifier
) {
Row(
verticalAlignment = Alignment.CenterVertically,
@ -117,21 +158,18 @@ fun WootTextCardDetail(
)
ShareTextButton(
text,
modifier= modifier.weight(0.1f)
text, modifier = modifier.weight(0.1f)
)
CopyTextButton(
text,
modifier = modifier.weight(0.1f)
text, modifier = modifier.weight(0.1f)
)
}
}
@Composable
fun CopyTextButton(
text: String,
modifier: Modifier = Modifier
text: String, modifier: Modifier = Modifier
) {
val clipboardManager: ClipboardManager = LocalClipboardManager.current
val context = LocalContext.current
@ -139,9 +177,7 @@ fun CopyTextButton(
IconButton(
onClick = {
clipboardManager.setText(AnnotatedString(text))
Toast
.makeText(context, R.string.clipboard_copy_toast, Toast.LENGTH_SHORT)
.show()
Toast.makeText(context, R.string.clipboard_copy_toast, Toast.LENGTH_SHORT).show()
}, modifier = modifier
) {
Icon(
@ -153,8 +189,7 @@ fun CopyTextButton(
@Composable
fun ShareTextButton(
text: String,
modifier: Modifier = Modifier
text: String, modifier: Modifier = Modifier
) {
val sendIntent: Intent = Intent().apply {
action = Intent.ACTION_SEND
@ -171,4 +206,4 @@ fun ShareTextButton(
) {
Icon(Icons.Default.Share, contentDescription = "Share")
}
}
}