mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-11 00:10:29 -07:00
fix: Added correct font
This commit is contained in:
parent
f25ed59a37
commit
01a98f974f
9 changed files with 98 additions and 24 deletions
|
|
@ -3,12 +3,17 @@ package nl.jknaapen.fladder
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.compose.material3.ColorScheme
|
import androidx.compose.material3.ColorScheme
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
import androidx.compose.material3.dynamicDarkColorScheme
|
import androidx.compose.material3.dynamicDarkColorScheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.text.font.Font
|
||||||
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import com.materialkolor.PaletteStyle
|
import com.materialkolor.PaletteStyle
|
||||||
import com.materialkolor.dynamiccolor.ColorSpec
|
import com.materialkolor.dynamiccolor.ColorSpec
|
||||||
import com.materialkolor.rememberDynamicColorScheme
|
import com.materialkolor.rememberDynamicColorScheme
|
||||||
|
|
@ -38,8 +43,44 @@ fun VideoPlayerTheme(
|
||||||
|
|
||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
colorScheme = chosenScheme,
|
colorScheme = chosenScheme,
|
||||||
|
typography = customTypography
|
||||||
) {
|
) {
|
||||||
content()
|
content()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val customTypography: Typography
|
||||||
|
@Composable
|
||||||
|
get() {
|
||||||
|
val rubikFamily = FontFamily(
|
||||||
|
Font(R.font.rubik_light, FontWeight.Light),
|
||||||
|
Font(R.font.rubik_normal, FontWeight.Normal),
|
||||||
|
Font(R.font.rubik_italic, FontWeight.Normal, FontStyle.Italic),
|
||||||
|
Font(R.font.rubik_medium, FontWeight.Medium),
|
||||||
|
Font(R.font.rubik_bold, FontWeight.Bold)
|
||||||
|
)
|
||||||
|
|
||||||
|
val defaultTypography = MaterialTheme.typography
|
||||||
|
|
||||||
|
return defaultTypography.copy(
|
||||||
|
displayLarge = defaultTypography.displayLarge.copy(fontFamily = rubikFamily),
|
||||||
|
displayMedium = defaultTypography.displayMedium.copy(fontFamily = rubikFamily),
|
||||||
|
displaySmall = defaultTypography.displaySmall.copy(fontFamily = rubikFamily),
|
||||||
|
|
||||||
|
headlineLarge = defaultTypography.headlineLarge.copy(fontFamily = rubikFamily),
|
||||||
|
headlineMedium = defaultTypography.headlineMedium.copy(fontFamily = rubikFamily),
|
||||||
|
headlineSmall = defaultTypography.headlineSmall.copy(fontFamily = rubikFamily),
|
||||||
|
|
||||||
|
titleLarge = defaultTypography.titleLarge.copy(fontFamily = rubikFamily),
|
||||||
|
titleMedium = defaultTypography.titleMedium.copy(fontFamily = rubikFamily),
|
||||||
|
titleSmall = defaultTypography.titleSmall.copy(fontFamily = rubikFamily),
|
||||||
|
|
||||||
|
bodyLarge = defaultTypography.bodyLarge.copy(fontFamily = rubikFamily),
|
||||||
|
bodyMedium = defaultTypography.bodyMedium.copy(fontFamily = rubikFamily),
|
||||||
|
bodySmall = defaultTypography.bodySmall.copy(fontFamily = rubikFamily),
|
||||||
|
|
||||||
|
labelLarge = defaultTypography.labelLarge.copy(fontFamily = rubikFamily),
|
||||||
|
labelMedium = defaultTypography.labelMedium.copy(fontFamily = rubikFamily),
|
||||||
|
labelSmall = defaultTypography.labelSmall.copy(fontFamily = rubikFamily)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -48,6 +48,7 @@ import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.graphics.Brush
|
import androidx.compose.ui.graphics.Brush
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.StrokeCap
|
import androidx.compose.ui.graphics.StrokeCap
|
||||||
|
import androidx.compose.ui.input.key.Key.Companion.Back
|
||||||
import androidx.compose.ui.input.key.Key.Companion.DirectionLeft
|
import androidx.compose.ui.input.key.Key.Companion.DirectionLeft
|
||||||
import androidx.compose.ui.input.key.Key.Companion.DirectionRight
|
import androidx.compose.ui.input.key.Key.Companion.DirectionRight
|
||||||
import androidx.compose.ui.input.key.KeyEvent
|
import androidx.compose.ui.input.key.KeyEvent
|
||||||
|
|
@ -79,7 +80,12 @@ import nl.jknaapen.fladder.utility.ImmersiveSystemBars
|
||||||
import nl.jknaapen.fladder.utility.defaultSelected
|
import nl.jknaapen.fladder.utility.defaultSelected
|
||||||
import nl.jknaapen.fladder.utility.leanBackEnabled
|
import nl.jknaapen.fladder.utility.leanBackEnabled
|
||||||
import nl.jknaapen.fladder.utility.visible
|
import nl.jknaapen.fladder.utility.visible
|
||||||
|
import java.time.ZoneId
|
||||||
|
import java.time.format.DateTimeFormatter
|
||||||
|
import kotlin.time.Clock
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
import kotlin.time.ExperimentalTime
|
||||||
|
import kotlin.time.toJavaInstant
|
||||||
|
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
|
@ -112,14 +118,12 @@ fun CustomVideoControls(
|
||||||
bottomControlFocusRequester.requestFocus()
|
bottomControlFocusRequester.requestFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BackHandler(
|
BackHandler(
|
||||||
enabled = showControls
|
enabled = showControls
|
||||||
) {
|
) {
|
||||||
hideControls()
|
hideControls()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Restart the hide timer whenever `lastInteraction` changes.
|
// Restart the hide timer whenever `lastInteraction` changes.
|
||||||
LaunchedEffect(lastInteraction.longValue) {
|
LaunchedEffect(lastInteraction.longValue) {
|
||||||
delay(5.seconds)
|
delay(5.seconds)
|
||||||
|
|
@ -166,6 +170,7 @@ fun CustomVideoControls(
|
||||||
|
|
||||||
if (!showControls) {
|
if (!showControls) {
|
||||||
when (keyEvent.key) {
|
when (keyEvent.key) {
|
||||||
|
Back -> return@onKeyEvent true
|
||||||
DirectionLeft -> {
|
DirectionLeft -> {
|
||||||
currentSkipTime -= backwardSpeed.inWholeMilliseconds
|
currentSkipTime -= backwardSpeed.inWholeMilliseconds
|
||||||
updateSeekInteraction()
|
updateSeekInteraction()
|
||||||
|
|
@ -225,32 +230,41 @@ fun CustomVideoControls(
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
.padding(controlsPadding)
|
||||||
.weight(1f),
|
.weight(1f),
|
||||||
) {
|
) {
|
||||||
val state by VideoPlayerObject.implementation.playbackData.collectAsState(
|
Row(
|
||||||
null
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
)
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
state?.let {
|
|
||||||
ItemHeader(
|
|
||||||
modifier = Modifier.padding(controlsPadding),
|
|
||||||
it
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!leanBackEnabled(LocalContext.current)) {
|
|
||||||
IconButton(
|
|
||||||
{
|
|
||||||
activity?.finish()
|
|
||||||
}
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
val state by VideoPlayerObject.implementation.playbackData.collectAsState(
|
||||||
Iconsax.Outline.CloseSquare,
|
null
|
||||||
modifier = Modifier
|
|
||||||
.size(38.dp)
|
|
||||||
.focusable(false),
|
|
||||||
contentDescription = "Close icon",
|
|
||||||
tint = Color.White,
|
|
||||||
)
|
)
|
||||||
|
state?.let {
|
||||||
|
ItemHeader(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f),
|
||||||
|
it
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (!leanBackEnabled(LocalContext.current)) {
|
||||||
|
IconButton(
|
||||||
|
{
|
||||||
|
activity?.finish()
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
Iconsax.Outline.CloseSquare,
|
||||||
|
modifier = Modifier
|
||||||
|
.size(38.dp)
|
||||||
|
.focusable(false),
|
||||||
|
contentDescription = "Close icon",
|
||||||
|
tint = Color.White,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
CurrentTime()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -507,3 +521,22 @@ internal fun RowScope.RightButtons(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
@kotlin.OptIn(ExperimentalTime::class)
|
||||||
|
@Composable
|
||||||
|
private fun CurrentTime() {
|
||||||
|
val startInstant = Clock.System.now()
|
||||||
|
val zone = ZoneId.systemDefault()
|
||||||
|
|
||||||
|
val endInstant = startInstant.toJavaInstant()
|
||||||
|
val endZoned = endInstant.atZone(zone)
|
||||||
|
val formatter = DateTimeFormatter.ofPattern("hh:mm a")
|
||||||
|
|
||||||
|
Text(
|
||||||
|
endZoned.format(formatter),
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
color = Color.White
|
||||||
|
)
|
||||||
|
}
|
||||||
BIN
android/app/src/main/res/font/rubik_bold.ttf
Normal file
BIN
android/app/src/main/res/font/rubik_bold.ttf
Normal file
Binary file not shown.
BIN
android/app/src/main/res/font/rubik_extra_bold.ttf
Normal file
BIN
android/app/src/main/res/font/rubik_extra_bold.ttf
Normal file
Binary file not shown.
BIN
android/app/src/main/res/font/rubik_italic.ttf
Normal file
BIN
android/app/src/main/res/font/rubik_italic.ttf
Normal file
Binary file not shown.
BIN
android/app/src/main/res/font/rubik_light.ttf
Normal file
BIN
android/app/src/main/res/font/rubik_light.ttf
Normal file
Binary file not shown.
BIN
android/app/src/main/res/font/rubik_medium.ttf
Normal file
BIN
android/app/src/main/res/font/rubik_medium.ttf
Normal file
Binary file not shown.
BIN
android/app/src/main/res/font/rubik_normal.ttf
Normal file
BIN
android/app/src/main/res/font/rubik_normal.ttf
Normal file
Binary file not shown.
BIN
android/app/src/main/res/font/rubik_semi_bold.ttf
Normal file
BIN
android/app/src/main/res/font/rubik_semi_bold.ttf
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue