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

Loading images in Widgets #15

Closed
pavlospt opened this issue Mar 27, 2015 · 4 comments
Closed

Loading images in Widgets #15

pavlospt opened this issue Mar 27, 2015 · 4 comments

Comments

@pavlospt
Copy link

I am supposing that this won't be possible based on the way this library is architected and how widgets work. If there is a possibility can you please give me a hint on how should I approach this and I could make a PR if I have something done.

@IanChilds
Copy link
Contributor

You should be able to use the ImagePipeline with BaseBitmapDataSubscriber for this - have a look here. You need to make sure you pass the bitmap to the system in the updateStatus method as the bitmap will be cleaned up when onNewResultImpl finishes.

Let me know if you have any problems.

@pavlospt
Copy link
Author

What do you mean by passing the bitmap to the system?

@plamenko
Copy link
Contributor

As Ian explained, after submitting the request to the pipeline, pipeline returns a DataSource. Attach your BaseBitmapDataSubscriber to that DataSource.
Important note is that the bitmap we provide is valid only until onNewResultImpl finishes.
See BaseBitmapDataSubscriber.onNewResultImpl(@Nullable Bitmap bitmap).
That means that you cannot hold onto the reference of the bitmap we provide, either you have to copy the bitmap manually, or, If I am not wrong, the system will do just that for you when passing the Bitmap to the Widget, as this is another process and reference cannot be shared.

@pavlospt
Copy link
Author

@plamenko Ok thank you. Will try it and if I find any problems on the way will ask again.

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

No branches or pull requests

3 participants