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

ImageLoader.loadImageSync() does not load images to cache #636

Closed
krabien opened this issue May 30, 2014 · 4 comments
Closed

ImageLoader.loadImageSync() does not load images to cache #636

krabien opened this issue May 30, 2014 · 4 comments
Labels

Comments

@krabien
Copy link

krabien commented May 30, 2014

When trying to use ImageLoader.loadImageSync() to precache images, I noticed that IOUtils.shouldStopLoading() cancels downloads prematurely by way of LoadAndDisplayImageTask.onBytesCopied() which calls through to LoadAndDisplayImageTask.fireProgressEvent().
I assume that fireProgressEvent() cancels because a progress listener doesn't make sense in a synchronous download, but of course that shouldn't cancel the entire download.
I think the line
if (syncLoading || isTaskInterrupted() || isTaskNotActual()) return false;
would make more sense in onBytesCopied() than in fireProgressEvent() - or am I missing something?

@nostra13 nostra13 added the Bug label May 31, 2014
@nostra13
Copy link
Owner

You're right, there is a problem. Thanks.

@ccyil200
Copy link

i hava some question,
class:
LruDiscCache

method:

public File get(String imageUri)
  {
    DiskLruCache.Snapshot snapshot = null;
    try {
      snapshot = this.cache.get(getKey(imageUri));
      return snapshot == null ? null : snapshot.getFile(0);
    } catch (IOException e) {
      L.e(e);
      return null;
    } finally {
      if (snapshot != null)
        snapshot.close();
    }
  }

will throw nullpointexception when sdcard Contact is not good

@ccyil200
Copy link

because this.cache is null

@nostra13
Copy link
Owner

Is this a question or a fact?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants