1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Show keywords

This commit is contained in:
M66B 2018-11-25 18:29:11 +01:00
parent 8073c089b7
commit 4beb4eb8d0
5 changed files with 38 additions and 7 deletions

View file

@ -162,6 +162,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
private TextView tvTimeSent;
private TextView tvTimeReceived;
private TextView tvSubjectEx;
private TextView tvKeywords;
private TextView tvHeaders;
private ProgressBar pbHeaders;
@ -215,6 +216,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
tvCc = itemView.findViewById(R.id.tvCc);
tvBcc = itemView.findViewById(R.id.tvBcc);
tvSubjectEx = itemView.findViewById(R.id.tvSubjectEx);
tvKeywords = itemView.findViewById(R.id.tvKeywords);
tvHeaders = itemView.findViewById(R.id.tvHeaders);
pbHeaders = itemView.findViewById(R.id.pbHeaders);
@ -411,6 +413,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
tvTime.setTextColor(colorUnseen);
grpAddress.setVisibility(viewType == ViewType.THREAD && show_expanded && show_addresses ? View.VISIBLE : View.GONE);
tvKeywords.setVisibility(View.GONE);
ivAddContact.setVisibility(viewType == ViewType.THREAD && show_expanded && contacts && message.from != null ? View.VISIBLE : View.GONE);
pbHeaders.setVisibility(View.GONE);
grpHeaders.setVisibility(show_headers && show_expanded ? View.VISIBLE : View.GONE);
@ -438,6 +441,8 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
tvCc.setText(MessageHelper.getFormattedAddresses(message.cc, true));
tvBcc.setText(MessageHelper.getFormattedAddresses(message.bcc, true));
tvSubjectEx.setText(message.subject);
tvKeywords.setText(TextUtils.join(" ", message.keywords));
tvKeywords.setVisibility(message.keywords.length > 0 ? View.VISIBLE : View.GONE);
tvHeaders.setText(show_headers ? message.headers : null);

View file

@ -186,7 +186,7 @@ public abstract class DB extends RoomDatabase {
if (value == null)
return new String[0];
else
return TextUtils.split(" ", value);
return TextUtils.split(value, " ");
}
@TypeConverter

View file

@ -1505,9 +1505,10 @@ public class ServiceSynchronize extends LifecycleService {
imessage.setFlags(flags, set);
List<String> keywords = new ArrayList<>(Arrays.asList(message.keywords));
if (set)
keywords.add(keyword);
else
if (set) {
if (!keywords.contains(keyword))
keywords.add(keyword);
} else
keywords.remove(keyword);
db.message().setMessageKeywords(message.id, DB.Converters.fromStringArray(keywords.toArray(new String[0])));
}
@ -2155,7 +2156,6 @@ public class ServiceSynchronize extends LifecycleService {
if (message.ui_hide && full) {
update = true;
message.ui_hide = false;
db.message().updateMessage(message);
Log.i(Helper.TAG, folder.name + " updated id=" + message.id + " uid=" + message.uid + " unhide");
}

View file

@ -416,6 +416,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTimeReceived" />
<TextView
android:id="@+id/tvKeywords"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="Keywords"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEx" />
<View
android:id="@+id/vSeparatorHeaders"
android:layout_width="0dp"
@ -424,7 +437,7 @@
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEx" />
app:layout_constraintTop_toBottomOf="@id/tvKeywords" />
<TextView
android:id="@+id/tvHeaders"

View file

@ -413,6 +413,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTimeReceived" />
<TextView
android:id="@+id/tvKeywords"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="Keywords"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEx" />
<View
android:id="@+id/vSeparatorHeaders"
android:layout_width="0dp"
@ -421,7 +434,7 @@
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubjectEx" />
app:layout_constraintTop_toBottomOf="@id/tvKeywords" />
<TextView
android:id="@+id/tvHeaders"