Layout improvement

pull/50/head
M66B 6 years ago
parent 5df36d89e6
commit af4ab0aeda

@ -315,9 +315,12 @@ public class FragmentMessage extends FragmentEx {
// Message gone (moved, deleted)
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
getFragmentManager().popBackStack();
} else {
return;
}
setSubtitle(Helper.localizeFolderName(getContext(), message.folderName));
if (savedInstanceState == null) {
tvFrom.setText(message.from == null ? null : MessageHelper.getFormattedAddresses(message.from, true));
tvTime.setText(message.sent == null ? null : df.format(new Date(message.sent)));
tvTo.setText(message.to == null ? null : MessageHelper.getFormattedAddresses(message.to, true));
@ -329,24 +332,12 @@ public class FragmentMessage extends FragmentEx {
tvCc.setText(message.cc == null ? null : MessageHelper.getFormattedAddresses(message.cc, true));
tvBcc.setText(message.bcc == null ? null : MessageHelper.getFormattedAddresses(message.bcc, true));
int typeface = (message.ui_seen ? Typeface.NORMAL : Typeface.BOLD);
tvFrom.setTypeface(null, typeface);
tvTime.setTypeface(null, typeface);
tvSubject.setTypeface(null, typeface);
tvCount.setTypeface(null, typeface);
int colorUnseen = Helper.resolveColor(getContext(), message.ui_seen
? android.R.attr.textColorSecondary : R.attr.colorUnread);
tvFrom.setTextColor(colorUnseen);
tvTime.setTextColor(colorUnseen);
tvError.setText(message.error);
MenuItem actionSeen = top_navigation.getMenu().findItem(R.id.action_seen);
actionSeen.setIcon(message.ui_seen
? R.drawable.baseline_visibility_off_24
: R.drawable.baseline_visibility_24);
actionSeen.setTitle(message.ui_seen ? R.string.title_unseen : R.string.title_seen);
} else {
free = savedInstanceState.getBoolean("free");
grpAddresses.setTag(savedInstanceState.getInt("addresses"));
rvAttachment.setTag(savedInstanceState.getInt("attachments"));
}
Bundle args = new Bundle();
args.putLong("id", message.id);
@ -362,10 +353,28 @@ public class FragmentMessage extends FragmentEx {
protected void onLoaded(Bundle args, Spanned body) {
tvBody.setText(body);
grpMessage.setVisibility(View.VISIBLE);
if (!free)
fab.setVisibility(View.VISIBLE);
}
}.load(FragmentMessage.this, args);
int typeface = (message.ui_seen ? Typeface.NORMAL : Typeface.BOLD);
tvFrom.setTypeface(null, typeface);
tvTime.setTypeface(null, typeface);
tvSubject.setTypeface(null, typeface);
tvCount.setTypeface(null, typeface);
int colorUnseen = Helper.resolveColor(getContext(), message.ui_seen
? android.R.attr.textColorSecondary : R.attr.colorUnread);
tvFrom.setTextColor(colorUnseen);
tvTime.setTextColor(colorUnseen);
MenuItem actionSeen = top_navigation.getMenu().findItem(R.id.action_seen);
actionSeen.setIcon(message.ui_seen
? R.drawable.baseline_visibility_off_24
: R.drawable.baseline_visibility_24);
actionSeen.setTitle(message.ui_seen ? R.string.title_unseen : R.string.title_seen);
db.folder().liveFolders(message.account).removeObservers(getViewLifecycleOwner());
db.folder().liveFolders(message.account).observe(getViewLifecycleOwner(), new Observer<List<TupleFolderEx>>() {
@Override
@ -404,6 +413,7 @@ public class FragmentMessage extends FragmentEx {
top_navigation.getMenu().findItem(R.id.action_edit).setVisible(inTrash);
top_navigation.getMenu().findItem(R.id.action_forward).setVisible(!inOutbox);
top_navigation.getMenu().findItem(R.id.action_reply_all).setVisible(!inOutbox && message.cc != null);
if (!free)
top_navigation.setVisibility(View.VISIBLE);
bottom_navigation.getMenu().findItem(R.id.action_spam).setVisible(message.uid != null && !inOutbox && !inArchive && !inJunk && hasJunk);
@ -415,12 +425,6 @@ public class FragmentMessage extends FragmentEx {
}
});
if (savedInstanceState != null) {
free = savedInstanceState.getBoolean("free");
grpAddresses.setTag(savedInstanceState.getInt("addresses"));
rvAttachment.setTag(savedInstanceState.getInt("attachments"));
}
pbWait.setVisibility(View.GONE);
grpHeader.setVisibility(free ? View.GONE : View.VISIBLE);
if (free)
@ -428,7 +432,6 @@ public class FragmentMessage extends FragmentEx {
tvCount.setVisibility(!free && message.count > 1 ? View.VISIBLE : View.GONE);
tvError.setVisibility(free || message.error == null ? View.GONE : View.VISIBLE);
}
}
});
// Observe attachments

@ -202,7 +202,7 @@
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginTop="3dp"
android:background="@color/darkColorSeparator"
android:background="?attr/colorSeparator"
app:itemIconTint="@color/bottomnav_background"
app:itemTextColor="@color/bottomnav_background"
app:labelVisibilityMode="unlabeled"

@ -9,14 +9,14 @@
<color name="lightColorUnread">#000</color>
<color name="lightColorItemSelected">#ccc</color>
<color name="lightColorSeparator">#ffaaaaaa</color>
<color name="lightColorSeparator">#aaa</color>
<color name="lightColorDrawerScrim">#99000000</color>
<color name="lightColorDrawerText">#111</color>
<color name="lightColorDrawerBackground">#eee</color>
<color name="darkColorUnread">#fff</color>
<color name="darkColorItemSelected">#555</color>
<color name="darkColorSeparator">#ff878787</color>
<color name="darkColorSeparator">#666</color>
<color name="darkColorDrawerScrim">#997f7f7f</color>
<color name="darkColorDrawerText">#fff</color>
<color name="darkColorDrawerBackground">#222</color>

Loading…
Cancel
Save