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

Method ScaleType from url download, failure #21

Closed
Jejid opened this issue Apr 27, 2019 · 4 comments
Closed

Method ScaleType from url download, failure #21

Jejid opened this issue Apr 27, 2019 · 4 comments
Labels

Comments

@Jejid
Copy link

Jejid commented Apr 27, 2019

Hi Sir, me again. Thanks for support with your library

Scaling image in the flipper is failing CENTER_INSIDE and FIT_CENTER, it doesnt work correectly when you download a image from a url, flipper dont center images. With drawable works fine

view.setImageScaleType(ScaleType.CENTER_INSIDE);
view.setImageScaleType(ScaleType.FIT_CENTER);

see Screenshots of organization inside fliper. Flipper just move up the images

ss2
ss1

Version of the library used
'com.github.therealshabi:AutoImageFlipper:1.5.6'

Thanks for attention

@Jejid Jejid added the is:bug label Apr 27, 2019
@therealshabi
Copy link
Owner

Use CENTER_CROP probably?

@Jejid
Copy link
Author

Jejid commented Apr 30, 2019

Done but, not good.

FIT_CENTER and CENTER_INSIDE work very fine with drawables but downloaded images with (view.setImageUrl(urlImg);) dont

see flipper code:

for ( int i =0;i <establecimientos.size();i++){
FlipperView view = new FlipperView(getActivity());
String urlImg = establecimientos.get(i).getImagen();
view.setImageUrl(urlImg);
view.setImageScaleType(ImageView.ScaleType.FIT_CENTER);
view.setDescriptionBackgroundAlpha(0.2f);
final Establecimiento establecimientoClicked = establecimientos.get(i);
view.setOnFlipperClickListener(new FlipperView.OnFlipperClickListener() {
@OverRide
public void onFlipperClick(FlipperView flipperView) {
Intent intent = new Intent(getActivity(),EstablecimientoActivity.class);
intent.putExtra("Establecimiento a Abrir", establecimientoClicked);
intent.putExtra("vista", 1);
if(!internet)intent.putExtra("banner", BannerSecondShot);
else intent.putExtra("banner", bannerOneShot);
startActivity(intent);
}
});
flipper.setScrollTimeInSec(4);
flipper.addFlipperView(view);

with CENTER_CROP
4
3

@therealshabi
Copy link
Owner

Actually, it all depends upon the resolution of the image used.

  • Do one thing, first manually save the image you're trying to load from the url.
  • Move that downloaded image into the drawable folder
  • Now, load the image directly from the drawable
  • Use FIT_CENTER or CENTER_INSIDE, you'll now see that even this drawable image will have the same problem.

The problem is because of the image size and resolution you'll have to think of a workaround for the same

@Jejid
Copy link
Author

Jejid commented May 1, 2019

Many thanks, ill try fix it changing size of images but when i load the image directly from the drawable its works fine.

see

4
3

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

2 participants