mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Implement new top-level backups settings.
This commit is contained in:
@@ -10,6 +10,12 @@ import android.graphics.Typeface
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.text.TextPaint
|
||||
import android.text.style.MetricAffectingSpan
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.SpanStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.withStyle
|
||||
|
||||
/**
|
||||
* Helper object for working with the SignalSymbols font
|
||||
@@ -17,6 +23,7 @@ import android.text.style.MetricAffectingSpan
|
||||
object SignalSymbols {
|
||||
|
||||
enum class Glyph(val unicode: Char) {
|
||||
CHECKMARK('\u2713'),
|
||||
CHEVRON_RIGHT('\uE025'),
|
||||
PERSON_CIRCLE('\uE05E')
|
||||
}
|
||||
@@ -43,6 +50,17 @@ object SignalSymbols {
|
||||
return text
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AnnotatedString.Builder.SignalSymbol(weight: Weight, glyph: Glyph) {
|
||||
withStyle(
|
||||
SpanStyle(
|
||||
fontFamily = FontFamily(getTypeface(LocalContext.current, weight))
|
||||
)
|
||||
) {
|
||||
append(glyph.unicode.toString())
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTypeface(context: Context, weight: Weight): Typeface {
|
||||
return when (weight) {
|
||||
Weight.BOLD -> getBoldWeightedFont(context)
|
||||
|
||||
Reference in New Issue
Block a user