Browse Source

Layout improvements

main
M66B 6 years ago
parent
commit
ab0ddbfa4d
2 changed files with 28 additions and 10 deletions
  1. +16
    -9
      app/src/main/java/eu/faircode/email/AdapterMessage.java
  2. +12
    -1
      app/src/main/res/layout/item_message.xml

+ 16
- 9
app/src/main/java/eu/faircode/email/AdapterMessage.java 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);
tvSize.setVisibility(View.GONE);
tvSubject.setText(message.subject);
ivAttachments.setVisibility(message.attachments > 0 ? View.VISIBLE : View.GONE);
if (viewType == ViewType.UNIFIED) {
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) {


+ 12
- 1
app/src/main/res/layout/item_message.xml 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"


Loading…
Cancel
Save