Mark found messages in a conversation

pull/172/head
M66B 5 years ago
parent 3e26cecf11
commit 97d25a9cb4

@ -165,6 +165,7 @@ import static android.app.Activity.RESULT_OK;
public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHolder> {
private Fragment parentFragment;
private String type;
private boolean found;
private ViewType viewType;
private boolean compact;
private int zoom;
@ -278,6 +279,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private TextView tvSize;
private TextView tvTime;
private ImageView ivType;
private ImageView ivFound;
private ImageButton ibSnoozed;
private ImageView ivAnswered;
private ImageView ivAttachments;
@ -403,6 +405,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvSize = itemView.findViewById(R.id.tvSize);
tvTime = itemView.findViewById(R.id.tvTime);
ivType = itemView.findViewById(R.id.ivType);
ivFound = itemView.findViewById(R.id.ivFound);
ibSnoozed = itemView.findViewById(R.id.ibSnoozed);
ivAnswered = itemView.findViewById(R.id.ivAnswered);
ivAttachments = itemView.findViewById(R.id.ivAttachments);
@ -702,6 +705,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvSize.setText(null);
tvTime.setText(null);
ivType.setVisibility(View.GONE);
ivFound.setVisibility(View.GONE);
ibSnoozed.setVisibility(View.GONE);
ivAnswered.setVisibility(View.GONE);
ivAttachments.setVisibility(View.GONE);
@ -770,6 +774,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvSize.setAlpha(dim ? Helper.LOW_LIGHT : 1.0f);
tvTime.setAlpha(dim ? Helper.LOW_LIGHT : 1.0f);
ivType.setAlpha(dim ? Helper.LOW_LIGHT : 1.0f);
ivFound.setAlpha(dim ? Helper.LOW_LIGHT : 1.0f);
ibSnoozed.setAlpha(dim ? Helper.LOW_LIGHT : 1.0f);
ivAnswered.setAlpha(dim ? Helper.LOW_LIGHT : 1.0f);
ivAttachments.setAlpha(dim ? Helper.LOW_LIGHT : 1.0f);
@ -858,6 +863,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ivType.setImageResource(icon);
}
ivFound.setVisibility(message.ui_found && found ? View.VISIBLE : View.GONE);
ibSnoozed.setImageResource(
message.ui_snoozed != null && message.ui_snoozed == Long.MAX_VALUE
? R.drawable.baseline_visibility_off_24 : R.drawable.baseline_timelapse_24);
@ -3918,6 +3925,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (ibAuth.getVisibility() == View.VISIBLE)
result.add(context.getString(R.string.title_legend_auth));
if (ivFound.getVisibility() == View.VISIBLE)
result.add(context.getString(R.string.title_legend_found));
if (ibSnoozed.getVisibility() == View.VISIBLE)
result.add(context.getString(R.string.title_legend_snoozed));
@ -3948,11 +3958,12 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
AdapterMessage(Fragment parentFragment,
String type, ViewType viewType,
String type, boolean found, ViewType viewType,
boolean compact, int zoom, String sort, boolean ascending, boolean filter_duplicates,
final IProperties properties) {
this.parentFragment = parentFragment;
this.type = type;
this.found = found;
this.viewType = viewType;
this.compact = compact;
this.zoom = zoom;
@ -4311,6 +4322,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
Log.i("keywords changed id=" + next.id);
}
// notifying
// fts
if (!prev.ui_seen.equals(next.ui_seen)) {
same = false;
Log.i("ui_seen changed id=" + next.id);

@ -650,7 +650,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
viewType == AdapterMessage.ViewType.THREAD ? "ascending_thread" : "ascending_list", false);
boolean filter_duplicates = prefs.getBoolean("filter_duplicates", true);
adapter = new AdapterMessage(this, type, viewType, compact, zoom, sort, ascending, filter_duplicates, iProperties);
adapter = new AdapterMessage(
this, type, found, viewType,
compact, zoom, sort, ascending, filter_duplicates,
iProperties);
rvMessage.setAdapter(adapter);
sbThread.setOnTouchListener(new View.OnTouchListener() {

@ -167,6 +167,17 @@
app:layout_constraintTop_toTopOf="@+id/tvSubject"
app:srcCompat="@drawable/baseline_edit_24" />
<ImageView
android:id="@+id/ivFound"
android:layout_width="21dp"
android:layout_height="21dp"
android:layout_marginStart="6dp"
android:contentDescription="@string/title_legend_found"
app:layout_constraintBottom_toBottomOf="@+id/tvSubject"
app:layout_constraintStart_toEndOf="@id/ivType"
app:layout_constraintTop_toTopOf="@+id/tvSubject"
app:srcCompat="@drawable/baseline_search_24" />
<ImageButton
android:id="@+id/ibSnoozed"
android:layout_width="21dp"
@ -175,7 +186,7 @@
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_snoozed"
app:layout_constraintBottom_toBottomOf="@+id/tvSubject"
app:layout_constraintStart_toEndOf="@id/ivType"
app:layout_constraintStart_toEndOf="@id/ivFound"
app:layout_constraintTop_toTopOf="@+id/tvSubject"
app:srcCompat="@drawable/baseline_timelapse_24" />

@ -191,6 +191,17 @@
app:layout_constraintTop_toTopOf="@+id/tvFolder"
app:srcCompat="@drawable/baseline_edit_24" />
<ImageView
android:id="@+id/ivFound"
android:layout_width="21dp"
android:layout_height="21dp"
android:layout_marginStart="6dp"
android:contentDescription="@string/title_legend_found"
app:layout_constraintBottom_toBottomOf="@+id/tvFolder"
app:layout_constraintStart_toEndOf="@id/ivType"
app:layout_constraintTop_toTopOf="@+id/tvFolder"
app:srcCompat="@drawable/baseline_search_24" />
<ImageButton
android:id="@+id/ibSnoozed"
android:layout_width="21dp"
@ -199,7 +210,7 @@
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_snoozed"
app:layout_constraintBottom_toBottomOf="@+id/tvFolder"
app:layout_constraintStart_toEndOf="@id/ivType"
app:layout_constraintStart_toEndOf="@id/ivFound"
app:layout_constraintTop_toTopOf="@+id/tvFolder"
app:srcCompat="@drawable/baseline_timelapse_24" />

@ -912,6 +912,7 @@
<string name="title_legend_signed">Is signed</string>
<string name="title_legend_encrypted">Is encrypted</string>
<string name="title_legend_auth">Authentication failed</string>
<string name="title_legend_found">Was found</string>
<string name="title_legend_snoozed">Is snoozed</string>
<string name="title_legend_browsed">Is browsed or searched</string>
<string name="title_legend_answered">Has been answered</string>

Loading…
Cancel
Save