adding non light mode carousel background which uses a vertical gradient

This commit is contained in:
Adam Brown 2022-01-14 12:18:06 +00:00
parent 982b480613
commit c0b855e7c7
2 changed files with 40 additions and 26 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="270"
android:endColor="?vctr_system"
android:startColor="#000000" />
</shape>

View File

@ -18,12 +18,14 @@ package im.vector.app.features.onboarding.ftueauth
import android.content.Context import android.content.Context
import androidx.annotation.AttrRes import androidx.annotation.AttrRes
import androidx.annotation.DrawableRes
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.epoxy.charsequence.EpoxyCharSequence import im.vector.app.core.epoxy.charsequence.EpoxyCharSequence
import im.vector.app.core.epoxy.charsequence.toEpoxyCharSequence import im.vector.app.core.epoxy.charsequence.toEpoxyCharSequence
import im.vector.app.core.resources.LocaleProvider import im.vector.app.core.resources.LocaleProvider
import im.vector.app.core.resources.StringProvider import im.vector.app.core.resources.StringProvider
import im.vector.app.core.resources.isEnglishSpeaking import im.vector.app.core.resources.isEnglishSpeaking
import im.vector.app.features.themes.ThemeProvider
import im.vector.app.features.themes.ThemeUtils import im.vector.app.features.themes.ThemeUtils
import me.gujun.android.span.span import me.gujun.android.span.span
import javax.inject.Inject import javax.inject.Inject
@ -32,34 +34,39 @@ class SplashCarouselStateFactory @Inject constructor(
private val context: Context, private val context: Context,
private val stringProvider: StringProvider, private val stringProvider: StringProvider,
private val localeProvider: LocaleProvider, private val localeProvider: LocaleProvider,
private val themeProvider: ThemeProvider,
) { ) {
fun create() = SplashCarouselState(listOf( fun create(): SplashCarouselState {
SplashCarouselState.Item( val lightTheme = themeProvider.isLightTheme()
R.string.ftue_auth_carousel_1_title.colorTerminatingFullStop(R.attr.colorAccent), fun background(@DrawableRes lightDrawable: Int) = if (lightTheme) lightDrawable else R.drawable.bg_carousel_page_dark
R.string.ftue_auth_carousel_body_secure, return SplashCarouselState(listOf(
R.drawable.ic_splash_conversations, SplashCarouselState.Item(
R.drawable.bg_carousel_page_1 R.string.ftue_auth_carousel_1_title.colorTerminatingFullStop(R.attr.colorAccent),
), R.string.ftue_auth_carousel_body_secure,
SplashCarouselState.Item( R.drawable.ic_splash_conversations,
R.string.ftue_auth_carousel_2_title.colorTerminatingFullStop(R.attr.colorAccent), background(R.drawable.bg_carousel_page_1)
R.string.ftue_auth_carousel_body_control, ),
R.drawable.ic_splash_control, SplashCarouselState.Item(
R.drawable.bg_carousel_page_2 R.string.ftue_auth_carousel_2_title.colorTerminatingFullStop(R.attr.colorAccent),
), R.string.ftue_auth_carousel_body_control,
SplashCarouselState.Item( R.drawable.ic_splash_control,
R.string.ftue_auth_carousel_3_title.colorTerminatingFullStop(R.attr.colorAccent), background(R.drawable.bg_carousel_page_2)
R.string.ftue_auth_carousel_body_encrypted, ),
R.drawable.ic_splash_secure, SplashCarouselState.Item(
R.drawable.bg_carousel_page_3 R.string.ftue_auth_carousel_3_title.colorTerminatingFullStop(R.attr.colorAccent),
), R.string.ftue_auth_carousel_body_encrypted,
SplashCarouselState.Item( R.drawable.ic_splash_secure,
collaborationTitle().colorTerminatingFullStop(R.attr.colorAccent), background(R.drawable.bg_carousel_page_3)
R.string.ftue_auth_carousel_body_workplace, ),
R.drawable.ic_splash_collaboration, SplashCarouselState.Item(
R.drawable.bg_carousel_page_4 collaborationTitle().colorTerminatingFullStop(R.attr.colorAccent),
) R.string.ftue_auth_carousel_body_workplace,
)) R.drawable.ic_splash_collaboration,
background(R.drawable.bg_carousel_page_4)
)
))
}
private fun collaborationTitle(): Int { private fun collaborationTitle(): Int {
return when { return when {