mirror of https://github.com/M66B/FairEmail.git
Fixed broken image
This commit is contained in:
parent
9e33838a00
commit
69b19fd97d
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
@ -49,7 +50,9 @@ public class FixedImageButton extends AppCompatImageButton {
|
||||||
Log.e(new Throwable(Helper.getViewName(this), ex));
|
Log.e(new Throwable(Helper.getViewName(this), ex));
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
Drawable d = context.getDrawable(R.drawable.twotone_broken_image_24);
|
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);
|
d.draw(canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -50,7 +51,9 @@ public class FixedImageView extends androidx.appcompat.widget.AppCompatImageView
|
||||||
Log.e(new Throwable(Helper.getViewName(this), ex));
|
Log.e(new Throwable(Helper.getViewName(this), ex));
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
Drawable d = context.getDrawable(R.drawable.twotone_broken_image_24);
|
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);
|
d.draw(canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue