|
| 1 | +# SplashApplication |
| 2 | +Developing easy to use any animation set or animation list upon a single view or mulltiple views at a time as splash screen in Android application |
| 3 | + |
| 4 | +# Alpha Release |
| 5 | +Alpha release of Starter Animation for android application. Feel free to suggest. Thank you |
| 6 | + |
| 7 | +# Features |
| 8 | +- Create an Starter/Splash animation with any animation |
| 9 | +- Can able to use multiple animation files on a single view. |
| 10 | +- Easy implementation for any activity and fragment |
| 11 | + |
| 12 | +# Implementation |
| 13 | +- **Step-1: Add the JitPack repository to your build file** |
| 14 | +``` |
| 15 | +allprojects { |
| 16 | + repositories { |
| 17 | + ... |
| 18 | + maven { url 'https://jitpack.io' } |
| 19 | + } |
| 20 | + } |
| 21 | +``` |
| 22 | +- **Step-2: Add the dependency** |
| 23 | +``` |
| 24 | +dependencies { |
| 25 | + implementation "com.github.sam43:SplashApplication:$latest_version" |
| 26 | + } |
| 27 | +``` |
| 28 | +where last release version is the `letest_version`. |
| 29 | + |
| 30 | +- **Step-3: Create list of animations to be applied to** |
| 31 | +We will be creating a list of animation like below and pass it to the library with the view, on which the animation will be applied. List of animation method, will be something like this :- |
| 32 | +``` |
| 33 | +private fun getAnimList(): ArrayList<Animation> { |
| 34 | + // create list of animations |
| 35 | + val animList: ArrayList<Animation> = ArrayList() |
| 36 | + val anim = AnimationUtils.loadAnimation( |
| 37 | + applicationContext, |
| 38 | + R.anim.no_animaiton |
| 39 | + ) |
| 40 | + val anim1 = AnimationUtils.loadAnimation( |
| 41 | + applicationContext, |
| 42 | + R.anim.rotate |
| 43 | + ) |
| 44 | + . |
| 45 | + . |
| 46 | + . |
| 47 | + |
| 48 | + animList.add(anim) |
| 49 | + animList.add(anim1) |
| 50 | + . |
| 51 | + . |
| 52 | + . |
| 53 | +
|
| 54 | + return animList |
| 55 | + } |
| 56 | +``` |
| 57 | + |
| 58 | +- **Step-4: Use the animation list for the library** |
| 59 | +Finally, We will be passing the list and implement the listener provided which will notify the application when animations have ended. The implementation will be like below:- |
| 60 | +```StarterAnimation( |
| 61 | + resList = getAnimList(), |
| 62 | + onAnimationListener = object : OnAnimationListener { |
| 63 | + override fun onRepeat() {} |
| 64 | +
|
| 65 | + override fun onEnd() { |
| 66 | + // TODO: Do what you want to do after end of animations |
| 67 | + } |
| 68 | +
|
| 69 | + override fun onStartAnim() {} |
| 70 | + } |
| 71 | + ).startSequentialAnimation(view = imageView) |
| 72 | +``` |
| 73 | +Well, That's all. Please let me know if you guys have any suggestions. Any suggestion will be appreciated. Thanks |
| 74 | + |
| 75 | + |
0 commit comments