Skip to content

๐Ÿš€ Splash Screen

The splash screen shows a welcome GIF and preloads all required questions before opening the main UI.

This improves performance and ensures that the first game interaction is instant, even with accessibility features.


๐ŸŽฏ Purpose

  • โœ… Preload questions for the selected difficulty level.
  • โœ… Announce progress if Accessibility/TalkBack is on.
  • โœ… Display a loading GIF with a progress bar.

๐Ÿงช Key Behaviors

1. ๐Ÿง  Question Preloading

We preload questions based on the currently selected difficulty. This ensures no lag when users start playing.

QuestionCache.preloadCurrentDifficultyModes(context, lang) { progress ->
    progressBar.setProgress(progress, true)
}
````

After launching `MainActivity`, we also **preload other difficulties in the background**:

```kotlin
QuestionCache.preloadOtherDifficultyModes(context, lang)

2. โ™ฟ Accessibility Announcements

If TalkBack is enabled, the app announces loading status every 1.5 seconds:

gifImageView.announceForAccessibility("Loading questions, please wait")

We use a repeating Handler postDelayed loop to announce periodically.


3. ๐ŸŽž๏ธ Animated Welcome + Progress

We use Glide to display a welcoming GIF while the user waits:

Glide.with(this)
    .asGif()
    .load(R.drawable.dialog_welcome_1)
    .into(gifImageView)

The progress is shown via a Material LinearProgressIndicator.


File Purpose
SplashScreen.kt Entry point activity; does all preloading
QuestionCache.kt Handles Excel-based question preloading
LocaleHelper.kt Detects current language preference
activity_splash_screen.xml Layout with GIF + progress bar

๐Ÿ Launch Flow

The splash screen is marked as the LAUNCHER activity in AndroidManifest.xml:

<activity
    android:name=".SplashScreen"
    android:exported="true"
    android:theme="@style/Theme.ZMantra"
    android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

After preloading, it launches MainActivity.


๐Ÿ“ฆ Permissions Required

In AndroidManifest.xml:

<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.VIBRATE" />

These are used later during in-game audio and vibration feedback.