Skip to content

Commit

Permalink
Typography: Still losing brain cells over why preload crashes the app
Browse files Browse the repository at this point in the history
Signed-off-by: Shreyansh Lodha <slodha96@gmail.com>
  • Loading branch information
static-var committed May 12, 2022
1 parent 39422f6 commit 627fc45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions app/src/main/java/dev/staticvar/vlr/ui/theme/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFontFamilyResolver

private val DarkColorScheme =
darkColorScheme(primary = Purple200, secondary = Purple500, tertiary = Teal200)
Expand Down Expand Up @@ -36,10 +34,10 @@ fun VLRTheme(
else -> LightColorScheme
}

val fontFamilyResolver = LocalFontFamilyResolver.current
LaunchedEffect(Unit) {
fontFamilyResolver.resolve(appFontFamily)
}
// val fontFamilyResolver = LocalFontFamilyResolver.current
// LaunchedEffect(Unit) {
// fontFamilyResolver.resolve(appFontFamily)
// }

MaterialTheme(
colorScheme = colorScheme,
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/dev/staticvar/vlr/ui/theme/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ import androidx.compose.ui.text.googlefonts.GoogleFont
import androidx.compose.ui.unit.sp
import dev.staticvar.vlr.R

val fontProvider =
val fontProvider by lazy {
GoogleFont.Provider(
providerAuthority = "com.google.android.gms.fonts",
providerPackage = "com.google.android.gms",
R.array.com_google_android_gms_fonts_certs
)
}

val appFontFamily =
FontFamily(
listOf(
Font(GoogleFont("Rubik"), fontProvider = fontProvider),
Font(GoogleFont("IBM Plex Sans"), fontProvider = fontProvider),
)
)

Expand Down

0 comments on commit 627fc45

Please sign in to comment.