Add send/recv/render support for text stories.

This commit is contained in:
Alex Hart
2022-03-09 13:11:56 -04:00
committed by Cody Henthorne
parent 3a2e8b9b19
commit ff8d7fa6c2
40 changed files with 963 additions and 93 deletions

View File

@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.fonts
import android.graphics.Typeface
import androidx.annotation.DrawableRes
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.database.model.databaseprotos.StoryTextPost
/**
* Describes which font the user wishes to render content in.
@@ -13,4 +14,18 @@ enum class TextFont(@DrawableRes val icon: Int, val fallbackFamily: String, val
SERIF(R.drawable.ic_font_serif, "serif", Typeface.NORMAL, false),
SCRIPT(R.drawable.ic_font_script, "serif", Typeface.BOLD, false),
CONDENSED(R.drawable.ic_font_condensed, "sans-serif", Typeface.BOLD, true);
companion object {
fun fromStyle(style: StoryTextPost.Style): TextFont {
return when (style) {
StoryTextPost.Style.DEFAULT -> REGULAR
StoryTextPost.Style.REGULAR -> REGULAR
StoryTextPost.Style.BOLD -> BOLD
StoryTextPost.Style.SERIF -> SERIF
StoryTextPost.Style.SCRIPT -> SCRIPT
StoryTextPost.Style.CONDENSED -> CONDENSED
StoryTextPost.Style.UNRECOGNIZED -> REGULAR
}
}
}
}