All Projects → premkumarroyal → GifPlayer

premkumarroyal / GifPlayer

Licence: Apache-2.0 license
This Project gives a custom view for developers to play the Graphics Interchange Format (GIF) with Start, Stop, Resume and Pause the controls and Callbacks.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to GifPlayer

Gifview
Library for playing gifs on Android
Stars: ✭ 1,689 (+8789.47%)
Mutual labels:  gifview
SSSwiftUIGIFView
SSSwiftUIGIFView is a custom controller which helps to load GIF in SwiftUI.
Stars: ✭ 48 (+152.63%)
Mutual labels:  gifview
GiphyImageResultsPreview
Library for GIF results, preview, play, share everything at one place!
Stars: ✭ 28 (+47.37%)
Mutual labels:  gifview
Gifflen-Android
Android上合成gif图片.
Stars: ✭ 54 (+184.21%)
Mutual labels:  android-gif

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/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].