Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skyfe79/FAImageView
FAImageView is a Frame Animation ImageView for Android.
https://github.com/skyfe79/FAImageView
Last synced: about 2 months ago
JSON representation
FAImageView is a Frame Animation ImageView for Android.
- Host: GitHub
- URL: https://github.com/skyfe79/FAImageView
- Owner: skyfe79
- License: mit
- Created: 2015-10-22T12:51:15.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-12T03:39:21.000Z (over 8 years ago)
- Last Synced: 2024-04-16T12:09:42.255Z (8 months ago)
- Language: Java
- Size: 1.84 MB
- Stars: 188
- Watchers: 9
- Forks: 40
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - FAImageView - FAImageView is a Frame Animation ImageView for Android. (etc)
- awesome - FAImageView - FAImageView is a Frame Animation ImageView for Android. (etc)
README
# FAImageView
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-FAImageView-green.svg?style=flat)](https://android-arsenal.com/details/1/2682)
FAImageView is a Frame Animation ImageView for Android. You can set multiple frame images and start frame animation like UIImageView in iOS. You can animate multiple image like below!
![](FAImageView.gif)
## Setup Gradle
```groovy
dependencies {
...
compile 'kr.pe.burt.android.lib:faimageview:0.0.8'
}
```## Usages
Declare FAImageView widget in the layout xml file.
```xml
```
Set the options whatever you want
```java
public class MainActivity extends AppCompatActivity {FAImageView faImageView1, faImageView2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);faImageView1 = (FAImageView)findViewById(R.id.faimageview1);
faImageView1.setInterval(30);
faImageView1.setLoop(true);
faImageView1.addImageFrame(R.drawable.frame01);
faImageView1.addImageFrame(R.drawable.frame02);
faImageView1.addImageFrame(R.drawable.frame03);
faImageView1.addImageFrame(R.drawable.frame04);
faImageView1.addImageFrame(R.drawable.frame05);
faImageView1.addImageFrame(R.drawable.frame06);
faImageView1.addImageFrame(R.drawable.frame07);
faImageView1.addImageFrame(R.drawable.frame08);
faImageView1.addImageFrame(R.drawable.frame09);
faImageView1.addImageFrame(R.drawable.frame10);faImageView2 = (FAImageView)findViewById(R.id.faimageview2);
faImageView2.setInterval(100);
faImageView2.setLoop(true);
faImageView2.addImageFrame(R.drawable.frame01);
faImageView2.addImageFrame(R.drawable.frame02);
faImageView2.addImageFrame(R.drawable.frame03);
faImageView2.addImageFrame(R.drawable.frame04);
faImageView2.addImageFrame(R.drawable.frame05);
faImageView2.addImageFrame(R.drawable.frame06);
faImageView2.addImageFrame(R.drawable.frame07);
faImageView2.addImageFrame(R.drawable.frame08);
faImageView2.addImageFrame(R.drawable.frame09);
faImageView2.addImageFrame(R.drawable.frame10);}
@Override
protected void onResume() {
super.onResume();
faImageView1.startAnimation();
faImageView2.startAnimation();
}@Override
protected void onPause() {
super.onPause();
faImageView1.stopAnimation();
faImageView2.stopAnimation();
}
}
```
## CallbacksFAImageView provides some listeners for animation event.
* for listening to animation start.
* OnStartAnimationListener
* for listening to animation completion.
* OnFinishAnimationListener
* for listening to animation frame change event
* OnFrameChangedListener```java
faImageView.setOnStartAnimationListener(new FAImageView.OnStartAnimationListener() {
@Override
public void onStartAnimation() {
Log.v("FAImageView", "Animation started");
}
});faImageView.setOnFinishAnimationListener(new FAImageView.OnFinishAnimationListener() {
@Override
public void onFinishAnimation(boolean isLoopAnimation) {
if(isLoopAnimation) {
Log.v("FAImageView", "finished an animation cycle.");
} else {
Log.v("FAImageView", "Animation is completed");
}
}
});faImageView.setOnFrameChangedListener(new FAImageView.OnFrameChangedListener() {
@Override
public void onFrameChanged(int index) {
Log.v("FAImageView", String.format("frameIndex : %d", index));
}
});
```## APIs
* setInterval(int milli)
* set frame interval for animation in milli seconds
* addImageFrame(int resId)
* addImageFrame(Drawable drawable)
* addImageFrame(Bitmap bitmap)
* add an Image Frame
* setLoop(boolean loop)
* If you want to animate infinitely set true or false. Default value is false.
* setRestoreFirstFrameWhenFinishAnimation(boolean restore)
* If you want to restore the first frame when animation is finished, set true or false.
* setAnimationRepeatCount(int animationRepeatCount)
* Only If your animation is not infinity, this value is valuable.
* startAnimation()
* start animation
* stopAnimation
* stop animation
* isAnimating
* check it's now animating
* reset
* clear all resources and stop animation.
## MIT LicenseThe MIT License
Copyright © 2015 Sungcheol Kim, http://github.com/skyfe79/FAImageView
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.