Fixed broken image

This commit is contained in:
M66B 2021-12-11 16:00:02 +01:00
parent 9e33838a00
commit 69b19fd97d
2 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,7 @@ package eu.faircode.email;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
@ -49,7 +50,9 @@ public class FixedImageButton extends AppCompatImageButton {
Log.e(new Throwable(Helper.getViewName(this), ex));
Context context = getContext();
Drawable d = context.getDrawable(R.drawable.twotone_broken_image_24);
d.setBounds(getDrawable().getBounds());
Rect b = getDrawable().getBounds();
int px = Math.min(b.width(), b.height());
d.setBounds(0, 0, px, px);
d.draw(canvas);
}
}

View File

@ -21,6 +21,7 @@ package eu.faircode.email;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
@ -50,7 +51,9 @@ public class FixedImageView extends androidx.appcompat.widget.AppCompatImageView
Log.e(new Throwable(Helper.getViewName(this), ex));
Context context = getContext();
Drawable d = context.getDrawable(R.drawable.twotone_broken_image_24);
d.setBounds(getDrawable().getBounds());
Rect b = getDrawable().getBounds();
int px = Math.min(b.width(), b.height());
d.setBounds(0, 0, px, px);
d.draw(canvas);
}
}