Scale downloaded images

This commit is contained in:
M66B 2019-05-03 18:06:58 +02:00
parent 4cac61b03b
commit 9bb6bd0378
1 changed files with 13 additions and 1 deletions

View File

@ -434,9 +434,21 @@ public class HtmlHelper {
handler.post(new Runnable() { handler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
int w = d.getIntrinsicWidth();
int h = d.getIntrinsicHeight();
float width = view.getWidth();
if (w > width) {
float scale = width / w;
w = Math.round(w * scale);
h = Math.round(h * scale);
d.setBounds(0, 0, w, h);
}
lld.addLevel(1, 1, d); lld.addLevel(1, 1, d);
lld.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); lld.setBounds(0, 0, w, h);
lld.setLevel(1); lld.setLevel(1);
view.setText(view.getText()); view.setText(view.getText());
} }
}); });