mirror of https://github.com/M66B/FairEmail.git
Scale avatar with text
This commit is contained in:
parent
e65f5cbae4
commit
f0e8e6211b
|
@ -469,6 +469,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
tvFrom.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
tvFrom.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
||||||
tvSubject.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize * 0.9f);
|
tvSubject.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize * 0.9f);
|
||||||
tvBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
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
|
// Date header
|
||||||
|
|
|
@ -77,8 +77,9 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/ivAvatar"
|
android:id="@+id/ivAvatar"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="0dp"
|
||||||
android:padding="6dp"
|
android:paddingStart="6dp"
|
||||||
|
android:paddingEnd="6dp"
|
||||||
android:src="@drawable/baseline_person_24"
|
android:src="@drawable/baseline_person_24"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/tvFolder"
|
app:layout_constraintBottom_toBottomOf="@+id/tvFolder"
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
|
|
Loading…
Reference in New Issue