GithubHelp home page GithubHelp logo

chillibits / splash-screen Goto Github PK

View Code? Open in Web Editor NEW
107.0 7.0 15.0 4.89 MB

Android library for getting a nice and simple SlashScreen into your Android app

License: MIT License

Kotlin 85.65% Java 14.35%
android splash splashscreen android-library chillibits

splash-screen's Introduction

Android SplashScreen

Codacy Badge Android CI Android Arsenal API PRs Welcome

Android library for getting a nice and simple splash screen into your Android app.

Animated demo

Installation

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.ChilliBits:splash-screen:1.1.7'

Usage

To use the splash screen, 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()

Tip: If you want to have a custom activity transition, you can call overridePendingTransition(R.anim.customEnterAnim, R.anim.customExitAnim) after dispatching .show() of the splash screen.

If you want to receive a result from the splash screen, you can override onActivityResult as following:

Kotlin

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)
    if (requestCode == SplashScreenBuilder.SPLASH_SCREEN_FINISHED) {
        if (resultCode == Activity.RESULT_OK) {
            //SplashScreen finished without manual canceling
        } else if (resultCode == Activity.RESULT_CANCELED) {
            //SplashScreen finished through manual canceling
        }
    }
}

If you want to have a look onto a implemented example in Kotlin, look at the MainActivity.kt file.

Java

@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
        }
    }
}

If you want to have a look onto a implemented example in Java, look at the MainActivity.java file.

You can customize the appearance of the SplashScreen using following arguments when building the Activity with SplashScreenBuilder:

Builder method Description of functionality
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.
skipVideo(boolean skip) This opens the ability to skip the video and display the image directly

Thank you for using the SplashScreen library!

© ChilliBits 2018-2021 (Designed and developed by Marc Auberer)

splash-screen's People

Contributors

codacy-badger avatar dependabot-preview[bot] avatar dependabot[bot] avatar marcauberer avatar mrgames13 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

splash-screen's Issues

Splash image without video

Would it be possible to have the splash image without any animation?

The animation could be optional.

NoSuchFieldError

Hello,

First off, this is a really nice library. And I can't wait to start using it in production apps. That being said, there's a bug in the library. Check out the log below:

java.lang.NoSuchFieldError: No field app_icon_animation of type I in class Lcom/mrgames13/jimdo/splashscreen/R$id; or its superclasses (declaration of 'com.mrgames13.jimdo.splashscreen.R$id' appears in /data/app/solutions.unorthodox.trade54-2/split_lib_slice_2_apk.apk) at com.mrgames13.jimdo.splashscreen.App.SplashActivity.onCreate(SplashActivity.java:60) at android.app.Activity.performCreate(Activity.java:6670) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2789) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1527) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:203) at android.app.ActivityThread.main(ActivityThread.java:6259) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)

Can you please look into this and how to solve it. Thanks

Library integration issue

After integrating the library, its telling error like,

Manifest merger failed : Attribute application@theme value=(@style/Theme.VideoSplash) from AndroidManifest.xml:12:9-49
is also present at [com.github.ChilliBits:splash-screen:1.1.6] AndroidManifest.xml:17:9-40 value=(@style/AppTheme).
Suggestion: add 'tools:replace="android:theme"' to element at AndroidManifest.xml:5:5-20:19 to override.

Media playback paused on open SplashScreen

Media playback (music / video) pauses when opening the demo app. The issue is caused by a stream overlap of the built in VideoView and the media playback. Will be fixed soon!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.