fix: branded splash back, wider month range, December title bug

- Restore the branded in-app splash (Calendarr name + icon + © Scarriffle),
  held until the first events load; logo sized to match the system splash so it
  doesn't visibly jump, name/copyright fade in
- Month calendar now scrolls 10 years back / 50 years ahead (was ±18 months)
- Fix month/quarter title: use Month.getDisplayName instead of the 'LLLL'
  pattern, which dropped the month name (e.g. December showed only '2026')

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Guido Schmit
2026-05-31 15:07:37 +02:00
parent ba7daf8559
commit cb51284bef
7 changed files with 95 additions and 48 deletions

View File

@@ -5,14 +5,20 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.hilt.navigation.compose.hiltViewModel
import com.scarriffle.calendarr.ui.auth.LoginScreen
import com.scarriffle.calendarr.ui.auth.ServerSetupScreen
import com.scarriffle.calendarr.ui.calendar.CalendarScreen
import com.scarriffle.calendarr.ui.calendar.CalendarViewModel
import com.scarriffle.calendarr.ui.theme.CalendarrTheme
import kotlinx.coroutines.delay
@Composable
fun CalendarrRoot(vm: MainViewModel = hiltViewModel()) {
@@ -24,9 +30,23 @@ fun CalendarrRoot(vm: MainViewModel = hiltViewModel()) {
LocalLang provides L10n.resolved(settings.language),
LocalAppSettings provides settings,
) {
// The system splash (installSplashScreen) covers startup until the
// first events are loaded, so there's no in-app splash here.
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) {
// Obtain the calendar VM early when logged in so events load
// *behind* the splash; the branded splash stays until ready.
val calendarVm: CalendarViewModel? =
if (route == AppRoute.MAIN) hiltViewModel() else null
val dataReady = calendarVm?.ready?.collectAsState()?.value ?: true
var minElapsed by remember { mutableStateOf(false) }
var timedOut by remember { mutableStateOf(false) }
LaunchedEffect(Unit) { delay(500); minElapsed = true }
LaunchedEffect(Unit) { delay(6000); timedOut = true }
if (!minElapsed || (!dataReady && !timedOut)) {
SplashScreen()
return@Surface
}
when (route) {
AppRoute.SETUP -> ServerSetupScreen(onConfigured = vm::onServerConfigured)
AppRoute.LOGIN -> LoginScreen(
@@ -35,6 +55,7 @@ fun CalendarrRoot(vm: MainViewModel = hiltViewModel()) {
onBack = vm::switchServer,
)
AppRoute.MAIN -> CalendarScreen(
vm = calendarVm!!,
onLogout = vm::logout,
onSwitchServer = vm::switchServer,
onSettingsChanged = vm::applyLocalSettings,