├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── .idea ├── .gitignore ├── compiler.xml ├── kotlinScripting.xml └── misc.xml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle.kts ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── work │ │ └── example │ │ └── splishsplash │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── work │ │ │ └── example │ │ │ └── splishsplash │ │ │ ├── MyApplication.kt │ │ │ ├── data │ │ │ └── local │ │ │ │ └── datastore │ │ │ │ ├── DataStoreHelpers.kt │ │ │ │ └── PrefDataStore.kt │ │ │ ├── di │ │ │ ├── DispatcherQualifiers.kt │ │ │ └── DispatchersModule.kt │ │ │ ├── ui │ │ │ ├── components │ │ │ │ └── Greating.kt │ │ │ ├── main │ │ │ │ └── MainActivity.kt │ │ │ └── theme │ │ │ │ ├── Color.kt │ │ │ │ ├── Dimens.kt │ │ │ │ ├── Shape.kt │ │ │ │ ├── Theme.kt │ │ │ │ └── Type.kt │ │ │ └── utils │ │ │ ├── Constants.kt │ │ │ └── Resource.kt │ └── res │ │ ├── drawable-v24 │ │ ├── avd_anim.xml │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── animated_icon.xml │ │ ├── branding_image_drawable.xml │ │ ├── branding_image_layer_list.xml │ │ ├── ic_launcher_background.xml │ │ ├── morphing_animation.xml │ │ └── vectordrawable.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── values-night-v31 │ │ └── splash_theme.xml │ │ ├── values-night │ │ ├── colors.xml │ │ ├── splash_theme.xml │ │ └── themes.xml │ │ ├── values-v27 │ │ └── themes.xml │ │ ├── values-v31 │ │ └── splash_theme.xml │ │ └── values │ │ ├── colors.xml │ │ ├── splash_theme.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── work │ └── example │ └── splishsplash │ └── ExampleUnitTest.kt ├── build.gradle.kts ├── buildSrc ├── .gitignore ├── build.gradle.kts └── src │ └── main │ └── kotlin │ ├── AppConfig.kt │ ├── BuildPlugins.kt │ ├── Dependencies.kt │ └── Versions.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle.kts /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Computer (please complete the following information):** 27 | - OS: [e.g. Windows 10, macOS 11.2.2] 28 | - Android Studio Release [e.g. stable, beta] 29 | - Version [e.g. Arctic Fox 2020.x.x] 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.aar 4 | *.ap_ 5 | *.aab 6 | 7 | # Files for the ART/Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | out/ 17 | # Uncomment the following line in case you need and you don't have the release build type files in your app 18 | # release/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Local configuration file (sdk path, etc) 25 | local.properties 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Log Files 31 | *.log 32 | 33 | # Android Studio Navigation editor temp files 34 | .navigation/ 35 | 36 | # Android Studio captures folder 37 | captures/ 38 | 39 | # IntelliJ 40 | *.iml 41 | .idea/workspace.xml 42 | .idea/tasks.xml 43 | .idea/gradle.xml 44 | .idea/assetWizardSettings.xml 45 | .idea/dictionaries 46 | .idea/libraries 47 | # Android Studio 3 in .gitignore file. 48 | .idea/caches 49 | .idea/modules.xml 50 | # Comment next line if keeping position of elements in Navigation Editor is relevant for you 51 | .idea/navEditor.xml 52 | 53 | # Keystore files 54 | *.jks 55 | *.keystore 56 | 57 | # External native build folder generated in Android Studio 2.2 and later 58 | .externalNativeBuild 59 | .cxx/ 60 | 61 | # Google Services (e.g. APIs or Firebase) 62 | google-services.json 63 | 64 | # Freeline 65 | freeline.py 66 | freeline/ 67 | freeline_project_description.json 68 | 69 | # fastlane 70 | fastlane/report.xml 71 | fastlane/Preview.html 72 | fastlane/screenshots 73 | fastlane/test_output 74 | fastlane/readme.md 75 | 76 | # Version control 77 | vcs.xml 78 | 79 | # lint 80 | lint/intermediates/ 81 | lint/generated/ 82 | lint/outputs/ 83 | lint/tmp/ 84 | # lint/reports/ 85 | 86 | #macOS 87 | .DS_Store 88 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/kotlinScripting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## 🤝 Contributing 2 | 3 | Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any 4 | contributions you make are **greatly appreciated**. 5 | 6 | 1. Open an issue first to discuss what you would like to change. 7 | 1. Fork the Project 8 | 1. Create your feature branch (`git checkout -b feature/1/amazing-feature`) 9 | 1. Commit your changes (`git commit -m 'Add some amazing feature'`) 10 | 1. Push to the branch (`git push origin feature/1/amazing-feature`) 11 | 1. Open a pull request 12 | 13 | (Here, `1` = issue number) 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Racka98 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android 12 Splash Screen API Demo 2 | Demo for using the splash screen API added in API level 31 and backwards compatibility 3 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | 2 | plugins { 3 | id("com.android.application") 4 | kotlin("android") 5 | id("kotlin-parcelize") 6 | id("kotlin-kapt") 7 | id("dagger.hilt.android.plugin") 8 | } 9 | 10 | android { 11 | compileSdk = AppConfig.compileSdkVersion 12 | 13 | defaultConfig { 14 | applicationId = AppConfig.applicationId 15 | minSdk = AppConfig.minSdkVersion 16 | targetSdk = AppConfig.targetSdkVersion 17 | versionCode = AppConfig.versionCode 18 | versionName = AppConfig.versionName 19 | 20 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" 21 | vectorDrawables { 22 | useSupportLibrary = true 23 | } 24 | } 25 | 26 | buildTypes { 27 | getByName("release") { 28 | isMinifyEnabled = false 29 | proguardFiles( 30 | getDefaultProguardFile("proguard-android-optimize.txt"), 31 | "proguard-rules.pro" 32 | ) 33 | } 34 | } 35 | compileOptions { 36 | sourceCompatibility = JavaVersion.VERSION_1_8 37 | targetCompatibility = JavaVersion.VERSION_1_8 38 | } 39 | kotlinOptions { 40 | jvmTarget = "1.8" 41 | } 42 | buildFeatures { 43 | compose = true 44 | } 45 | composeOptions { 46 | kotlinCompilerExtensionVersion = Versions.compose 47 | } 48 | packagingOptions { 49 | resources { 50 | excludes += mutableSetOf( 51 | "/META-INF/{AL2.0,LGPL2.1}", 52 | "META-INF/licenses/ASM" 53 | ) 54 | // Fixes conflicts caused by ByteBuddy library used in 55 | // coroutines-debug and mockito 56 | pickFirsts += mutableSetOf( 57 | "win32-x86-64/attach_hotspot_windows.dll", 58 | "win32-x86/attach_hotspot_windows.dll" 59 | ) 60 | } 61 | } 62 | } 63 | 64 | dependencies { 65 | 66 | implementation(Dependencies.coreKtx) 67 | implementation(Dependencies.appCompat) 68 | implementation(Dependencies.material) 69 | implementation(Dependencies.lifecycleRuntimeKtx) 70 | 71 | // Testing 72 | testImplementation(Dependencies.junit) 73 | testImplementation(Dependencies.testArchCore) 74 | testImplementation(Dependencies.junitTest) 75 | testImplementation(Dependencies.testExtJUnitKtx) 76 | testImplementation(Dependencies.mockitoInline) 77 | testImplementation(Dependencies.mockitoKotlin) 78 | testImplementation(Dependencies.robolectric) 79 | testImplementation(Dependencies.turbine) 80 | testImplementation(Dependencies.coroutineTest) 81 | 82 | androidTestImplementation(Dependencies.junitTest) 83 | androidTestImplementation(Dependencies.espressoCore) 84 | androidTestImplementation(Dependencies.testCoreKtx) 85 | androidTestImplementation(Dependencies.testArchCore) 86 | androidTestImplementation(Dependencies.mockitoAndroid) 87 | androidTestImplementation(Dependencies.mockitoKotlin) 88 | androidTestImplementation(Dependencies.turbine) 89 | 90 | // Hilt Testing 91 | // Local Unit Tests 92 | testImplementation(Dependencies.hiltTest) 93 | kaptTest(Dependencies.hiltCompiler) 94 | // Instrumentation Test 95 | androidTestImplementation(Dependencies.hiltTest) 96 | kaptAndroidTest(Dependencies.hiltCompiler) 97 | 98 | // Testing Compose 99 | androidTestImplementation(Dependencies.junitCompose) 100 | debugImplementation(Dependencies.composeTooling) 101 | 102 | // Compose 103 | implementation(Dependencies.composeUi) 104 | implementation(Dependencies.composeAnimation) 105 | implementation(Dependencies.composeMaterial) 106 | implementation(Dependencies.composePreview) 107 | implementation(Dependencies.composeActivity) 108 | implementation(Dependencies.composeViewModel) 109 | implementation(Dependencies.composeNavigation) 110 | implementation(Dependencies.composeMaterialIconsCore) 111 | implementation(Dependencies.composeMaterialIconsExtended) 112 | implementation(Dependencies.composeFoundation) 113 | implementation(Dependencies.composeFoundationLayout) 114 | implementation(Dependencies.composeConstraintLayout) 115 | 116 | // Retrofit 117 | implementation(Dependencies.retrofit) 118 | 119 | // Moshi 120 | implementation(Dependencies.moshi) 121 | implementation(Dependencies.moshiKotlin) 122 | 123 | // Timber 124 | implementation(Dependencies.timber) 125 | 126 | // Hilt 127 | implementation(Dependencies.hilt) 128 | implementation(Dependencies.hiltNavigationCompose) 129 | kapt(Dependencies.hiltCompiler) 130 | 131 | // Coil Image loader 132 | implementation(Dependencies.coilImage) 133 | 134 | // Accompanist 135 | implementation(Dependencies.accompanistInsets) 136 | implementation(Dependencies.accompanistNavigationAnimations) 137 | 138 | // Room database 139 | implementation(Dependencies.roomRuntime) 140 | implementation(Dependencies.roomKtx) 141 | kapt(Dependencies.roomCompiler) 142 | 143 | // Room test 144 | testImplementation(Dependencies.roomTest) 145 | 146 | // Preferences DataStore 147 | implementation(Dependencies.prefDataStore) 148 | 149 | // Splash Screen 150 | implementation(Dependencies.splashScreenCore) 151 | } 152 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle.kts. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/work/example/splishsplash/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.example.composetemplate", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 15 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/MyApplication.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash 2 | 3 | import android.app.Application 4 | import dagger.hilt.android.HiltAndroidApp 5 | 6 | @HiltAndroidApp 7 | class MyApplication: Application() -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/data/local/datastore/DataStoreHelpers.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.data.local.datastore 2 | 3 | import androidx.datastore.core.DataStore 4 | import androidx.datastore.preferences.core.Preferences 5 | import androidx.datastore.preferences.core.edit 6 | import kotlinx.coroutines.flow.Flow 7 | import kotlinx.coroutines.flow.catch 8 | import kotlinx.coroutines.flow.map 9 | import timber.log.Timber 10 | import java.io.IOException 11 | 12 | object DataStoreHelpers { 13 | 14 | suspend fun writePreference( 15 | dataStore: DataStore, 16 | preferenceKey: Preferences.Key, 17 | value: T 18 | ) = dataStore.edit { preferences -> 19 | preferences[preferenceKey] = value 20 | } 21 | 22 | fun readPreference( 23 | dataStore: DataStore, 24 | preferenceKey: Preferences.Key, 25 | defaultValue: T 26 | ): Flow = dataStore.data 27 | .catch { exception -> 28 | if (exception is IOException) { 29 | Timber.d(exception.message.toString()) 30 | } else { 31 | throw exception 32 | } 33 | }.map { preferences -> 34 | preferences[preferenceKey] ?: defaultValue 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/data/local/datastore/PrefDataStore.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.data.local.datastore 2 | 3 | import android.content.Context 4 | import androidx.datastore.core.DataStore 5 | import androidx.datastore.preferences.core.Preferences 6 | import androidx.datastore.preferences.core.intPreferencesKey 7 | import androidx.datastore.preferences.preferencesDataStore 8 | import work.example.splishsplash.di.IoDispatcher 9 | import work.example.splishsplash.utils.Constants 10 | import dagger.hilt.android.qualifiers.ApplicationContext 11 | import kotlinx.coroutines.CoroutineDispatcher 12 | import kotlinx.coroutines.CoroutineScope 13 | import kotlinx.coroutines.flow.Flow 14 | import javax.inject.Inject 15 | import javax.inject.Singleton 16 | 17 | // This is provided by Hilt for easy usage throughout the app 18 | @Singleton 19 | class PrefDataStore @Inject constructor( 20 | @ApplicationContext private val context: Context, 21 | @IoDispatcher private val dispatcher: CoroutineDispatcher 22 | ) { 23 | private object PreferenceKeys { 24 | val themeOption = intPreferencesKey(name = "theme_option") 25 | } 26 | 27 | private val Context.dataStore: DataStore by preferencesDataStore( 28 | name = Constants.PREFERENCE_NAME, 29 | scope = CoroutineScope(dispatcher) 30 | ) 31 | 32 | private val dataStore = context.dataStore 33 | 34 | // Theme Settings 35 | // See Theme enum class inside ui/theme/theme.kt for data meaning 36 | suspend fun saveThemeSetting(value: Int) { 37 | DataStoreHelpers.writePreference( 38 | dataStore, 39 | preferenceKey = PreferenceKeys.themeOption, 40 | value = value 41 | ) 42 | } 43 | 44 | val readThemeSetting: Flow = DataStoreHelpers.readPreference( 45 | dataStore, 46 | preferenceKey = PreferenceKeys.themeOption, 47 | defaultValue = -1 48 | ) 49 | 50 | 51 | } -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/di/DispatcherQualifiers.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.di 2 | 3 | import javax.inject.Qualifier 4 | 5 | @Qualifier 6 | @Retention(AnnotationRetention.BINARY) 7 | annotation class IoDispatcher 8 | 9 | @Qualifier 10 | @Retention(AnnotationRetention.BINARY) 11 | annotation class MainDispatcher 12 | 13 | @Qualifier 14 | @Retention(AnnotationRetention.BINARY) 15 | annotation class DefaultDispatcher -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/di/DispatchersModule.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.di 2 | 3 | import dagger.Module 4 | import dagger.Provides 5 | import dagger.hilt.InstallIn 6 | import dagger.hilt.components.SingletonComponent 7 | import kotlinx.coroutines.CoroutineDispatcher 8 | import kotlinx.coroutines.Dispatchers 9 | 10 | @Module 11 | @InstallIn(SingletonComponent::class) 12 | object DispatchersModule { 13 | 14 | @DefaultDispatcher 15 | @Provides 16 | fun providesDefaultDispatcher(): CoroutineDispatcher = Dispatchers.Default 17 | 18 | @IoDispatcher 19 | @Provides 20 | fun providesIoDispatcher(): CoroutineDispatcher = Dispatchers.IO 21 | 22 | @MainDispatcher 23 | @Provides 24 | fun providesMainDispatcher(): CoroutineDispatcher = Dispatchers.Main 25 | 26 | } -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/ui/components/Greating.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.ui.components 2 | 3 | import androidx.compose.material.Text 4 | import androidx.compose.runtime.Composable 5 | import androidx.compose.ui.tooling.preview.Preview 6 | import work.example.splishsplash.ui.theme.ComposeAndroidTemplateTheme 7 | 8 | @Composable 9 | fun Greeting(name: String) { 10 | Text(text = "Hello $name!") 11 | } 12 | 13 | @Preview(showBackground = true) 14 | @Composable 15 | fun DefaultPreview() { 16 | ComposeAndroidTemplateTheme { 17 | Greeting("Android") 18 | } 19 | } -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/ui/main/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.ui.main 2 | 3 | import android.os.Bundle 4 | import androidx.activity.ComponentActivity 5 | import androidx.activity.compose.setContent 6 | import androidx.compose.material.MaterialTheme 7 | import androidx.compose.material.Surface 8 | import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen 9 | import work.example.splishsplash.ui.components.Greeting 10 | import work.example.splishsplash.ui.theme.ComposeAndroidTemplateTheme 11 | import dagger.hilt.android.AndroidEntryPoint 12 | 13 | @AndroidEntryPoint 14 | class MainActivity : ComponentActivity() { 15 | override fun onCreate(savedInstanceState: Bundle?) { 16 | super.onCreate(savedInstanceState) 17 | // Enable support for Splash Screen API for 18 | // proper Android 12+ support 19 | installSplashScreen() 20 | 21 | setContent { 22 | ComposeAndroidTemplateTheme { 23 | // A surface container using the 'background' color from the theme 24 | Surface(color = MaterialTheme.colors.background) { 25 | Greeting("Compose") 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/ui/theme/Color.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.ui.theme 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | val PrimaryColor = Color(0xffea80fc) 6 | val PrimaryLightColor = Color(0xffffb2ff) 7 | val PrimaryDarkColor = Color(0xffb64fc8) 8 | 9 | val SecondaryColor = Color(0xffff80ab) 10 | val SecondaryLightColor = Color(0xffffb2dd) 11 | val SecondaryDarkColor = Color(0xffc94f7c) 12 | 13 | val PrimaryTextColor = Color(0xff000000) 14 | val SecondaryTextColor = Color(0xff000000) 15 | 16 | val SurfaceDark = Color(0xFF1e1e1e) 17 | -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/ui/theme/Dimens.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.ui.theme 2 | 3 | import androidx.compose.ui.unit.Dp 4 | import androidx.compose.ui.unit.dp 5 | 6 | enum class Dimens(val size: Dp) { 7 | SmallPadding(8.dp), 8 | MediumPadding(16.dp), 9 | UpperMediumPadding(20.dp), 10 | LargePadding(32.dp), 11 | ExtraLargePadding(64.dp) 12 | } -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/ui/theme/Shape.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.ui.theme 2 | 3 | import androidx.compose.foundation.shape.RoundedCornerShape 4 | import androidx.compose.material.Shapes 5 | import androidx.compose.ui.unit.dp 6 | 7 | val Shapes = Shapes( 8 | small = RoundedCornerShape(4.dp), 9 | medium = RoundedCornerShape(4.dp), 10 | large = RoundedCornerShape(0.dp) 11 | ) 12 | 13 | val BottomSheetShape = RoundedCornerShape( 14 | topStart = 20.dp, 15 | topEnd = 20.dp, 16 | bottomStart = 0.dp, 17 | bottomEnd = 0.dp 18 | ) 19 | -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/ui/theme/Theme.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.ui.theme 2 | 3 | import androidx.appcompat.app.AppCompatDelegate 4 | import androidx.compose.foundation.isSystemInDarkTheme 5 | import androidx.compose.material.MaterialTheme 6 | import androidx.compose.material.darkColors 7 | import androidx.compose.material.icons.Icons 8 | import androidx.compose.material.icons.outlined.DarkMode 9 | import androidx.compose.material.icons.outlined.LightMode 10 | import androidx.compose.material.icons.outlined.SettingsSuggest 11 | import androidx.compose.material.lightColors 12 | import androidx.compose.runtime.Composable 13 | import androidx.compose.ui.graphics.Color 14 | import androidx.compose.ui.graphics.vector.ImageVector 15 | 16 | private val LightColorPalette = lightColors( 17 | primary = PrimaryColor, 18 | primaryVariant = PrimaryDarkColor, 19 | onPrimary = PrimaryTextColor, 20 | secondary = SecondaryColor, 21 | secondaryVariant = SecondaryDarkColor, 22 | onSecondary = SecondaryTextColor, 23 | background = Color.White, 24 | onBackground = Color.Black, 25 | surface = Color.White, 26 | onSurface = Color.Black 27 | ) 28 | 29 | private val DarkColorPalette = darkColors( 30 | primary = PrimaryColor, 31 | primaryVariant = PrimaryLightColor, 32 | onPrimary = PrimaryTextColor, 33 | secondary = SecondaryColor, 34 | secondaryVariant = SecondaryLightColor, 35 | onSecondary = SecondaryTextColor, 36 | background = Color.Black, 37 | onBackground = Color.White, 38 | surface = SurfaceDark, 39 | onSurface = Color.White 40 | ) 41 | 42 | @Composable 43 | fun ComposeAndroidTemplateTheme( 44 | theme: Int = Theme.FOLLOW_SYSTEM.themeValue, 45 | content: @Composable () -> Unit 46 | ) { 47 | val autoColors = if (isSystemInDarkTheme()) DarkColorPalette else LightColorPalette 48 | 49 | val colors = when (theme) { 50 | 1 -> LightColorPalette 51 | 2 -> DarkColorPalette 52 | else -> autoColors 53 | } 54 | 55 | MaterialTheme( 56 | colors = colors, 57 | typography = Typography, 58 | shapes = Shapes, 59 | content = content 60 | ) 61 | } 62 | 63 | // To be used to set the preferred theme inside settings 64 | enum class Theme( 65 | val themeName: String, 66 | val icon: ImageVector, 67 | val themeValue: Int 68 | ) { 69 | FOLLOW_SYSTEM( 70 | themeName = "Follow System Settings", 71 | icon = Icons.Outlined.SettingsSuggest, 72 | themeValue = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM 73 | ), 74 | LIGHT_THEME( 75 | themeName = "Light Theme", 76 | icon = Icons.Outlined.LightMode, 77 | themeValue = AppCompatDelegate.MODE_NIGHT_NO 78 | ), 79 | DARK_THEME( 80 | themeName = "Dark Theme", 81 | icon = Icons.Outlined.DarkMode, 82 | themeValue = AppCompatDelegate.MODE_NIGHT_YES 83 | ); 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/ui/theme/Type.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.ui.theme 2 | 3 | import androidx.compose.material.Typography 4 | import androidx.compose.ui.text.TextStyle 5 | import androidx.compose.ui.text.font.FontFamily 6 | import androidx.compose.ui.text.font.FontWeight 7 | import androidx.compose.ui.unit.sp 8 | 9 | // Set of Material typography styles to start with 10 | val Typography = Typography( 11 | body1 = TextStyle( 12 | fontFamily = FontFamily.Default, 13 | fontWeight = FontWeight.Normal, 14 | fontSize = 16.sp 15 | ) 16 | /* Other default text styles to override 17 | button = TextStyle( 18 | fontFamily = FontFamily.Default, 19 | fontWeight = FontWeight.W500, 20 | fontSize = 14.sp 21 | ), 22 | caption = TextStyle( 23 | fontFamily = FontFamily.Default, 24 | fontWeight = FontWeight.Normal, 25 | fontSize = 12.sp 26 | ) 27 | */ 28 | ) -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/utils/Constants.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.utils 2 | 3 | object Constants { 4 | const val PREFERENCE_NAME = "settings_preference" 5 | } -------------------------------------------------------------------------------- /app/src/main/java/work/example/splishsplash/utils/Resource.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash.utils 2 | 3 | // Use this for handling data from network calls 4 | sealed class Resource( 5 | val data: T? = null, 6 | val message: String? = null 7 | ) { 8 | class Success(data: T): Resource(data = data) 9 | 10 | class Error( 11 | message: String, 12 | data: T? = null 13 | ): Resource(message = message, data = data) 14 | 15 | class Loading(data: T? = null): Resource(data) 16 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/avd_anim.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 11 | 17 | 22 | 23 | 29 | 30 | 33 | 34 | 39 | 44 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 64 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 85 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/animated_icon.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 11 | 17 | 22 | 23 | 29 | 34 | 37 | 38 | 44 | 47 | 50 | 51 | 52 | 53 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 71 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 92 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branding_image_drawable.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/branding_image_layer_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/morphing_animation.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 16 | 22 | 27 | 28 | 34 | 40 | 41 | 47 | 52 | 53 | 59 | 65 | 66 | 69 | 70 | 75 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 95 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 115 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 136 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 158 | 166 | 167 | 168 | 169 | 170 | 171 | 178 | 179 | 180 | 181 | 182 | 189 | 190 | 191 | 192 | 193 | 201 | 202 | 203 | 204 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/vectordrawable.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 15 | 19 | 20 | 21 | 22 | 23 | * 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/values-night-v31/splash_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #99606060 4 | #CCFFFFFF 5 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/splash_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values-v27/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/values-v31/splash_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | 9 | #FF000000 10 | #FFFFFFFF 11 | #FF1E1E1E 12 | 13 | #ea80fc 14 | #ffb2ff 15 | #b64fc8 16 | #ff80ab 17 | #ffb2dd 18 | #c94f7c 19 | #000000 20 | #000000 21 | 22 | #99dddddd 23 | #1E1E1E 24 | -------------------------------------------------------------------------------- /app/src/main/res/values/splash_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Splish Splash 3 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/test/java/work/example/splishsplash/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package work.example.splishsplash 2 | 3 | import org.junit.Test 4 | 5 | import org.junit.Assert.* 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * See [testing documentation](http://d.android.com/tools/testing). 11 | */ 12 | class ExampleUnitTest { 13 | @Test 14 | fun addition_isCorrect() { 15 | assertEquals(4, 2 + 2) 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | 4 | repositories { 5 | google() 6 | mavenCentral() 7 | maven(url = "https://www.jitpack.io") 8 | } 9 | dependencies { 10 | classpath(BuildPlugins.android) 11 | classpath(BuildPlugins.kotlin) 12 | classpath(BuildPlugins.daggerHilt) 13 | 14 | // NOTE: Do not place your application dependencies here; they belong 15 | // in the individual module build.gradle files 16 | } 17 | } 18 | 19 | task("clean", Delete::class) { 20 | delete(rootProject.buildDir) 21 | } -------------------------------------------------------------------------------- /buildSrc/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | build 3 | /.gradle 4 | .gradle 5 | /gradle 6 | gradle -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.gradle.kotlin.dsl.`kotlin-dsl` 2 | 3 | plugins { 4 | `kotlin-dsl` 5 | } 6 | 7 | repositories { 8 | google() 9 | mavenCentral() 10 | maven(url = "https://www.jitpack.io") 11 | } -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/AppConfig.kt: -------------------------------------------------------------------------------- 1 | object AppConfig { 2 | const val compileSdkVersion = 31 3 | const val minSdkVersion = 23 4 | const val targetSdkVersion = 31 5 | const val versionCode = 1 6 | const val versionName = "1.0.0" 7 | const val applicationId = "work.racka.splishsplash" 8 | } -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/BuildPlugins.kt: -------------------------------------------------------------------------------- 1 | 2 | object BuildPlugins { 3 | val android by lazy { "com.android.tools.build:gradle:${Versions.gradlePlugin}" } 4 | val kotlin by lazy { "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" } 5 | val daggerHilt by lazy { "com.google.dagger:hilt-android-gradle-plugin:${Versions.hilt}" } 6 | } -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/Dependencies.kt: -------------------------------------------------------------------------------- 1 | 2 | object Dependencies { 3 | 4 | // Essentials 5 | val coreKtx by lazy { "androidx.core:core-ktx:${Versions.coreKtx}" } 6 | val appCompat by lazy { "androidx.appcompat:appcompat:${Versions.appCompat}" } 7 | val material by lazy { "com.google.android.material:material:${Versions.material}" } 8 | 9 | // Lifecycle components 10 | val lifecycleRuntimeKtx by lazy { "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.lifecycleRuntimeKtx}" } 11 | 12 | // Testing 13 | val junit by lazy { "junit:junit:${Versions.junit}" } 14 | val junitTest by lazy { "androidx.test.ext:junit:${Versions.junitTest}" } 15 | val espressoCore by lazy { "androidx.test.espresso:espresso-core:${Versions.espressoTest}" } 16 | val testCoreKtx by lazy { "androidx.test:core-ktx:${Versions.testCore}" } 17 | val testArchCore by lazy { "androidx.arch.core:core-testing:${Versions.testArchCore}" } 18 | val testExtJUnitKtx by lazy { "androidx.test.ext:junit-ktx:${Versions.testExtJUnit}" } 19 | val mockitoInline by lazy { "org.mockito:mockito-inline:${Versions.mockito}" } 20 | val mockitoAndroid by lazy { "org.mockito:mockito-android:${Versions.mockito}" } 21 | val mockitoKotlin by lazy { "org.mockito.kotlin:mockito-kotlin:${Versions.mockitoKotlin}" } 22 | val robolectric by lazy { "org.robolectric:robolectric:${Versions.robolectric}" } 23 | val turbine by lazy { "app.cash.turbine:turbine:${Versions.turbine}" } 24 | val coroutineTest by lazy { "org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions.coroutineTest}" } 25 | 26 | // Compose Testing 27 | val junitCompose by lazy { "androidx.compose.ui:ui-test-junit4:${Versions.compose}" } 28 | val composeTooling by lazy { "androidx.compose.ui:ui-tooling:${Versions.compose}" } 29 | 30 | // Compose 31 | val composeUi by lazy { "androidx.compose.ui:ui:${Versions.compose}" } 32 | val composeMaterial by lazy { "androidx.compose.material:material:${Versions.compose}" } 33 | val composeAnimation by lazy { "androidx.compose.animation:animation:${Versions.compose}" } 34 | val composePreview by lazy { "androidx.compose.ui:ui-tooling-preview:${Versions.compose}" } 35 | val composeActivity by lazy { "androidx.activity:activity-compose:${Versions.activityCompose}" } 36 | val composeViewModel by lazy { "androidx.lifecycle:lifecycle-viewmodel-compose:${Versions.lifecycleViewModelCompose}" } 37 | val composeNavigation by lazy { "androidx.navigation:navigation-compose:${Versions.composeNavigation}" } 38 | val composeMaterialIconsCore by lazy { "androidx.compose.material:material-icons-core:${Versions.compose}" } 39 | val composeMaterialIconsExtended by lazy { "androidx.compose.material:material-icons-extended:${Versions.compose}" } 40 | val composeFoundation by lazy { "androidx.compose.foundation:foundation:${Versions.compose}" } 41 | val composeFoundationLayout by lazy { "androidx.compose.foundation:foundation-layout:${Versions.compose}" } 42 | val composeConstraintLayout by lazy { "androidx.constraintlayout:constraintlayout-compose:${Versions.composeConstraintLayout}" } 43 | 44 | // Networking & JSON 45 | val retrofit by lazy { "com.squareup.retrofit2:converter-moshi:${Versions.retrofit}" } 46 | val moshi by lazy { "com.squareup.moshi:moshi:${Versions.moshi}" } 47 | val moshiKotlin by lazy { "com.squareup.moshi:moshi-kotlin:${Versions.moshi}" } 48 | 49 | // Timber Logging 50 | val timber by lazy { "com.jakewharton.timber:timber:${Versions.timber}" } 51 | 52 | // Dagger Hilt 53 | val hilt by lazy { "com.google.dagger:hilt-android:${Versions.hilt}" } 54 | val hiltNavigationCompose by lazy { "androidx.hilt:hilt-navigation-compose:${Versions.hiltNavigationCompose}" } 55 | val hiltCompiler by lazy { "com.google.dagger:hilt-android-compiler:${Versions.hilt}" } 56 | // Hilt testing 57 | val hiltTest by lazy { "com.google.dagger:hilt-android-testing:${Versions.hilt}" } 58 | 59 | // Coil image loader 60 | val coilImage by lazy { "io.coil-kt:coil-compose:${Versions.coilImage}" } 61 | 62 | // Accompanist 63 | val accompanistInsets by lazy { "com.google.accompanist:accompanist-insets:${Versions.accompanist}" } 64 | val accompanistNavigationAnimations by lazy { "com.google.accompanist:accompanist-navigation-animation:${Versions.accompanist}" } 65 | 66 | // Room 67 | val roomRuntime by lazy { "androidx.room:room-runtime:${Versions.room}" } 68 | val roomCompiler by lazy { "androidx.room:room-compiler:${Versions.room}" } 69 | val roomKtx by lazy { "androidx.room:room-ktx:${Versions.room}" } 70 | val roomTest by lazy { "androidx.room:room-testing:${Versions.room}" } 71 | 72 | // Preferences DataStore 73 | val prefDataStore by lazy { "androidx.datastore:datastore-preferences:${Versions.dataStore}" } 74 | 75 | // Splash Screen 76 | val splashScreenCore by lazy { "androidx.core:core-splashscreen:${Versions.splashScreen}" } 77 | 78 | } -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/Versions.kt: -------------------------------------------------------------------------------- 1 | object Versions { 2 | // Kotlin 3 | const val kotlin = "1.5.30" 4 | 5 | // Essentials 6 | const val material = "1.4.0" 7 | const val splashScreen = "1.0.0-alpha01" 8 | const val appCompat = "1.3.1" 9 | const val gradlePlugin = "7.0.2" 10 | const val coreKtx = "1.6.0" 11 | 12 | // Compose Base 13 | const val composeKotlin = "1.5.30" 14 | const val compose = "1.1.0-alpha04" 15 | const val composeConstraintLayout = "1.0.0-beta02" 16 | const val activityCompose = "1.3.1" 17 | 18 | // Navigation 19 | const val composeNavigation = "2.4.0-alpha08" 20 | 21 | // Lifecycle components 22 | const val lifecycleViewModelCompose = "1.0.0-alpha07" 23 | const val lifecycleRuntimeKtx = "2.3.1" 24 | 25 | // Dependency Injection 26 | const val hilt = "2.38.1" 27 | const val hiltNavigationCompose = "1.0.0-alpha03" 28 | 29 | // Testing 30 | const val junit = "4.13.2" 31 | const val junitTest = "1.1.3" 32 | const val espressoTest = "3.4.0" 33 | const val testCore = "1.4.0" 34 | const val testArchCore = "2.1.0" 35 | const val testExtJUnit = "1.1.3" 36 | const val mockito = "3.12.4" 37 | const val mockitoKotlin = "3.2.0" 38 | const val robolectric = "4.3.1" 39 | const val turbine = "0.6.1" 40 | const val coroutineTest = "1.5.1" 41 | 42 | // Logging 43 | const val timber = "4.7.1" 44 | 45 | // Helpers 46 | const val accompanist = "0.18.0" 47 | const val coilImage = "1.3.2" 48 | 49 | // Networking & JSON 50 | const val moshi = "1.12.0" 51 | const val retrofit = "2.9.0" 52 | 53 | // Database 54 | const val room = "2.3.0" 55 | 56 | // DataStore 57 | const val dataStore = "1.0.0" 58 | 59 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | # Kotlin code style for this project: "official" or "obsolete": 21 | kotlin.code.style=official 22 | org.gradle.unsafe.configuration-cache=true 23 | 'org.gradle.unsafe.configuration-cache-problems=warn' 24 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/racka98/Splash-Screen-API-Demo/347543b42c3c0dcb223ee55e964c2b65c541b6a0/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Oct 05 18:45:26 EAT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | dependencyResolutionManagement { 2 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 3 | repositories { 4 | google() 5 | mavenCentral() 6 | maven(url = "https://www.jitpack.io") 7 | } 8 | } 9 | rootProject.name = "Splish Splash" 10 | include(":app") 11 | --------------------------------------------------------------------------------