Scale avatar with text

This commit is contained in:
M66B
2019-03-08 09:15:40 +00:00
parent e65f5cbae4
commit f0e8e6211b
2 changed files with 16 additions and 2 deletions

View File

@@ -469,6 +469,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvFrom.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
tvSubject.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize * 0.9f);
tvBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
int px = Math.round(TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_PX, textSize * (compact ? 1.5f : 3.0f),
context.getResources().getDisplayMetrics()));
if (compact && tvFrom.getMinHeight() != px)
tvFrom.setMinimumHeight(px);
ViewGroup.LayoutParams lparams = ivAvatar.getLayoutParams();
if (lparams.height != px) {
lparams.width = px;
lparams.height = px;
ivAvatar.requestLayout();
}
}
// Date header