mirror of https://github.com/M66B/FairEmail.git
Small improvements
This commit is contained in:
parent
eace1ed600
commit
8936223b84
|
@ -60,12 +60,12 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
implements View.OnClickListener, View.OnLongClickListener {
|
||||
View itemView;
|
||||
TextView tvFrom;
|
||||
TextView tvSize;
|
||||
TextView tvTime;
|
||||
ImageView ivAttachments;
|
||||
TextView tvSubject;
|
||||
TextView tvFolder;
|
||||
TextView tvCount;
|
||||
ImageView ivThread;
|
||||
TextView tvError;
|
||||
ProgressBar pbLoading;
|
||||
|
||||
|
@ -74,12 +74,12 @@ 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);
|
||||
tvFolder = itemView.findViewById(R.id.tvFolder);
|
||||
tvCount = itemView.findViewById(R.id.tvCount);
|
||||
ivThread = itemView.findViewById(R.id.ivThread);
|
||||
tvError = itemView.findViewById(R.id.tvError);
|
||||
pbLoading = itemView.findViewById(R.id.pbLoading);
|
||||
}
|
||||
|
@ -96,12 +96,12 @@ 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);
|
||||
ivThread.setVisibility(View.GONE);
|
||||
tvError.setText(null);
|
||||
pbLoading.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
@ -119,8 +119,6 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
tvTime.setText(DateUtils.getRelativeTimeSpanString(context, message.received));
|
||||
}
|
||||
|
||||
tvSize.setVisibility(View.GONE);
|
||||
|
||||
tvSubject.setText(message.subject);
|
||||
ivAttachments.setVisibility(message.attachments > 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
|
@ -131,11 +129,12 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
else
|
||||
tvFolder.setText(Helper.localizeFolderName(context, message.folderName));
|
||||
|
||||
if (viewType == ViewType.THREAD)
|
||||
if (viewType == ViewType.THREAD) {
|
||||
tvCount.setVisibility(View.GONE);
|
||||
else {
|
||||
ivThread.setVisibility(View.GONE);
|
||||
} else {
|
||||
tvCount.setText(Integer.toString(message.count));
|
||||
tvCount.setVisibility(debug || message.count > 1 ? View.VISIBLE : View.GONE);
|
||||
ivThread.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
|
|
|
@ -113,7 +113,6 @@ public class FragmentMessage extends FragmentEx {
|
|||
private ViewGroup view;
|
||||
private View vwAnswerAnchor;
|
||||
private TextView tvFrom;
|
||||
private TextView tvSize;
|
||||
private TextView tvTime;
|
||||
private TextView tvTo;
|
||||
private TextView tvSubject;
|
||||
|
@ -131,6 +130,7 @@ public class FragmentMessage extends FragmentEx {
|
|||
private BottomNavigationView bottom_navigation;
|
||||
private ProgressBar pbWait;
|
||||
private Group grpHeader;
|
||||
private Group grpThread;
|
||||
private Group grpAddresses;
|
||||
private Group grpAttachments;
|
||||
private Group grpError;
|
||||
|
@ -198,7 +198,6 @@ public class FragmentMessage extends FragmentEx {
|
|||
// Get controls
|
||||
vwAnswerAnchor = view.findViewById(R.id.vwAnswerAnchor);
|
||||
tvFrom = view.findViewById(R.id.tvFrom);
|
||||
tvSize = view.findViewById(R.id.tvSize);
|
||||
tvTime = view.findViewById(R.id.tvTime);
|
||||
tvTo = view.findViewById(R.id.tvTo);
|
||||
tvSubject = view.findViewById(R.id.tvSubject);
|
||||
|
@ -216,6 +215,7 @@ public class FragmentMessage extends FragmentEx {
|
|||
bottom_navigation = view.findViewById(R.id.bottom_navigation);
|
||||
pbWait = view.findViewById(R.id.pbWait);
|
||||
grpHeader = view.findViewById(R.id.grpHeader);
|
||||
grpThread = view.findViewById(R.id.grpThread);
|
||||
grpAddresses = view.findViewById(R.id.grpAddresses);
|
||||
grpAttachments = view.findViewById(R.id.grpAttachments);
|
||||
grpError = view.findViewById(R.id.grpError);
|
||||
|
@ -223,13 +223,6 @@ public class FragmentMessage extends FragmentEx {
|
|||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
tvCount.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
onMenuThread();
|
||||
}
|
||||
});
|
||||
|
||||
tvBody.setMovementMethod(new LinkMovementMethod() {
|
||||
public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) {
|
||||
if (event.getAction() != MotionEvent.ACTION_UP)
|
||||
|
@ -300,12 +293,11 @@ public class FragmentMessage extends FragmentEx {
|
|||
vSeparatorBody.setVisibility(View.GONE);
|
||||
fab.setVisibility(View.GONE);
|
||||
|
||||
tvCount.setVisibility(View.GONE);
|
||||
grpThread.setVisibility(View.GONE);
|
||||
grpAddresses.setVisibility(View.GONE);
|
||||
grpAttachments.setVisibility(View.GONE);
|
||||
grpError.setVisibility(View.GONE);
|
||||
|
||||
tvCount.setTag(tvCount.getVisibility());
|
||||
tvCc.setTag(grpAddresses.getVisibility());
|
||||
tvError.setTag(grpError.getVisibility());
|
||||
}
|
||||
|
@ -324,7 +316,7 @@ public class FragmentMessage extends FragmentEx {
|
|||
|
||||
RecyclerView.Adapter adapter = rvAttachment.getAdapter();
|
||||
|
||||
tvCount.setVisibility((int) tvCount.getTag());
|
||||
grpThread.setVisibility(View.VISIBLE);
|
||||
grpAddresses.setVisibility((int) tvCc.getTag());
|
||||
grpAttachments.setVisibility(adapter != null && adapter.getItemCount() > 0 ? View.VISIBLE : View.GONE);
|
||||
grpError.setVisibility((int) tvError.getTag());
|
||||
|
@ -367,13 +359,11 @@ public class FragmentMessage extends FragmentEx {
|
|||
grpMessage.setVisibility(View.GONE);
|
||||
pbBody.setVisibility(View.GONE);
|
||||
bottom_navigation.setVisibility(View.GONE);
|
||||
tvCount.setVisibility(View.GONE);
|
||||
grpThread.setVisibility(View.GONE);
|
||||
grpError.setVisibility(View.GONE);
|
||||
fab.setVisibility(View.GONE);
|
||||
pbWait.setVisibility(View.VISIBLE);
|
||||
|
||||
tvSize.setText(null);
|
||||
|
||||
rvAttachment.setHasFixedSize(false);
|
||||
LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
||||
rvAttachment.setLayoutManager(llm);
|
||||
|
@ -382,9 +372,7 @@ public class FragmentMessage extends FragmentEx {
|
|||
adapter = new AdapterAttachment(getContext(), getViewLifecycleOwner(), true);
|
||||
rvAttachment.setAdapter(adapter);
|
||||
|
||||
tvCount.setTag(View.GONE);
|
||||
tvCc.setTag(View.GONE);
|
||||
rvAttachment.setTag(View.GONE);
|
||||
tvError.setTag(View.GONE);
|
||||
|
||||
return view;
|
||||
|
@ -402,7 +390,6 @@ public class FragmentMessage extends FragmentEx {
|
|||
outState.putSerializable("message", message);
|
||||
outState.putBoolean("free", free);
|
||||
if (free) {
|
||||
outState.putInt("tag_count", (int) tvCount.getTag());
|
||||
outState.putInt("tag_cc", (int) tvCc.getTag());
|
||||
outState.putInt("tag_error", (int) tvError.getTag());
|
||||
}
|
||||
|
@ -430,9 +417,7 @@ public class FragmentMessage extends FragmentEx {
|
|||
} else {
|
||||
free = savedInstanceState.getBoolean("free");
|
||||
if (free) {
|
||||
tvCount.setTag(savedInstanceState.getInt("tag_count"));
|
||||
tvCc.setTag(savedInstanceState.getInt("tag_cc"));
|
||||
rvAttachment.setTag(savedInstanceState.getInt("tag_attachment"));
|
||||
tvError.setTag(savedInstanceState.getInt("tag_error"));
|
||||
}
|
||||
}
|
||||
|
@ -465,11 +450,11 @@ public class FragmentMessage extends FragmentEx {
|
|||
vSeparatorBody.setVisibility(free ? View.GONE : View.VISIBLE);
|
||||
|
||||
if (free) {
|
||||
tvCount.setVisibility((int) tvCount.getTag());
|
||||
grpThread.setVisibility(View.GONE);
|
||||
grpAddresses.setVisibility((int) tvCc.getTag());
|
||||
grpError.setVisibility((int) tvError.getTag());
|
||||
} else {
|
||||
tvCount.setVisibility(!free && message.count > 1 ? View.VISIBLE : View.GONE);
|
||||
grpThread.setVisibility(!free ? View.VISIBLE : View.GONE);
|
||||
grpError.setVisibility(free || message.error == null ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
|
@ -578,9 +563,9 @@ public class FragmentMessage extends FragmentEx {
|
|||
boolean inOutbox = EntityFolder.OUTBOX.equals(message.folderType);
|
||||
|
||||
menu.findItem(R.id.menu_addresses).setVisible(!free);
|
||||
menu.findItem(R.id.menu_thread).setVisible(!free && message.count > 1);
|
||||
menu.findItem(R.id.menu_forward).setVisible(!free && !inOutbox);
|
||||
menu.findItem(R.id.menu_reply_all).setVisible(!free && message.cc != null && !inOutbox);
|
||||
menu.findItem(R.id.menu_thread).setVisible(message.count > 1);
|
||||
menu.findItem(R.id.menu_forward).setVisible(!inOutbox);
|
||||
menu.findItem(R.id.menu_reply_all).setVisible(message.cc != null && !inOutbox);
|
||||
menu.findItem(R.id.menu_decrypt).setVisible(!inOutbox);
|
||||
}
|
||||
|
||||
|
@ -1059,7 +1044,6 @@ public class FragmentMessage extends FragmentEx {
|
|||
SpannedString ss = new SpannedString(body);
|
||||
boolean has_images = (ss.getSpans(0, ss.length(), ImageSpan.class).length > 0);
|
||||
|
||||
tvSize.setText(Helper.humanReadableByteCount(args.getInt("size"), false));
|
||||
tvBody.setText(body);
|
||||
tvBody.setTag(true);
|
||||
btnImages.setVisibility(has_images && !show_images ? View.VISIBLE : View.GONE);
|
||||
|
|
|
@ -25,22 +25,10 @@
|
|||
android:text="From"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:textIsSelectable="true"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvSize"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvTime"
|
||||
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="123 K"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textIsSelectable="true"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvTime"
|
||||
app:layout_constraintTop_toTopOf="@id/tvFrom" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTime"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -98,10 +86,21 @@
|
|||
android:id="@+id/tvCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:maxLines="1"
|
||||
android:text="3"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSubject"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivThread"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSubject" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivThread"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:src="@drawable/baseline_message_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSubject"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSubject" />
|
||||
|
||||
|
@ -335,6 +334,12 @@
|
|||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="tvFrom,tvToTitle,tvTo,tvSize,tvTime,tvSubject" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpThread"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="tvCount,ivThread" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpAddresses"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -15,21 +15,10 @@
|
|||
android:maxLines="1"
|
||||
android:text="From"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvSize"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tvTime"
|
||||
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"
|
||||
|
@ -80,12 +69,22 @@
|
|||
android:id="@+id/tvCount"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:layout_marginEnd="3dp"
|
||||
android:maxLines="1"
|
||||
android:text="3"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSubject"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivThread" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivThread"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:src="@drawable/baseline_message_24"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvSubject"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/tvSubject" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvError"
|
||||
|
|
Loading…
Reference in New Issue