Improved layout

This commit is contained in:
M66B 2019-05-24 09:10:20 +02:00
parent bc652cc8af
commit 75812c06d1
2 changed files with 23 additions and 31 deletions

View File

@ -67,10 +67,10 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
private View view; private View view;
private ImageButton ibDelete; private ImageButton ibDelete;
private TextView tvName; private TextView tvName;
private TextView tvType;
private TextView tvSize; private TextView tvSize;
private ImageView ivStatus; private ImageView ivStatus;
private ImageButton ibSave; private ImageButton ibSave;
private TextView tvType;
private TextView tvDebug; private TextView tvDebug;
private ProgressBar progressbar; private ProgressBar progressbar;
@ -80,10 +80,10 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
view = itemView.findViewById(R.id.clItem); view = itemView.findViewById(R.id.clItem);
ibDelete = itemView.findViewById(R.id.ibDelete); ibDelete = itemView.findViewById(R.id.ibDelete);
tvName = itemView.findViewById(R.id.tvName); tvName = itemView.findViewById(R.id.tvName);
tvType = itemView.findViewById(R.id.tvType);
tvSize = itemView.findViewById(R.id.tvSize); tvSize = itemView.findViewById(R.id.tvSize);
ivStatus = itemView.findViewById(R.id.ivStatus); ivStatus = itemView.findViewById(R.id.ivStatus);
ibSave = itemView.findViewById(R.id.ibSave); ibSave = itemView.findViewById(R.id.ibSave);
tvType = itemView.findViewById(R.id.tvType);
tvDebug = itemView.findViewById(R.id.tvDebug); tvDebug = itemView.findViewById(R.id.tvDebug);
progressbar = itemView.findViewById(R.id.progressbar); progressbar = itemView.findViewById(R.id.progressbar);
} }
@ -105,8 +105,6 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
ibDelete.setVisibility(readonly ? View.GONE : attachment.isInline() ? View.INVISIBLE : View.VISIBLE); ibDelete.setVisibility(readonly ? View.GONE : attachment.isInline() ? View.INVISIBLE : View.VISIBLE);
tvName.setText(attachment.name); tvName.setText(attachment.name);
tvType.setText(attachment.type);
tvType.setVisibility(debug || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
if (attachment.size != null) if (attachment.size != null)
tvSize.setText(Helper.humanReadableByteCount(attachment.size, true)); tvSize.setText(Helper.humanReadableByteCount(attachment.size, true));
@ -130,14 +128,11 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
progressbar.setVisibility( progressbar.setVisibility(
attachment.progress == null || attachment.available ? View.GONE : View.VISIBLE); attachment.progress == null || attachment.available ? View.GONE : View.VISIBLE);
if (debug) tvType.setText(attachment.type + " " + attachment.disposition + " " + attachment.cid + "/" + attachment.encryption);
tvDebug.setText(attachment.error + tvType.setVisibility(debug || BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
"\n" + attachment.type +
" " + attachment.disposition +
" " + attachment.cid + " " + attachment.encryption);
else if (attachment.error != null)
tvDebug.setText(attachment.error); tvDebug.setText(attachment.error);
tvDebug.setVisibility(debug || attachment.error != null ? View.VISIBLE : View.GONE); tvDebug.setVisibility(attachment.error == null ? View.GONE : View.VISIBLE);
} }
@Override @Override

View File

@ -44,27 +44,11 @@
android:text="Name" android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/ivAttachments" app:layout_constraintBottom_toBottomOf="@id/ivAttachments"
app:layout_constraintEnd_toStartOf="@+id/tvType" app:layout_constraintEnd_toStartOf="@+id/tvSize"
app:layout_constraintHorizontal_weight="4" app:layout_constraintHorizontal_weight="4"
app:layout_constraintStart_toEndOf="@id/ivAttachments" app:layout_constraintStart_toEndOf="@id/ivAttachments"
app:layout_constraintTop_toTopOf="@id/ivAttachments" /> app:layout_constraintTop_toTopOf="@id/ivAttachments" />
<TextView
android:id="@+id/tvType"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:ellipsize="start"
android:gravity="end"
android:singleLine="true"
android:text="text/plain"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/ivAttachments"
app:layout_constraintEnd_toStartOf="@id/tvSize"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toEndOf="@id/tvName"
app:layout_constraintTop_toTopOf="@id/ivAttachments" />
<TextView <TextView
android:id="@+id/tvSize" android:id="@+id/tvSize"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -74,7 +58,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintBottom_toBottomOf="@id/ivAttachments" app:layout_constraintBottom_toBottomOf="@id/ivAttachments"
app:layout_constraintEnd_toStartOf="@+id/ivStatus" app:layout_constraintEnd_toStartOf="@+id/ivStatus"
app:layout_constraintStart_toEndOf="@id/tvType" app:layout_constraintStart_toEndOf="@id/tvName"
app:layout_constraintTop_toTopOf="@id/ivAttachments" /> app:layout_constraintTop_toTopOf="@id/ivAttachments" />
<ImageView <ImageView
@ -100,6 +84,19 @@
app:layout_constraintStart_toEndOf="@id/ivStatus" app:layout_constraintStart_toEndOf="@id/ivStatus"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvType"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="start"
android:singleLine="true"
android:text="text/plain"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="@id/ivStatus"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintStart_toStartOf="@id/tvName"
app:layout_constraintTop_toBottomOf="@id/ivAttachments" />
<TextView <TextView
android:id="@+id/tvDebug" android:id="@+id/tvDebug"
android:layout_width="0dp" android:layout_width="0dp"
@ -110,7 +107,7 @@
android:textColor="?attr/colorWarning" android:textColor="?attr/colorWarning"
app:layout_constraintEnd_toEndOf="@id/ivStatus" app:layout_constraintEnd_toEndOf="@id/ivStatus"
app:layout_constraintStart_toEndOf="@id/ivAttachments" app:layout_constraintStart_toEndOf="@id/ivAttachments"
app:layout_constraintTop_toBottomOf="@id/ivAttachments" /> app:layout_constraintTop_toBottomOf="@id/tvType" />
<ProgressBar <ProgressBar
android:id="@+id/progressbar" android:id="@+id/progressbar"