koush / ion

Android Asynchronous Networking and Image Loading
Other
6.29k stars 1.04k forks source link

Loading Animation for ImageView is not stopped on error #594

Open NormenKD opened 9 years ago

NormenKD commented 9 years ago

I'm loading images onto ImageViews inside an ArrayListAdapter with:

Ion.with(imageView)
        .placeholder(R.drawable.spinner_76_inner_holo_green)
        .error(android.R.drawable.ic_menu_report_image)
        .animateLoad(R.anim.rotate)
        .animateIn(R.anim.grow_fade_in_center)
        .load(i.getPictureUrl());

My loading Animation looks like this (R.anim.rotate):

<?xml version="1.0" encoding="utf-8"?>
<rotate
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="0"
    android:toDegrees="359"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:interpolator="@android:anim/linear_interpolator"
    android:duration="@android:integer/config_longAnimTime" />

However, if the image is not available for whatever reason (and the cache is empty), my placeholder will rotate for a second or two (as expected), but my error-drawable will continue to spin after appearing. This does not happen if the cache has an empty entry for the missing image, it would just show the error-drawable without the animation instantly. If the image loads correctly, everything works as expected.

Some information about my environment from build.gradle: compileSdkVersion 21 buildToolsVersion "22.0.1" minSdkVersion 16 targetSdkVersion 21 compile 'com.koushikdutta.ion:ion:2.1.6'

Also, these might be related:

07-13 19:10:04.747  27202-27722/de.xxx.xxx D/skia﹕ --- SkImageDecoder::Factory returned null

They appear if the image could not be loaded (in this case the URL was no longer Valid) and the error-drawable starts spinning.

hguarnieri commented 7 years ago

Same here