1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-29 11:15:51 +00:00

Fixed showing image place holders

This commit is contained in:
M66B 2019-05-08 15:29:24 +02:00
parent 86a7816e8c
commit 92b9f9014e
2 changed files with 9 additions and 2 deletions

View file

@ -1748,7 +1748,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
public Drawable getDrawable(String source) {
Drawable image = HtmlHelper.decodeImage(source, message.id, show_images, tvBody);
float width = tvBody.getWidth();
ConstraintLayout.LayoutParams params =
(ConstraintLayout.LayoutParams) tvBody.getLayoutParams();
float width = context.getResources().getDisplayMetrics().widthPixels
- params.leftMargin - params.rightMargin;
if (image.getIntrinsicWidth() > width) {
float scale = width / image.getIntrinsicWidth();
image.setBounds(0, 0,

View file

@ -92,6 +92,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.Group;
import androidx.cursoradapter.widget.SimpleCursorAdapter;
import androidx.exifinterface.media.ExifInterface;
@ -2818,7 +2819,10 @@ public class FragmentCompose extends FragmentBase {
public Drawable getDrawable(String source) {
Drawable image = HtmlHelper.decodeImage(source, id, show_images, tvReference);
float width = tvReference.getWidth();
ConstraintLayout.LayoutParams params =
(ConstraintLayout.LayoutParams) tvReference.getLayoutParams();
float width = context.getResources().getDisplayMetrics().widthPixels
- params.leftMargin - params.rightMargin;
if (image.getIntrinsicWidth() > width) {
float scale = width / image.getIntrinsicWidth();
image.setBounds(0, 0,