Android library for getting a nice and simple SlashScreen into your Android app.
Up to now, the library is only available on JitPack. Please add this code to your build.gradle file on project level:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
To load the library into your project, use this code in the build.gradle file within the app module:
implementation 'com.github.mrgames13:SplashScreen:1.0.5'
To use the SplashScreen, paste this code to the beginning of the onCreate
method of the launcher activity of your app. For better performance, we recommend to do this before setContentView()
.
SplashScreenBuilder.getInstance(this)
.setVideo(R.raw.splash_animation)
.setVideoDark(R.raw.splash_animation_dark)
.setImage(R.drawable.app_icon)
.show();
If you want to receive a result from the SplashScreen, you can override onActivtyResult as following:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == SplashScreenBuilder.SPLASH_SCREEN_FINISHED) {
if(resultCode == RESULT_OK) {
//SplashScreen finished without manual canceling
} else if(resultCode == RESULT_CANCELED) {
//SplashScreen finished through manual canceling
}
}
}
You can customize the appearance of the SplashScreen using following arguments when building the Activity with SplashScreenBuilder
:
Method | Description |
---|---|
setVideo(int res_id) | Sets the animation video of the SplashScreen. You have to pass this argument, otherwise the app will get an error. |
setVideoDark(int res_id) | Set the animation video of the Splash Screen for the dark theme. |
setImage(int res_id) | Sets the image of the SplashScreen, which is displayed when the animation has ended. You have to pass this argument, otherwise the app will get an error. |
setTextFadeInDuration(int millis) | You can call this method to set the duration of the fade in animation of the title and the subtitle. |
setTitle(String title) | This method replaces the name of your app, which is the default title of the SplashScreen, with a custom string. |
setSubtitle(String title) | This method replaces the default subtitle, with a custom string. |
skipImage(boolean skip) | This opens the ability to skip the image after the video. |
Thank you for using the SplashScreen!
© M&R Games 2018-2019 (Designed and developed by Marc Auberer in 2018 and 2019)