Skip to content

Commit

Permalink
修复略缩图因状态共用导致的显示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojieonly committed Nov 18, 2024
1 parent 09b612d commit 8db7e77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/main/java/com/hippo/widget/LoadImageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,12 @@ public void onWait() {
public boolean onGetValue(@NonNull Image value, int source) {
Drawable drawable;
try {
drawable = value.getDrawable();
Drawable.ConstantState state = value.getDrawable().getConstantState();
if (state!=null){
drawable = state.newDrawable();
}else {
drawable = value.getDrawable();
}
} catch (Exception e) {
// The image might be recycled because it is removed from memory cache.
Log.d(TAG, "The image is recycled", e);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/com/hippo/widget/LoadImageViewNew.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ public boolean onGetValue(@NonNull Image value, int source) {
Drawable drawable;
try {
drawable = value.getDrawable();

} catch (Exception e) {
// The image might be recycled because it is removed from memory cache.
Log.d(TAG, "The image is recycled", e);
Expand Down

0 comments on commit 8db7e77

Please sign in to comment.