flyingrub / Alea-Live-Wallpaper-Android

Minimal Live wallpaper - Android
GNU General Public License v2.0
9 stars 1 forks source link

How to keep aspect ratio in different ways? #3

Open AndroidDeveloperLB opened 6 years ago

AndroidDeveloperLB commented 6 years ago

I've noticed that this sample just shows the GIF, without showing entire content in case it's too large. This can be a problem in case you show a GIF animation that doesn't fit the screen of the device. Even on the sample you can see it:

image

Do you know how to do any of the following with it:

  1. center-crop
  2. stretch to fit width/height
  3. set as original size, centered, and stretch to fit width/height only if too large.
flyingrub commented 6 years ago

As you can see here https://github.com/flyingrub/Alea-Live-Wallpaper-Android/blob/master/app/src/main/java/flying/grub/alea/AleaService.java#L150. It scales according to the width resolution.

AndroidDeveloperLB commented 6 years ago

@flyingrub But this causes the height to be cropped, not showing the entire animation content...

flyingrub commented 6 years ago

You can adapt it to fit your need by using the height too :)

AndroidDeveloperLB commented 6 years ago

Which of the ways I've mentioned would that be? The second one? Also, how do I do that, including the other ways to do it that I've mentioned?

flyingrub commented 6 years ago

The gif is already always centered. You can play with the scale factor to crop it as you want

AndroidDeveloperLB commented 6 years ago

I didn't talk about center. It should always be centered, in all cases. I was talking about the resizing methods. How do I achieve each of those?