Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added minimum gif frame delay #505

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ion/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ repositories {

dependencies {
compile 'com.android.support:support-v4:+'
compile project(':AndroidAsync:AndroidAsync')
compile 'com.google.code.gson:gson:2.3'
compile fileTree(dir: 'libs', include: '*.jar')

// for when i wanna test this against gms conscrypt
androidTestCompile 'com.google.android.gms:play-services:+'
Expand Down
8 changes: 3 additions & 5 deletions ion/ion-ion.iml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" external.system.module.group="Gradle.ion" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../.." external.system.id="GRADLE" external.system.module.group="RumrProject.libraries.ion" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":ion:ion" />
<option name="GRADLE_PROJECT_PATH" value=":libraries:ion:ion" />
</configuration>
</facet>
<facet type="android" name="Android">
Expand Down Expand Up @@ -81,18 +81,16 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/libs" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/poms" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" scope="TEST" name="play-services-6.5.87" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="androidasync-2.0.8" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="module" module-name="AndroidAsync-AndroidAsync" exported="" />
</component>
</module>

42 changes: 0 additions & 42 deletions ion/ion.iml

This file was deleted.

Binary file removed ion/libs/android-support-v4.jar
Binary file not shown.
Binary file added ion/libs/androidasync-2.0.8.jar
Binary file not shown.
Binary file removed ion/libs/gson-2.2.4.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion ion/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ android.library=true



android.library.reference.1=../../AndroidAsync/AndroidAsync

18 changes: 18 additions & 0 deletions ion/src/com/koushikdutta/ion/HeaderException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.koushikdutta.ion;

/**
* Created by collin on 3/5/15.
*/
public class HeaderException extends Exception {

private HeadersResponse response;

public HeaderException(HeadersResponse headersResponse) {
response = headersResponse;
}

public int getCode() {
return response != null ? response.code() : -1;
}

}
7 changes: 7 additions & 0 deletions ion/src/com/koushikdutta/ion/LoadBitmap.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ public void onCompleted(Exception e, final ByteBufferList result) {
return;
}

if (emitterTransform != null && emitterTransform.headers != null) {
if (emitterTransform.headers.code() == 410) {
report(new HeaderException(emitterTransform.headers), null);
return;
}
}

if (ion.bitmapsPending.tag(key) != this) {
result.recycle();
return;
Expand Down
7 changes: 5 additions & 2 deletions ion/src/com/koushikdutta/ion/gif/GifDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class GifDecoder implements Cloneable {
private int dispose = 0;
private int lastDispose = 0;
private boolean transparency = false; // use transparent color
private int delay = 0; // delay in milliseconds
private int delay = 100; // delay in milliseconds
private int transIndex; // transparent color index

private static final int MaxStackSize = 4096;
Expand Down Expand Up @@ -447,6 +447,9 @@ private void readGraphicControlExt() {
}
transparency = (packed & 1) != 0;
delay = readShort() * 10; // delay in milliseconds
if (delay < 20) {
delay = 100;
}
transIndex = read(); // transparent color index
read(); // block terminator
}
Expand Down Expand Up @@ -573,7 +576,7 @@ private void resetFrame(GifFrame newFrame) {
lastBgColor = bgColor;
dispose = 0;
transparency = false;
delay = 0;
delay = 100;
lct = null;
}

Expand Down