AwesomeSplash Documentation

repository·master·Indexed 21 days ago

https://github.com/viksaaskool/awesomesplash

An Android library for creating customizable, animated splash screens featuring circular reveals, SVG path animations, and logo transitions. It provides the AwesomeSplash activity base class and ConfigSplash object to manage background colors, animation durations, and text styling.

Tokens
1.1K
Snippets
3
Records
3
Agent score
24%

What's inside AwesomeSplash

  1. Install AwesomeSplash via JitPack

    master

    To use AwesomeSplash in your Android project, add the JitPack repository to your settings.gradle file and then add the library dependency to your build.gradle file.

    Note: Ensure you use the correct version string (e.g., v1.0.0).

    // settings.gradle
    repositories {
        //...
        maven { url "https://jitpack.io" }
    }
    
    // build.gradle
    dependencies {
        implementation 'com.github.ViksaaSkool:AwesomeSplash:v1.0.0'
    }
  2. Implement AwesomeSplash in an Activity

    master

    To use the library, your Activity must extend AwesomeSplash.

    Critical Rules:

    1. DO NOT override onCreate(). If you need to initialize services or logic, do it inside the initSplash() method.
    2. Use initSplash(configSplash: ConfigSplash?) to configure the visual elements of the splash screen.
    3. Use animationsFinished() to handle the transition to your main application activity once the splash sequence is complete.
    // Kotlin Implementation
    class YourActivity : AwesomeSplash() {
    
        override fun initSplash(configSplash: ConfigSplash?) {
            configSplash?.let {
                // Configuration goes here
            }
        }
    
        override fun animationsFinished() {
            // Transition to another activity here
        }
    }
  3. Configure the Splash Screen via ConfigSplash

    master

    The ConfigSplash object allows you to customize several visual layers of the splash screen. You do not need to override every property.

    Circular Reveal

    Controls the background transition effect.

    • backgroundColor: Color resource (e.g., R.color.purple_500).
    • animCircularRevealDuration: Duration in milliseconds.
    • revealFlagX: Direction for X-axis (Flags.REVEAL_RIGHT or Flags.REVEAL_LEFT).
    • revealFlagY: Direction for Y-axis (Flags.REVEAL_BOTTOM or Flags.REVEAL_TOP).

    Logo or SVG Path

    You can choose between a static Logo or a dynamic SVG Path. If pathSplash is not provided, the library defaults to using the Logo.

    Logo Customization:

    • logoSplash: Drawable resource (e.g., R.mipmap.ic_launcher).
    • animLogoSplashDuration: Duration in milliseconds.
    • animLogoSplashTechnique: Animation style from Techniques (e.g., Techniques.Bounce).

    SVG Path Customization: Requires an SVG path string (e.g., Constants.DROID_LOGO).

    • originalHeight / originalWidth: Dimensions relative to your SVG resource.
    • animPathStrokeDrawingDuration: Duration for the stroke drawing animation.
    • pathSplashStrokeSize: Thickness of the stroke (recommended value < 5).
    • pathSplashStrokeColor: Color resource for the stroke.
    • animPathFillingDuration: Duration for the fill animation.
    • pathSplashFillColor: Color for the path object filling.

    Title Customization

    • titleSplash: The text to display.
    • titleTextColor: Color resource.
    • titleTextSize: Font size (float).
    • animTitleDuration: Duration in milliseconds.
    • animTitleTechnique: Animation style from Techniques (e.g., Techniques.FlipInX).
    • titleFont: Path to the font file in your assets/fonts/ directory.
    // Example configuration in Kotlin
    override fun initSplash(configSplash: ConfigSplash?) {
        configSplash?.let {
            it.backgroundColor = R.color.purple_500
            it.revealFlagX = Flags.REVEAL_RIGHT
            it.logoSplash = R.mipmap.ic_launcher
            it.animLogoSplashTechnique = Techniques.Bounce
            it.pathSplash = Constants.DROID_LOGO
            it.titleSplash = "My Awesome App"
            it.titleFont = "fonts/myfont.ttf"
        }
    }