Skip to content

Commit

Permalink
修改gif默认设置, 增加流畅性
Browse files Browse the repository at this point in the history
  • Loading branch information
wyouflf committed Jul 28, 2020
1 parent c137d46 commit d2a96c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion xutils/src/main/java/org/xutils/image/GifDrawable.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class GifDrawable extends Drawable implements Runnable, Animatable {

private int byteCount;
private int rate = 300;
private int rate = 100;
private volatile boolean running;

private final Movie movie;
Expand Down
1 change: 1 addition & 0 deletions xutils/src/main/java/org/xutils/image/ImageDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static Drawable decodeFileWithLock(final File file,
}
if (movie != null) {
result = new GifDrawable(movie, (int) file.length());
((GifDrawable) result).setRate(options.getGifRate());
}
} else {
Bitmap bitmap = null;
Expand Down
10 changes: 10 additions & 0 deletions xutils/src/main/java/org/xutils/image/ImageOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ImageOptions {

// gif option
private boolean ignoreGif = true;
private int gifRate = 100;
// end region ########################################## decode options #################

// region ############# display options
Expand Down Expand Up @@ -168,6 +169,10 @@ public boolean isIgnoreGif() {
return ignoreGif;
}

public int getGifRate() {
return gifRate;
}

public boolean isAutoRotate() {
return autoRotate;
}
Expand Down Expand Up @@ -345,6 +350,11 @@ public Builder setIgnoreGif(boolean ignoreGif) {
return this;
}

public Builder setGifRate(int rate) {
options.gifRate = rate;
return this;
}

public Builder setLoadingDrawableId(int loadingDrawableId) {
options.loadingDrawableId = loadingDrawableId;
return this;
Expand Down

0 comments on commit d2a96c3

Please sign in to comment.