mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 19:10:11 +01:00
Limit image width to screen width
This commit is contained in:
@@ -2760,7 +2760,18 @@ public class FragmentCompose extends FragmentBase {
|
||||
new Html.ImageGetter() {
|
||||
@Override
|
||||
public Drawable getDrawable(String source) {
|
||||
return HtmlHelper.decodeImage(source, id, show_images, tvReference);
|
||||
Drawable image = HtmlHelper.decodeImage(source, id, show_images, tvReference);
|
||||
|
||||
float width = context.getResources().getDisplayMetrics().widthPixels -
|
||||
Helper.dp2pixels(context, 12); // margins;
|
||||
if (image.getIntrinsicWidth() > width) {
|
||||
float scale = width / image.getIntrinsicWidth();
|
||||
image.setBounds(0, 0,
|
||||
Math.round(image.getIntrinsicWidth() * scale),
|
||||
Math.round(image.getIntrinsicHeight() * scale));
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
},
|
||||
null);
|
||||
|
||||
Reference in New Issue
Block a user