1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Layout improvements

This commit is contained in:
M66B 2018-08-23 06:57:24 +00:00
parent 65cd93a340
commit ab0ddbfa4d
2 changed files with 29 additions and 11 deletions

View file

@ -58,6 +58,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
implements View.OnClickListener, View.OnLongClickListener {
View itemView;
TextView tvFrom;
TextView tvSize;
TextView tvTime;
ImageView ivAttachments;
TextView tvSubject;
@ -71,6 +72,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
this.itemView = itemView;
tvFrom = itemView.findViewById(R.id.tvFrom);
tvSize = itemView.findViewById(R.id.tvSize);
tvTime = itemView.findViewById(R.id.tvTime);
ivAttachments = itemView.findViewById(R.id.ivAttachments);
tvSubject = itemView.findViewById(R.id.tvSubject);
@ -92,10 +94,13 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
private void clear() {
tvFrom.setText(null);
tvSize.setText(null);
tvTime.setText(null);
tvSubject.setText(null);
ivAttachments.setVisibility(View.GONE);
tvFolder.setText(null);
tvCount.setText(null);
tvError.setText(null);
pbLoading.setVisibility(View.VISIBLE);
}
@ -112,21 +117,23 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
tvTime.setText(DateUtils.getRelativeTimeSpanString(context, message.received));
}
ivAttachments.setVisibility(message.attachments > 0 ? View.VISIBLE : View.GONE);
tvSubject.setText(message.subject);
tvSize.setVisibility(View.GONE);
if (viewType == ViewType.UNIFIED) {
tvSubject.setText(message.subject);
ivAttachments.setVisibility(message.attachments > 0 ? View.VISIBLE : View.GONE);
if (viewType == ViewType.UNIFIED)
tvFolder.setText(message.accountName);
tvCount.setText(Integer.toString(message.count));
tvCount.setVisibility(debug || message.count > 1 ? View.VISIBLE : View.GONE);
} else if (viewType == ViewType.FOLDER) {
else if (viewType == ViewType.FOLDER)
tvFolder.setVisibility(View.GONE);
else
tvFolder.setText(Helper.localizeFolderName(context, message.folderName));
if (viewType == ViewType.THREAD)
tvCount.setVisibility(View.GONE);
else {
tvCount.setText(Integer.toString(message.count));
tvCount.setVisibility(debug || message.count > 1 ? View.VISIBLE : View.GONE);
} else {
tvCount.setVisibility(View.GONE);
tvFolder.setText(Helper.localizeFolderName(context, message.folderName));
tvFolder.setVisibility(View.VISIBLE);
}
if (debug) {

View file

@ -15,10 +15,21 @@
android:maxLines="1"
android:text="From"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toStartOf="@+id/tvTime"
app:layout_constraintEnd_toStartOf="@+id/tvSize"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:maxLines="1"
android:text="123K"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/tvFrom"
app:layout_constraintEnd_toStartOf="@+id/tvTime" />
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"