Browse Source

Fixed message unseen color

main
M66B 6 years ago
parent
commit
3a55ea5269
2 changed files with 26 additions and 19 deletions
  1. +7
    -5
      app/src/main/java/eu/faircode/email/AdapterMessage.java
  2. +19
    -14
      app/src/main/java/eu/faircode/email/FragmentMessage.java

+ 7
- 5
app/src/main/java/eu/faircode/email/AdapterMessage.java View File

@ -120,8 +120,10 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
tvSubject.setTypeface(null, typeface); tvSubject.setTypeface(null, typeface);
tvCount.setTypeface(null, typeface); tvCount.setTypeface(null, typeface);
tvFrom.setTextColor(Helper.resolveColor(context, unseen ? R.attr.colorUnread : android.R.attr.textColorSecondary));
tvTime.setTextColor(Helper.resolveColor(context, unseen ? R.attr.colorUnread : android.R.attr.textColorSecondary));
int colorUnseen = Helper.resolveColor(context, unseen
? R.attr.colorUnread : android.R.attr.textColorSecondary);
tvFrom.setTextColor(colorUnseen);
tvTime.setTextColor(colorUnseen);
} }
@Override @Override
@ -138,7 +140,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
if (EntityFolder.TYPE_DRAFTS.equals(message.folderType)) if (EntityFolder.TYPE_DRAFTS.equals(message.folderType))
context.startActivity( context.startActivity(
new Intent(context, ActivityCompose.class) new Intent(context, ActivityCompose.class)
.putExtra("id" , message.id));
.putExtra("id", message.id));
else { else {
boolean outbox = EntityFolder.TYPE_OUTBOX.equals(message.folderType); boolean outbox = EntityFolder.TYPE_OUTBOX.equals(message.folderType);
if (!outbox && !message.seen && !message.ui_seen) { if (!outbox && !message.seen && !message.ui_seen) {
@ -151,7 +153,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context); LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast( lbm.sendBroadcast(
new Intent(ActivityView.ACTION_VIEW_MESSAGE) new Intent(ActivityView.ACTION_VIEW_MESSAGE)
.putExtra("id" , message.id));
.putExtra("id", message.id));
} }
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex)); Log.e(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
@ -165,7 +167,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
super(DIFF_CALLBACK); super(DIFF_CALLBACK);
this.context = context; this.context = context;
this.viewType = viewType; this.viewType = viewType;
this.debug = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("debug" , false);
this.debug = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("debug", false);
} }
public static final DiffUtil.ItemCallback<TupleMessageEx> DIFF_CALLBACK = public static final DiffUtil.ItemCallback<TupleMessageEx> DIFF_CALLBACK =


+ 19
- 14
app/src/main/java/eu/faircode/email/FragmentMessage.java View File

@ -135,7 +135,7 @@ public class FragmentMessage extends FragmentEx {
URLSpan[] link = buffer.getSpans(off, off, URLSpan.class); URLSpan[] link = buffer.getSpans(off, off, URLSpan.class);
if (link.length != 0) { if (link.length != 0) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString("link" , link[0].getURL());
args.putString("link", link[0].getURL());
FragmentWebView fragment = new FragmentWebView(); FragmentWebView fragment = new FragmentWebView();
fragment.setArguments(args); fragment.setArguments(args);
@ -230,11 +230,16 @@ public class FragmentMessage extends FragmentEx {
tvSubject.setText(message.subject); tvSubject.setText(message.subject);
tvCount.setText(Integer.toString(message.count)); tvCount.setText(Integer.toString(message.count));
int visibility = (message.ui_seen ? Typeface.NORMAL : Typeface.BOLD);
tvFrom.setTypeface(null, visibility);
tvTime.setTypeface(null, visibility);
tvSubject.setTypeface(null, visibility);
tvCount.setTypeface(null, visibility);
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);
DB.getInstance(getContext()).attachment().liveAttachments(id).removeObservers(FragmentMessage.this); DB.getInstance(getContext()).attachment().liveAttachments(id).removeObservers(FragmentMessage.this);
DB.getInstance(getContext()).attachment().liveAttachments(id).observe(FragmentMessage.this, DB.getInstance(getContext()).attachment().liveAttachments(id).observe(FragmentMessage.this,
@ -341,7 +346,7 @@ public class FragmentMessage extends FragmentEx {
private void onActionThread(long id) { private void onActionThread(long id) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("thread" , id); // message ID
args.putLong("thread", id); // message ID
FragmentMessages fragment = new FragmentMessages(); FragmentMessages fragment = new FragmentMessages();
fragment.setArguments(args); fragment.setArguments(args);
@ -353,14 +358,14 @@ public class FragmentMessage extends FragmentEx {
private void onActionForward(long id) { private void onActionForward(long id) {
startActivity(new Intent(getContext(), ActivityCompose.class) startActivity(new Intent(getContext(), ActivityCompose.class)
.putExtra("id" , id)
.putExtra("action" , "forward"));
.putExtra("id", id)
.putExtra("action", "forward"));
} }
private void onActionReplyAll(long id) { private void onActionReplyAll(long id) {
startActivity(new Intent(getContext(), ActivityCompose.class) startActivity(new Intent(getContext(), ActivityCompose.class)
.putExtra("id" , id)
.putExtra("action" , "reply_all"));
.putExtra("id", id)
.putExtra("action", "reply_all"));
} }
private void onActionDelete(final long id) { private void onActionDelete(final long id) {
@ -443,7 +448,7 @@ public class FragmentMessage extends FragmentEx {
private void onActionMove(final long id) { private void onActionMove(final long id) {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id" , id);
args.putLong("id", id);
getLoaderManager().restartLoader(ActivityView.LOADER_MESSAGE_MOVE, args, moveLoaderCallbacks).forceLoad(); getLoaderManager().restartLoader(ActivityView.LOADER_MESSAGE_MOVE, args, moveLoaderCallbacks).forceLoad();
} }
@ -469,8 +474,8 @@ public class FragmentMessage extends FragmentEx {
private void onActionReply(long id) { private void onActionReply(long id) {
startActivity(new Intent(getContext(), ActivityCompose.class) startActivity(new Intent(getContext(), ActivityCompose.class)
.putExtra("id" , id)
.putExtra("action" , "reply"));
.putExtra("id", id)
.putExtra("action", "reply"));
} }
private static class MoveLoader extends AsyncTaskLoader<List<EntityFolder>> { private static class MoveLoader extends AsyncTaskLoader<List<EntityFolder>> {


Loading…
Cancel
Save