Fixed showing image place holders

pull/156/head
M66B 5 years ago
parent 86a7816e8c
commit 92b9f9014e

@ -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,

@ -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,

Loading…
Cancel
Save