mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 01:00:04 +02:00
Height of media depends of screen size
This commit is contained in:
parent
c2e15c2bfb
commit
413d11b3c3
1 changed files with 7 additions and 2 deletions
|
@ -2257,14 +2257,19 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
||||||
boolean expand_media = sharedpreferences.getBoolean(context.getString(R.string.SET_EXPAND_MEDIA), false);
|
boolean expand_media = sharedpreferences.getBoolean(context.getString(R.string.SET_EXPAND_MEDIA), false);
|
||||||
|
|
||||||
LinearLayout.LayoutParams lp;
|
LinearLayout.LayoutParams lp;
|
||||||
|
int defaultHeight = (int) Helper.convertDpToPixel(200, context);
|
||||||
|
if (measuredWidth > 0) {
|
||||||
|
defaultHeight = (int) (measuredWidth * 3) / 4;
|
||||||
|
}
|
||||||
if (fullAttachement && mediaH > 0 && (!statusToDeal.sensitive || expand_media)) {
|
if (fullAttachement && mediaH > 0 && (!statusToDeal.sensitive || expand_media)) {
|
||||||
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (int) (mediaH * ratio));
|
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (int) (mediaH * ratio));
|
||||||
layoutMediaBinding.media.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
layoutMediaBinding.media.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||||
} else {
|
} else {
|
||||||
if (singleImage) {
|
if (singleImage) {
|
||||||
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (int) Helper.convertDpToPixel(200, context));
|
lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, defaultHeight);
|
||||||
} else {
|
} else {
|
||||||
lp = new LinearLayout.LayoutParams((int) Helper.convertDpToPixel(200, context), (int) Helper.convertDpToPixel(200, context));
|
//noinspection SuspiciousNameCombination
|
||||||
|
lp = new LinearLayout.LayoutParams(defaultHeight, defaultHeight);
|
||||||
}
|
}
|
||||||
layoutMediaBinding.media.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
layoutMediaBinding.media.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue