Add support for new story gradient fields and fallback.

This commit is contained in:
Alex Hart
2022-09-02 14:34:20 -03:00
committed by Greyson Parrelli
parent 2e2b31aa79
commit f751f9afa8
7 changed files with 110 additions and 98 deletions

View File

@@ -5,90 +5,62 @@ import org.thoughtcrime.securesms.conversation.colors.ChatColors
object TextStoryBackgroundColors {
private val backgroundColors: List<ChatColors> = listOf(
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF688BD4.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF8687C1.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFFB47F8C.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF899188.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF539383.toInt()
),
ChatColors.forGradient(
id = ChatColors.Id.NotSet,
linearGradient = ChatColors.LinearGradient(
degrees = 191.41f,
colors = intArrayOf(0xFFF53844.toInt(), 0xFF42378F.toInt()),
positions = floatArrayOf(0f, 1.0f)
colors = intArrayOf(
0xFF19A9FA.toInt(), 0xFF7097D7.toInt(), 0xFFD1998D.toInt(), 0xFFFFC369.toInt()
),
positions = floatArrayOf(
0f, 0.33f, 0.66f, 1f
),
degrees = 180f
)
),
ChatColors.forGradient(
id = ChatColors.Id.NotSet,
linearGradient = ChatColors.LinearGradient(
degrees = 192.04f,
colors = intArrayOf(0xFFF04CE6.toInt(), 0xFF0E2FDD.toInt()),
positions = floatArrayOf(0.0f, 1.0f)
),
),
ChatColors.forGradient(
id = ChatColors.Id.NotSet,
linearGradient = ChatColors.LinearGradient(
degrees = 175.46f,
colors = intArrayOf(0xFFFFC044.toInt(), 0xFFFE5C38.toInt()),
positions = floatArrayOf(0f, 1f)
colors = intArrayOf(
0xFF4437D8.toInt(), 0xFF6B70DE.toInt(), 0xFFB774E0.toInt(), 0xFFFF8E8E.toInt()
),
positions = floatArrayOf(
0f, 0.33f, 0.66f, 1f
),
degrees = 180f
)
),
ChatColors.forGradient(
id = ChatColors.Id.NotSet,
linearGradient = ChatColors.LinearGradient(
degrees = 180f,
colors = intArrayOf(0xFF0093E9.toInt(), 0xFF80D0C7.toInt()),
positions = floatArrayOf(0.0f, 1.0f)
colors = intArrayOf(
0xFF004044.toInt(), 0xFF2C5F45.toInt(), 0xFF648E52.toInt(), 0xFF93B864.toInt()
),
positions = floatArrayOf(
0f, 0.33f, 0.66f, 1f
),
degrees = 180f
)
),
ChatColors.forGradient(
id = ChatColors.Id.NotSet,
linearGradient = ChatColors.LinearGradient(
degrees = 180f,
colors = intArrayOf(0xFF65CDAC.toInt(), 0xFF0A995A.toInt()),
positions = floatArrayOf(0.0f, 1.0f)
)
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFFFFC153.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFFCCBD33.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF84712E.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF09B37B.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF8B8BF9.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF5151F6.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFFF76E6E.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFFC84641.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFFC6C4A5.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFFA49595.toInt()
),
ChatColors.forColor(
id = ChatColors.Id.NotSet,
color = 0xFF292929.toInt()
),
)
)
fun getInitialBackgroundColor(): ChatColors = backgroundColors.first()