AnimateViewLibrary
Developing easy to use any animation set for splash screen or any other views in your Android application. Easy to use, so you can animate your whole app just using this library.
Alpha Release
Alpha release of Starter Animation for android application. Feel free to suggest. Thank you
Features
- Create an Starter/Splash animation with any animation
- Can able to use multiple animation files on a single view.
- Easy implementation for any activity and fragment
Demo (.GIF)
Implementation
- Step-1: Add the JitPack repository to your build file
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
- Step-2: Add the dependency
dependencies {
implementation "com.github.sam43:AnimateViewLibrary:$latest_version"
}
where last release version is the letest_version
.
- Step-3: Create list of animations to be applied to 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 :-
Kotlin Implementation:
private fun getAnimList(): ArrayList
{
// create list of animations
val animList: ArrayList
= ArrayList()
animList.add(createAnimation(applicationContext, R.anim.no_animaiton))
animList.add(createAnimation(applicationContext, R.anim.rotate))
animList.add(createAnimation(applicationContext, R.anim.zoom_out_fast))
animList.add(createAnimation(applicationContext, R.anim.fade_in))
return animList
}
Java Implementation:
private ArrayList
getAnimList() {
ArrayList
animList = new ArrayList<>();
// We need to add INSTANCE when ever we need to access a object file in kotlin from java class
// This denotes that CreateAnim is a singleton file and can able to have only one instance
animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.no_animaiton));
animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.rotate));
animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.zoom_out_fast));
animList.add(CreateAnim.INSTANCE.createAnimation(getApplicationContext(), R.anim.fade_in));
return animList;
}
- Step-4: Use the animation list for the library 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:-
Kotlin Implementation:
StarterAnimation(
resList = getAnimList(),
onAnimationListener = object : OnAnimationListener {
override fun onRepeat() {}
override fun onEnd() {
// TODO: Do what you want to do after end of animations
}
override fun onStartAnim() {
}
}
).startSequentialAnimation(view = imageView)
Java Implementation:
ImageView appLogo = findViewById(R.id.imageView);
new StarterAnimation(getAnimList(), new OnAnimationListener() {
@Override
public void onStartAnim() { // TODO::
}
@Override
public void onRepeat() { // TODO::
}
@Override
public void onEnd() {
// TODO: Do what you want to do after end of animations
}
}).startSequentialAnimation(appLogo);
Well, That's all. Please let me know if you guys have any suggestions. Any suggestion will be appreciated. Thanks
License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright [2020] [A S M Sayem]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.