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"),
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

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,14 +29,17 @@ 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(
val wootTexts by remember {
mutableStateOf(
listOf(
Mappers.NORMAL(text),
Mappers.CIRCLED(text),
Mappers.BOLD(text),
@ -59,6 +65,27 @@ fun WootTextList(
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),
@ -71,8 +98,24 @@ fun WootTextList(
Combinators.SQUIGGLES(text),
Combinators.LIGHTNING(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) {
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