Giter VIP home page Giter VIP logo

gifimageview's Introduction

GifImageView

Android ImageView that handles Animated GIF images

Android Arsenal Build Status

Usage

In your build.gradle file:

dependencies {
    implementation 'com.felipecsl:gifimageview:2.2.0'
}

In your Activity class:

@Override protected void onCreate(final Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  gifView = findViewById(R.id.gifImageView);
  gifView.setBytes(bitmapData);
}

@Override protected void onStart() {
  super.onStart();
  gifView.startAnimation();
}

@Override protected void onStop() {
  super.onStop();
  gifView.stopAnimation();
}

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.

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

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.

Copyright and license

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

gifimageview's People

Contributors

eltos avatar felipecsl avatar gabepaez avatar ivanabakumov avatar keewon avatar luciofm avatar seanponeil avatar thest1 avatar xrigau avatar zbsz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gifimageview's Issues

CreateProcess error=2, The system cannot find the file specified

i cant build app error is: CreateProcess error=2, The system cannot find the file specified

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformNativeLibsWithStripDebugSymbolForDebug'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'G:\Androidsdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip''
at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:222)
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:202)
at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:342)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86)
at org.gradle.internal.operations.BuildOperationIdentifierPreservingRunnable.run(BuildOperationIdentifierPreservingRunnable.java:39)
... 6 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'G:\Androidsdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
... 7 more
Caused by: java.io.IOException: Cannot run program "G:\Androidsdk\ndk-bundle\toolchains\mips64el-linux-android-4.9\prebuilt\windows-x86_64\bin\mips64el-linux-android-strip" (in directory "D:\Android\GifImageView-master\app"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 10 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:386)
at java.lang.ProcessImpl.start(ProcessImpl.java:137)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 11 more

local gif picture

in the demo, the .gif pic is downloaded from network, if I want to display the local .gif picture, located in res/drawable-xhdpi for example, then how to code ? is it impossible ?

Gif play speed varies from device to device

I noticed that on an older device I have (Galaxy S4 - 4.4.4) and on the emulators running 6.0, the gif I am using plays back at normal speed. However I just tried running it on a Galaxy S7 (6.0.1) and the playback speed of the gif seems to be about half. Any ideas on what could cause this?

java.lang.IllegalArgumentException: Bad position

This is the following stacktrace happens when set bytes to the view

Caused by java.lang.IllegalArgumentException: Bad position (limit 34457): 34641
at java.nio.Buffer.positionImpl(Buffer.java:357)
at java.nio.Buffer.position(Buffer.java:351)
at com.felipecsl.gifimageview.library.GifHeaderParser.skip(GifHeaderParser.java:364)
at com.felipecsl.gifimageview.library.GifHeaderParser.skipImageData(GifHeaderParser.java:354)
at com.felipecsl.gifimageview.library.GifHeaderParser.readBitmap(GifHeaderParser.java:245)
at com.felipecsl.gifimageview.library.GifHeaderParser.readContents(GifHeaderParser.java:136)
at com.felipecsl.gifimageview.library.GifHeaderParser.readContents(GifHeaderParser.java:114)
at com.felipecsl.gifimageview.library.GifHeaderParser.parseHeader(GifHeaderParser.java:89)
at com.felipecsl.gifimageview.library.GifDecoder.read(GifDecoder.java:485)
at com.felipecsl.gifimageview.library.GifImageView.setBytes(GifImageView.java:56)

Call advance() before the first getNextFrame()

You have to call gifDecoder.advance() BEFORE the first call to getNextFrame(), because framePointer is initialized to -1. The way it's implemented now, the first bitmap is always null.

GifImageView with a listview animation displays inclined

Hi,
I'm using this GifImageView with a listview in my application. Sometimes when I scrolled down and scroll back up animation suddenly will inclined to 60 degrees counter clockwise from the x axis.
Any input on how to resolve this issue?
Thanks in advance.

NullPointerException

gifimageview.GifDecoder.getNextFrame()' on a null object reference
at com.game_werewolf.voice.gifimageview.GifImageView.run(GifImageView.java:179)
at java.lang.Thread.run(Thread.java:818)

getting Build failed after migrated to AndroidX

Build error:
ERROR: Unable to resolve dependency for ':app@devDebug/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@devDebugAndroidTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@devDebugUnitTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@devRelease/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@devReleaseUnitTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@inhouseDebug/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@inhouseDebugAndroidTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@inhouseDebugUnitTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@inhouseRelease/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@inhouseReleaseUnitTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@betaDebug/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@betaDebugAndroidTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@betaDebugUnitTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@betaRelease/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

ERROR: Unable to resolve dependency for ':app@betaReleaseUnitTest/compileClasspath': Failed to transform file 'gifimageview-2.2.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
Show Details
Affected Modules: app

Frame might still get updated after stopAnimation is called

I am using the GifImageView in an Adapter where also static images can be set to the ImageView.
So when stopping the Animation via clear() and setting a static image right afterwards via setImageBitmap(...), sometimes the static image is displayed only for an instant and is replaced by a frame of the previous set GIF almost immediately.

This might be a threading issue:
I think the updateResults Runnable might get executed even after clear() was called on the View.
For that, I would suggest checking for animating == true in the Runnable before updating the Bitmap.

NullPointerException

when gif is loading ,i change the wifi to 4G,and then app crash.
java.lang.NullPointerException: Attempt to write to field 'int com.felipecsl.gifimageview.library.GifHeader.status' on a null object reference
at com.felipecsl.gifimageview.library.GifHeaderParser.setData(GifHeaderParser.java:62)
at com.felipecsl.gifimageview.library.GifDecoder.read(GifDecoder.java:513)
at com.felipecsl.gifimageview.library.GifImageView.setBytes(GifImageView.java:55)
at com.felipecsl.gifimageview.app.MainActivity$3.onPostExecute(MainActivity.java:60)
at com.felipecsl.gifimageview.app.MainActivity$3.onPostExecute(MainActivity.java:58)

divide by zero Problem

I get this error when using GifImageView with GridView using custom ImageAdapter extends BaseAdapter

12-02 16:06:56.619 15491-15601/? E/AndroidRuntime: FATAL EXCEPTION: Thread-3008
Process: vn.messengerkvtm.gs, PID: 15491
java.lang.ArithmeticException: divide by zero
at com.felipecsl.gifimageview.library.GifDecoder.advance(GifDecoder.java:229)
at com.felipecsl.gifimageview.library.GifImageView.run(GifImageView.java:157)
at java.lang.Thread.run(Thread.java:841)

ImageAdapter.txt

too long time

it takes me too long time to start the gif animation

How to use setBytes()

i download a net gif image to bitmap . bitmap to byte .
use setBytes(),No response。
Bitmap bitmap=imageLoader.loadsync("net uri str");
byte[] bt=bitmapToByte(bitmap);
mGifImageView.setBytes(bt);
can you give me some suggestions for load net gif to cache and play ?

OOM

I used your gifImageView in a row of listview.After refreshed the listview via PullToRefreshView,the memory consumption increased.Eventually it rusulted in OOM.

java.lang.UnsatisfiedLinkError

Hi @felipecsl

Thanks for providing an awesome library!

I started using GifImageView for a few weeks, but I'm getting a crash report which is caused from:

Caused by: java.lang.UnsatisfiedLinkError: Couldn't load pl_droidsonroids_gif from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.myapp.team-1.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]]: findLibrary returned null at java.lang.Runtime.loadLibrary(Runtime.java:358) at java.lang.System.loadLibrary(System.java:533) at pl.droidsonroids.gif.GifInfoHandle.(GifInfoHandle.java:40) at pl.droidsonroids.gif.GifDrawable.(GifDrawable.java:145) at pl.droidsonroids.gif.GifDrawable.(GifDrawable.java:83) at pl.droidsonroids.gif.GifViewUtils.setResource(GifViewUtils.java:49) at pl.droidsonroids.gif.GifViewUtils.getResourceId(GifViewUtils.java:35) at pl.droidsonroids.gif.GifViewUtils.initImageView(GifViewUtils.java:22) at pl.droidsonroids.gif.GifImageView.(GifImageView.java:41) at java.lang.reflect.Constructor.constructNative(Constructor.java) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377) at android.app.Activity.setContentView(Activity.java:1997) at com.myapp.team.activity.intro.SplashAnimScreen.onCreate(SplashAnimScreen.java:71) at android.app.Activity.performCreate(Activity.java:5312) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2541) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2641) at android.app.ActivityThread.access$800(ActivityThread.java:156) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:157) at android.app.ActivityThread.main(ActivityThread.java:5867) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674) at dalvik.system.NativeStart.main(NativeStart.java)

Any thoughts?

Thanks,
Nari

Crash in OkHttpClient.newCall(request).execute();

Hi I am getting crash every time I run this sample code at this line of MainActivity -
final Response response = client.newCall(request).execute();

Here's the logcat -
08-28 09:57:01.951: E/AndroidRuntime(17984): FATAL EXCEPTION: AsyncTask #1
08-28 09:57:01.951: E/AndroidRuntime(17984): Process: com.felipecsl.gifimageview.app, PID: 17984
08-28 09:57:01.951: E/AndroidRuntime(17984): java.lang.RuntimeException: An error occured while executing doInBackground()
08-28 09:57:01.951: E/AndroidRuntime(17984): at android.os.AsyncTask$3.done(AsyncTask.java:300)
08-28 09:57:01.951: E/AndroidRuntime(17984): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
08-28 09:57:01.951: E/AndroidRuntime(17984): at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
08-28 09:57:01.951: E/AndroidRuntime(17984): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
08-28 09:57:01.951: E/AndroidRuntime(17984): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
08-28 09:57:01.951: E/AndroidRuntime(17984): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
08-28 09:57:01.951: E/AndroidRuntime(17984): at java.lang.Thread.run(Thread.java:841)
08-28 09:57:01.951: E/AndroidRuntime(17984): Caused by: java.lang.NoClassDefFoundError: com.squareup.okhttp.internal.http.RetryableSink
08-28 09:57:01.951: E/AndroidRuntime(17984): at com.squareup.okhttp.internal.Util.(Util.java:231)
08-28 09:57:01.951: E/AndroidRuntime(17984): at com.squareup.okhttp.ConnectionPool.(ConnectionPool.java:82)
08-28 09:57:01.951: E/AndroidRuntime(17984): at com.squareup.okhttp.ConnectionPool.(ConnectionPool.java:71)
08-28 09:57:01.951: E/AndroidRuntime(17984): at com.squareup.okhttp.OkHttpClient.copyWithDefaults(OkHttpClient.java:477)
08-28 09:57:01.951: E/AndroidRuntime(17984): at com.squareup.okhttp.OkHttpClient.newCall(OkHttpClient.java:439)
08-28 09:57:01.951: E/AndroidRuntime(17984): at com.felipecsl.gifimageview.app.ByteArrayHttpClient.get(ByteArrayHttpClient.java:28)
08-28 09:57:01.951: E/AndroidRuntime(17984): at com.felipecsl.gifimageview.app.GifDataDownloader.doInBackground(GifDataDownloader.java:22)
08-28 09:57:01.951: E/AndroidRuntime(17984): at com.felipecsl.gifimageview.app.GifDataDownloader.doInBackground(GifDataDownloader.java:1)
08-28 09:57:01.951: E/AndroidRuntime(17984): at android.os.AsyncTask$2.call(AsyncTask.java:288)
08-28 09:57:01.951: E/AndroidRuntime(17984): at java.util.concurrent.FutureTask.run(FutureTask.java:237)

Also I am getting this error just after the crash -
08-28 09:57:01.921: E/dalvikvm(17984): Could not find class 'com.squareup.okhttp.internal.http.RetryableSink', referenced from method com.squareup.okhttp.internal.Util.

Any thoughts?

ANR exception in Google Play console.

I am using your framework for Titanium through intermediate module, and I am getting a lot of these exceptions in Google Play console:

java.lang.ArithmeticException: divide by zero
at com.felipecsl.gifimageview.library.GifDecoder.advance(GifDecoder.java:229)
at com.felipecsl.gifimageview.library.GifImageView.run(GifImageView.java:157)
at java.lang.Thread.run(Thread.java:818)

Could you check it please?

Border around frames

Nice job GifImageView,please do you have any plans on borders and borderColors around the GifImageView?Thanks

Bitmap to ByteArray

I have a Bitmap containing the entire GIF and all its frames. How can I convert it into a byte array to be used in setBytes method.

Some gifs display broken

Please take a look at this gif
http://katemobile.ru/tmp/sample3.gif
It's fine. But if you try to open it in GifImageView you can see some glitches at the bottom of the file.
It's not about this specific gif, I can get more samples like that.
Have no idea why it happens. But there's one hint I can provide:
GifImageView and Glide use the same GifDecoder implementations right? It's pretty much modified in both projects but still I guess it comes from the same place. But Glide implementation plays this git correctly. So if we can figure out the difference between two implementations we can tell where the problem is. Probably not that easy to do.

play animation for only once and stop

Firstly I would like to thank you for a such a useful library for GIF. I am currently facing one issue while using this library. I want to a play the animation only once.I don't see a interface for stopping the animation after it plays once. and we don't have access GifDecoder to know if we want to stop at a particular frame. OnframeAvailble only priovdes the Bitmap but not the frame index.

Regards
Ravi

getNextFrame() never return currentFrame

Thanks for making GifImageView library.
I am going to split animated gif image, so I am using getNextFrame() in for loop.
getFrameCount() return actual count number, but getNextFrame() doesn't.
getNextFrame return only 1st frame.

        for (int i = 0; i < n; i++) {
            bitmaps.add(gifDecoder.getNextFrame());
            saveBitmaptoJpeg(bitmaps.get(i), "test", "gif_sample" + i);
        }

This code makes 44 jpeg images same frame.
All images show first frame. What should I do? I think I'm in the wrong way.

Transparent GIF shows black.

I have a gif as loading indicator, but it starts off with black background and remains that way for about 2-3 seconds. After that it becomes transparent.

Any ideas?

Latest commit on gradle available?

Can we get the latest code update i.e. fix of divide by zero error through gradle?

I am using
compile 'com.felipecsl:gifimageview:2.0.0'
to use this library but it is still showing divide by zero exception.

Please help!!

How to display gif image from external storage ?

Hello there,

I am unable to display locally stored gif image programatically.
Here is my code
String root = Environment.getExternalStorageDirectory().toString()+"/EnthuonsChat/Images/"+imageName;
File fileToDownload = new File(root);
if(fileToDownload.exists()){
new GifDataDownloader() {
@OverRide
protected void onPostExecute(final byte[] bytes) {
((ItemMessageUserHolder) holder).gifImageView.setBytes(bytes);
((ItemMessageUserHolder) holder).gifImageView.startAnimation();
}
}.execute(root);
}
Please help me to resolve this issue....

How to animate gif?

I have gif image in various drawables folder. How to animate my gif image.

Does this support transparent GIFs?

I'm rendering animated GIFs with transparent backgrounds. They appear correctly on iOS but on Android they have a black background. Am I not specifying a parameter for the decoder? I didn't see one. Looks like it's taking its cue from each frame. Thanks!

How to Load Gif image from File System

I want to display gif image from file system it may from internal storage or external storage. i have a file it has to load to gifimageview.
is it possible??

NPE in run() method of GifImageView

Just had a crash in our app due to an NPE in the run() method of GifImageView.

Stack trace:

java.lang.NullPointerException: Attempt to invoke virtual method 'int com.felipecsl.gifimageview.library.GifDecoder.getFrameCount()' on a null object reference
    at com.felipecsl.gifimageview.library.GifImageView.void run()(GifImageView.java:130)
    at java.lang.Thread.run(Thread.java:818)

Having a look at the code, I think it's possible that this is a threading problem. I think it's possible to NPE if the following scenario occurs:

  1. startAnimation() is called, so run() is called in a new thread.
  2. run() finds that shouldClear is false.
  3. clear() is called on the main thread, so the cleanupRunnable is run almost immediately, setting gifDecoder to null.
  4. The animation thread calls gifDecoder.getFrameCount().

This seems to be a similar issue to #5.

Memory leak due to rapid toggle of animation

I'm using a GifImageView in situation where the animation is stopped and started very rapidly for a period of time. This toggling can happen as frequently as <10 milliseconds. This creates a memory leak which eventually crashes my app.

From the code here, it looks like the thread which runs the animation is not actually stopped on the call to stopAnimation.

https://github.com/felipecsl/GifImageView/blob/master/library/src/main/java/com/felipecsl/gifimageview/library/GifImageView.java#L184

Am I correct in that and, if so, what is the reason for this behavior?

Memory leak

CleanupRunnable is never involved in your implementation. Please take a look carefully. There's a call in the beginning of the Thread, not much usefull. But if I'm inside for() loop and clear() method is called is doesn't invoke cleanupRunnable. That causes a pretty annoying memory leak. Makes sense? Easy to fix but I need your review.

Does this support Android 4.4.2?

I use setImageResource() to set a gif from drawable folder, not download from url. And call startAnimation(), then isAnimating() return true, but UI doesn't visually work.

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.