mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-31 20:25:38 +00:00
Added search in html (debug version only)
This commit is contained in:
parent
e6d4aa8cd4
commit
865500ff1e
5 changed files with 33 additions and 5 deletions
|
@ -455,6 +455,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
||||||
criteria.in_message = false;
|
criteria.in_message = false;
|
||||||
criteria.in_notes = false;
|
criteria.in_notes = false;
|
||||||
criteria.in_headers = false;
|
criteria.in_headers = false;
|
||||||
|
criteria.in_html = false;
|
||||||
criteria.with_flagged = true;
|
criteria.with_flagged = true;
|
||||||
FragmentMessages.search(
|
FragmentMessages.search(
|
||||||
context, owner, parentFragment.getParentFragmentManager(),
|
context, owner, parentFragment.getParentFragmentManager(),
|
||||||
|
|
|
@ -305,15 +305,19 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
boolean matched = (match.matched != null && match.matched);
|
boolean matched = (match.matched != null && match.matched);
|
||||||
|
|
||||||
if (query != null) {
|
if (query != null) {
|
||||||
if (!matched && criteria.in_message)
|
if (!matched && (criteria.in_message || criteria.in_html))
|
||||||
try {
|
try {
|
||||||
File file = EntityMessage.getFile(context, match.id);
|
File file = EntityMessage.getFile(context, match.id);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
String html = Helper.readText(file);
|
String html = Helper.readText(file);
|
||||||
if (html.toLowerCase().contains(query)) {
|
if (html.toLowerCase().contains(query)) {
|
||||||
String text = HtmlHelper.getFullText(html);
|
if (criteria.in_html)
|
||||||
if (text != null && text.toLowerCase().contains(query))
|
|
||||||
matched = true;
|
matched = true;
|
||||||
|
else {
|
||||||
|
String text = HtmlHelper.getFullText(html);
|
||||||
|
if (text != null && text.toLowerCase().contains(query))
|
||||||
|
matched = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
@ -677,6 +681,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
boolean in_message = true;
|
boolean in_message = true;
|
||||||
boolean in_notes = true;
|
boolean in_notes = true;
|
||||||
boolean in_headers = false;
|
boolean in_headers = false;
|
||||||
|
boolean in_html = false;
|
||||||
boolean with_unseen;
|
boolean with_unseen;
|
||||||
boolean with_flagged;
|
boolean with_flagged;
|
||||||
boolean with_hidden;
|
boolean with_hidden;
|
||||||
|
@ -871,6 +876,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
this.in_message == other.in_message &&
|
this.in_message == other.in_message &&
|
||||||
this.in_notes == other.in_notes &&
|
this.in_notes == other.in_notes &&
|
||||||
this.in_headers == other.in_headers &&
|
this.in_headers == other.in_headers &&
|
||||||
|
this.in_html == other.in_html &&
|
||||||
this.with_unseen == other.with_unseen &&
|
this.with_unseen == other.with_unseen &&
|
||||||
this.with_flagged == other.with_flagged &&
|
this.with_flagged == other.with_flagged &&
|
||||||
this.with_hidden == other.with_hidden &&
|
this.with_hidden == other.with_hidden &&
|
||||||
|
@ -897,6 +903,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
||||||
" message=" + in_message +
|
" message=" + in_message +
|
||||||
" notes=" + in_notes +
|
" notes=" + in_notes +
|
||||||
" headers=" + in_headers +
|
" headers=" + in_headers +
|
||||||
|
" html=" + in_html +
|
||||||
" unseen=" + with_unseen +
|
" unseen=" + with_unseen +
|
||||||
" flagged=" + with_flagged +
|
" flagged=" + with_flagged +
|
||||||
" hidden=" + with_hidden +
|
" hidden=" + with_hidden +
|
||||||
|
|
|
@ -100,6 +100,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
||||||
final CheckBox cbMessage = dview.findViewById(R.id.cbMessage);
|
final CheckBox cbMessage = dview.findViewById(R.id.cbMessage);
|
||||||
final CheckBox cbNotes = dview.findViewById(R.id.cbNotes);
|
final CheckBox cbNotes = dview.findViewById(R.id.cbNotes);
|
||||||
final CheckBox cbHeaders = dview.findViewById(R.id.cbHeaders);
|
final CheckBox cbHeaders = dview.findViewById(R.id.cbHeaders);
|
||||||
|
final CheckBox cbHtml = dview.findViewById(R.id.cbHtml);
|
||||||
final CheckBox cbUnseen = dview.findViewById(R.id.cbUnseen);
|
final CheckBox cbUnseen = dview.findViewById(R.id.cbUnseen);
|
||||||
final CheckBox cbFlagged = dview.findViewById(R.id.cbFlagged);
|
final CheckBox cbFlagged = dview.findViewById(R.id.cbFlagged);
|
||||||
final CheckBox cbHidden = dview.findViewById(R.id.cbHidden);
|
final CheckBox cbHidden = dview.findViewById(R.id.cbHidden);
|
||||||
|
@ -200,11 +201,14 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
||||||
ibMore.setImageLevel(1);
|
ibMore.setImageLevel(1);
|
||||||
grpMore.setVisibility(View.GONE);
|
grpMore.setVisibility(View.GONE);
|
||||||
cbHeaders.setVisibility(View.GONE);
|
cbHeaders.setVisibility(View.GONE);
|
||||||
|
cbHtml.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
ibMore.setImageLevel(0);
|
ibMore.setImageLevel(0);
|
||||||
grpMore.setVisibility(View.VISIBLE);
|
grpMore.setVisibility(View.VISIBLE);
|
||||||
if (BuildConfig.DEBUG)
|
if (BuildConfig.DEBUG) {
|
||||||
cbHeaders.setVisibility(View.VISIBLE);
|
cbHeaders.setVisibility(View.VISIBLE);
|
||||||
|
cbHtml.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -223,6 +227,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
||||||
cbMessage.setEnabled(!isChecked);
|
cbMessage.setEnabled(!isChecked);
|
||||||
cbNotes.setEnabled(!isChecked);
|
cbNotes.setEnabled(!isChecked);
|
||||||
cbHeaders.setEnabled(!isChecked);
|
cbHeaders.setEnabled(!isChecked);
|
||||||
|
cbHtml.setEnabled(!isChecked);
|
||||||
cbUnseen.setEnabled(!isChecked);
|
cbUnseen.setEnabled(!isChecked);
|
||||||
cbFlagged.setEnabled(!isChecked);
|
cbFlagged.setEnabled(!isChecked);
|
||||||
cbHidden.setEnabled(!isChecked);
|
cbHidden.setEnabled(!isChecked);
|
||||||
|
@ -319,6 +324,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
||||||
|
|
||||||
grpMore.setVisibility(View.GONE);
|
grpMore.setVisibility(View.GONE);
|
||||||
cbHeaders.setVisibility(View.GONE);
|
cbHeaders.setVisibility(View.GONE);
|
||||||
|
cbHtml.setVisibility(View.GONE);
|
||||||
|
|
||||||
etQuery.requestFocus();
|
etQuery.requestFocus();
|
||||||
if (imm != null)
|
if (imm != null)
|
||||||
|
@ -362,6 +368,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
||||||
criteria.in_message = cbMessage.isChecked();
|
criteria.in_message = cbMessage.isChecked();
|
||||||
criteria.in_notes = cbNotes.isChecked();
|
criteria.in_notes = cbNotes.isChecked();
|
||||||
criteria.in_headers = cbHeaders.isChecked();
|
criteria.in_headers = cbHeaders.isChecked();
|
||||||
|
criteria.in_html = cbHtml.isChecked();
|
||||||
criteria.with_unseen = cbUnseen.isChecked();
|
criteria.with_unseen = cbUnseen.isChecked();
|
||||||
criteria.with_flagged = cbFlagged.isChecked();
|
criteria.with_flagged = cbFlagged.isChecked();
|
||||||
criteria.with_hidden = cbHidden.isChecked();
|
criteria.with_hidden = cbHidden.isChecked();
|
||||||
|
|
|
@ -345,6 +345,18 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/cbNotes" />
|
app:layout_constraintTop_toBottomOf="@id/cbNotes" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cbHtml"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="24dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:text="@string/title_search_in_html"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/cbHeaders" />
|
||||||
|
|
||||||
<eu.faircode.email.FixedTextView
|
<eu.faircode.email.FixedTextView
|
||||||
android:id="@+id/tvAnd"
|
android:id="@+id/tvAnd"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -354,7 +366,7 @@
|
||||||
android:text="@string/title_search_with"
|
android:text="@string/title_search_with"
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/cbHeaders" />
|
app:layout_constraintTop_toBottomOf="@id/cbHtml" />
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/cbUnseen"
|
android:id="@+id/cbUnseen"
|
||||||
|
|
|
@ -1176,6 +1176,7 @@
|
||||||
<string name="title_search_in_message">In message text</string>
|
<string name="title_search_in_message">In message text</string>
|
||||||
<string name="title_search_in_notes">In local notes</string>
|
<string name="title_search_in_notes">In local notes</string>
|
||||||
<string name="title_search_in_headers" translatable="false">In headers</string>
|
<string name="title_search_in_headers" translatable="false">In headers</string>
|
||||||
|
<string name="title_search_in_html" translatable="false">In HTML</string>
|
||||||
<string name="title_search_with">Limit search to</string>
|
<string name="title_search_with">Limit search to</string>
|
||||||
<string name="title_search_with_unseen">Unread</string>
|
<string name="title_search_with_unseen">Unread</string>
|
||||||
<string name="title_search_with_flagged">Starred</string>
|
<string name="title_search_with_flagged">Starred</string>
|
||||||
|
|
Loading…
Reference in a new issue