项目作者: felipecsl

项目描述 :
Android ImageView that handles animated GIF images
高级语言: Java
项目地址: git://github.com/felipecsl/GifImageView.git
创建时间: 2014-05-14T20:20:24Z
项目社区:https://github.com/felipecsl/GifImageView

开源协议:MIT License

下载


GifImageView

Android ImageView that handles Animated GIF images

Android Arsenal
Build Status

Usage

In your build.gradle file:

  1. dependencies {
  2. implementation 'com.felipecsl:gifimageview:2.2.0'
  3. }

In your Activity class:

  1. @Override protected void onCreate(final Bundle savedInstanceState) {
  2. super.onCreate(savedInstanceState);
  3. gifView = findViewById(R.id.gifImageView);
  4. gifView.setBytes(bitmapData);
  5. }
  6. @Override protected void onStart() {
  7. super.onStart();
  8. gifView.startAnimation();
  9. }
  10. @Override protected void onStop() {
  11. super.onStop();
  12. gifView.stopAnimation();
  13. }

If you need to post-process the GIF frames, you can do that via GifImageView.setOnFrameAvailable().
You can see an example of that in the sample app included on the repository.

  1. gifImageView.setOnFrameAvailable(new GifImageView.OnFrameAvailable() {
  2. @Override public Bitmap onFrameAvailable(Bitmap bitmap) {
  3. return blurFilter.blur(bitmap);
  4. }
  5. });

You can also reset an animation to play again from the beginning gifImageView.resetAnimation(); or show a specific frame of the animation gifImageView.gotoFrame(3);

Demo

Be sure to also check the demo project for a sample of usage!

Snapshots of the development version are available in Sonatype’s snapshots repository.

Contributing

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

Code and documentation copyright 2011- Felipe Lima.
Code released under the MIT license.