Giter VIP home page Giter VIP logo

gifplayer's Introduction

GifPlayer

Simple and small library to play Graphics Interchange Format (GIF) in Android with Start, Stop, Resume, Pause, Completion the controls with Callbacks.

Sample Project output:

GifPlayer Alt GifPlayer GifPlayer GifPlayer GifPlayer

Advantages

  • Play GIF One time or Repeatedly.

  • Get notified for each action that you perform

Actions Listners
start() onGifStarted()
stop() onGifStopped()
pause() onGifPaused()
resume() onGifResumed()
-- onGifComplete()

NOTE : onGifComplete() will be notified if GIF is in PLAY_ONCE mode.

  • It is just a View so you can add this view to any layout in your app such as
    • Activity
    • Fragment
    • Style Sheets
    • Dialogs etc...

Usage :

Add Gradle Dependency in your build.gradle file

compile 'com.whiteelephant:gifplayer:1.2.0'

or Maven

<dependency>
<groupId>com.whiteelephant</groupId>
<artifactId>gifplayer</artifactId>
<version>1.0.0</version>
<type>pom</type>
 </dependency>
Add the GIF view to your layout
<com.whiteelephant.gifplayer.GifView
   android:id="@+id/gif"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   app:animationSpeed="1"
   app:playMode="PLAY_REPEAT"
   app:src="@raw/car" />

Code :

Once your GifView is ready call start() method to start Gif to play

 GifView gifView = (GifView) findViewById(R.id.gif);
 gifView.start();
Custom xml attributes:
  • animationSpeed : Speed of GIF. Programmatically increase/decrease the Speed of GIF. The default speed is 1.
  • playMode : We can play the GIF only once or repeat. You can set the PLAY_REPEAT or PLAY_ONCE.
  • src : Pass the GIF
Set attributes Programmatically:
  • setAnimationSpeed(float speed)
  • setPlayMode(int playMode)
  • setGIFResource(@RawRes gif)
Add the listeners:

We seriously don't want you to implement unnecessary listeners, just add those which really you use.

addOnStartListener(GifView.GifStartListener onStart)
addOnStopListener(GifView.GifStartListener onStop)
addOnResumeListener(GifView.GifResumeListener onResume)
addOnPauseListener(GifView.GifPauseListener onPause)
addOnCompletionListener(GifView.GifCompletionListener onCompletion)  

Icon Credit: http://www.flaticon.com/

gifplayer's People

Contributors

premkumarroyal avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.