diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ce0739c..a7cbc51 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -45,4 +45,6 @@ dependencies { testImplementation(libs.junit) androidTestImplementation(libs.androidx.junit) androidTestImplementation(libs.androidx.espresso.core) + + implementation("androidx.core:core-splashscreen:1.0.1") } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6b0ea51..13baee8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -14,10 +14,10 @@ tools:targetApi="31"> + android:exported="true" + android:theme="@style/Theme.NeatCalendar.Splash"> - diff --git a/app/src/main/java/com/p_vacho/neat_calendar/MainActivity.kt b/app/src/main/java/com/p_vacho/neat_calendar/MainActivity.kt index b30c713..67e3517 100644 --- a/app/src/main/java/com/p_vacho/neat_calendar/MainActivity.kt +++ b/app/src/main/java/com/p_vacho/neat_calendar/MainActivity.kt @@ -3,14 +3,29 @@ package com.p_vacho.neat_calendar import android.os.Bundle import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity +import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { + // Attach the splash screen to the activity before initialization begins + // (before super.onCreate) to make it show up during the activity init. + val splashScreen = installSplashScreen() + + // Keep the splash screen visible until initialization is complete + splashScreen.setKeepOnScreenCondition { + // TODO: Once implemented, make sure keep the splashscreen on until + // all of the necessary data are obtained from the API, for now, + // no initialization delay is needed. + false + } + super.onCreate(savedInstanceState) enableEdgeToEdge() setContentView(R.layout.activity_main) + + // Handle window insets for proper layout adjustment ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets -> val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()) v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom) diff --git a/app/src/main/res/drawable/ic_splash_icon.xml b/app/src/main/res/drawable/ic_splash_icon.xml new file mode 100644 index 0000000..07ae8fa --- /dev/null +++ b/app/src/main/res/drawable/ic_splash_icon.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 0d6594d..fc73d6f 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -2,6 +2,12 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index c8524cd..a17ce18 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -2,4 +2,7 @@ #FF000000 #FFFFFFFF + + #F5F5F5 + #121212 \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 8273c03..174f033 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -2,8 +2,14 @@ +