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

background image is stretched, not on iOS #104

Closed
j2l opened this issue May 17, 2017 · 8 comments
Closed

background image is stretched, not on iOS #104

j2l opened this issue May 17, 2017 · 8 comments

Comments

@j2l
Copy link

j2l commented May 17, 2017

Comparing portrait/landscape body background url behavior on Android and iOS, we can see Android stretches the image, while iOS respects aspect ratio (crop it).
Not sure it needs a sie or distribution parameter.

@realitix
Copy link
Contributor

realitix commented Jun 28, 2017

Hello,
I saw that on Android, background is streched and that looks very ugly. To resolve it, you must provide all aspect ratio and detect screen size. It's better to crop the image.

@gliechtenstein I think it's near this place: https://github.com/Jasonette/JASONETTE-Android/blob/develop/app/src/main/java/com/jasonette/seed/Core/JasonViewActivity.java#L1445

On Glide documentation, they say to use transform : http://bumptech.github.io/glide/doc/transformations.html.

I think it should be something like that:

RequestOptions options = new RequestOptions();
options.centerCrop();

with(JasonViewActivity.this)
   .load(JasonImageComponent.resolve_url(c, JasonViewActivity.this))
   .apply(options)
   .into(new SimpleTarget<GlideDrawable>() {
                                           @Override
                                           public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) {
                                               sectionLayout.setBackground(resource);
                                           }    
                                       });  

I can't test on Iphone but behavior must be the same between both.
I will test it when my dev environment will be set up. Currently, I'm testing with the Jason APP, so smooth!

@j2l
Copy link
Author

j2l commented Jun 28, 2017

@realitix Merci !
je le ferme.

@j2l j2l closed this as completed Jun 28, 2017
@realitix
Copy link
Contributor

Why @j2l ? It's not fixed. Can you reopen it ?

@j2l j2l reopened this Jun 28, 2017
@j2l
Copy link
Author

j2l commented Jun 28, 2017

Si tu veux JS. On verra.

@realitix
Copy link
Contributor

Merci @j2l, comment sais-tu que je parle Français ?

@gliechtenstein My example can't work because it's with Glide 4 and currently, the project uses Glide3.
I let you know when it's done. My dev-env is ready.

@j2l
Copy link
Author

j2l commented Jun 28, 2017

Because your first name is Jean-Sébastien and you live in Paris :)
It was just a guess.

@realitix
Copy link
Contributor

Pas bête !

realitix added a commit to realitix/JASONETTE-Android that referenced this issue Jun 28, 2017
When you put a background image to your view, it streched to fit screen
dimension.
With this patch, image is cropped to keep the aspect ratio.
gliechtenstein added a commit that referenced this issue Jul 4, 2017
@gliechtenstein
Copy link
Contributor

Thanks to @realitix this has been resolved!! #119 (comment)

gliechtenstein added a commit that referenced this issue Jul 14, 2017
* Allow html container video autoplay + gradle upgrade + api min version upgrade to 17

* Support html video inline play for background html container

* Correct data-uri handling for images

* Fix $geo.get -> Should be only triggered once

* readme update

* Replace useless “Error” messages with more informative warning messages

* Fix Map component event handling for render

* Fixes OAuth action doubling up on some query params

* Add “title” attribute to $util.picker

* Support JSONArray when reading JSON

* Local Mixin + Local $require

* Local Image Support + Menu Image fix + Gif fix

1. Local image support

- Image/Button component
- background
- layer
- menu
- tabs

2. fixed the bug where an image menu item was not being displayed when there's a badge.

3. Gif fix
Glide doesn't handle Gifs properly when not using disk cache strategy. With this fix, Gif images load properly

* $audio.play should trigger pause if already playing

* Add $back action

* $global.set + $global.reset

* $env

* Added $env.device.language

* Template engine fix. See iOS counterpart: Jasonette/JASONETTE-iOS#224

* support data-url scheme for images (only normal cases)

* Support loading.json

* Support loading.json (continued)

* Support $env.view.url

* background color fix

* offline.json support

* Bug fix

* Updated policy for $show and $load

* Only trigger if an action is not empty

* Fix #104: Crop background

When you put a background image to your view, it is streched to fit screen
dimensions.
With this patch, image is cropped to keep the aspect ratio.

Moreover, this patch fix GIF background and it is now played.

* Fix #127 Background image is no more displayed

Background of sectionLayout should always be transparent.

* Add .idea/codeStyleSettings.xml in .gitignore

* Handle behavior when layers is null

* Check that backgroundImageView is not created

This patch avoids multiple ImageView creation (like fof webview)
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