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

Issue after changing the orientation #64

Open
blacelle opened this issue Jun 11, 2013 · 4 comments
Open

Issue after changing the orientation #64

blacelle opened this issue Jun 11, 2013 · 4 comments

Comments

@blacelle
Copy link

I have an issue with UrlImageViewHelper after changing the orientation: the image are resized with an unexpected size.

I believe it is due to the fact you cache mMetrics with the DisplayMetrics associated to the orientation of the first call. It then lead to issues when using mMetrics.widthPixels since it may not be valid anymore after a change of orientation.

1.0.4

@jvmvirus
Copy link

I think your code should change to:
final int tw;
final int th;
if (mMetrics == null)
prepareResources(context);
tw = imageView.getWidth() > 0 ? imageView.getWidth() : mMetrics.widthPixels;
th = imageView.getHeight() > 0 ? imageView.getHeight() : mMetrics.heightPixels;
In method setUrlDrawable, it is more generalize.
Thanks and regards,

@blacelle
Copy link
Author

I've fixed the issue by keeping 2 sets of mMetrics and mResources, each of them initialized depending on current orientation (Portrait or Landscape)

@koush
Copy link
Owner

koush commented Jun 24, 2013

Maybe the fix is to not cache mmetrics and always grab the metrics from imageview that was passed in, if available. Can you submit that?

@koush
Copy link
Owner

koush commented Jun 24, 2013

Also, you may want to check out ion:

https://github.com/koush/ion

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