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:
@@ -4,35 +4,16 @@ import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.scarriffle.calendarr.data.CredentialStore
|
||||
import com.scarriffle.calendarr.data.StartupState
|
||||
import com.scarriffle.calendarr.ui.CalendarrRoot
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : ComponentActivity() {
|
||||
|
||||
@Inject lateinit var startupState: StartupState
|
||||
@Inject lateinit var credentialStore: CredentialStore
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// Single, uniform splash: keep the system splash on screen until the
|
||||
// first events have loaded (or a timeout), so there is no two-stage
|
||||
// splash and no entering a half-loaded, janky app.
|
||||
val splash = installSplashScreen()
|
||||
splash.setKeepOnScreenCondition { !startupState.ready.value }
|
||||
|
||||
// Covers the window from the first frame (incl. warm-start), then hands
|
||||
// off to the in-app branded splash which stays until data is loaded.
|
||||
installSplashScreen()
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// Nothing to load before login → reveal immediately.
|
||||
if (!credentialStore.isLoggedIn) startupState.markReady()
|
||||
// Safety timeout so the splash can never hang.
|
||||
lifecycleScope.launch { delay(6000); startupState.markReady() }
|
||||
|
||||
setContent {
|
||||
CalendarrRoot()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user