|
|
|
@ -62,6 +62,7 @@ import java.text.DateFormat;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Calendar;
|
|
|
|
import java.util.Calendar;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
public class FragmentDialogSearch extends FragmentDialogBase {
|
|
|
|
public class FragmentDialogSearch extends FragmentDialogBase {
|
|
|
|
private static final int MAX_SUGGESTIONS = 3;
|
|
|
|
private static final int MAX_SUGGESTIONS = 3;
|
|
|
|
@ -75,6 +76,9 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|
|
|
final long folder = args.getLong("folder", -1);
|
|
|
|
final long folder = args.getLong("folder", -1);
|
|
|
|
final String type = args.getString("type");
|
|
|
|
final String type = args.getString("type");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final BoundaryCallbackMessages.SearchCriteria criteria = args.getSerializable("criteria", BoundaryCallbackMessages.SearchCriteria.class);
|
|
|
|
|
|
|
|
final boolean server = args.getBoolean("server");
|
|
|
|
|
|
|
|
|
|
|
|
final Context context = getContext();
|
|
|
|
final Context context = getContext();
|
|
|
|
final boolean pro = ActivityBilling.isPro(context);
|
|
|
|
final boolean pro = ActivityBilling.isPro(context);
|
|
|
|
|
|
|
|
|
|
|
|
@ -430,6 +434,8 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
ibMore.setImageLevel(1);
|
|
|
|
ibMore.setImageLevel(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (criteria == null) {
|
|
|
|
cbSearchIndex.setChecked(last_fts && fts && pro);
|
|
|
|
cbSearchIndex.setChecked(last_fts && fts && pro);
|
|
|
|
cbSearchIndex.setEnabled(fts && pro);
|
|
|
|
cbSearchIndex.setEnabled(fts && pro);
|
|
|
|
cbSenders.setChecked(last_search_senders);
|
|
|
|
cbSenders.setChecked(last_search_senders);
|
|
|
|
@ -448,6 +454,63 @@ public class FragmentDialogSearch extends FragmentDialogBase {
|
|
|
|
tvBefore.setText(null);
|
|
|
|
tvBefore.setText(null);
|
|
|
|
cbSearchDevice.setChecked(last_search_device);
|
|
|
|
cbSearchDevice.setChecked(last_search_device);
|
|
|
|
cbSearchDevice.setEnabled(account > 0 && folder > 0);
|
|
|
|
cbSearchDevice.setEnabled(account > 0 && folder > 0);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
etQuery.setText(criteria.query);
|
|
|
|
|
|
|
|
cbSearchIndex.setChecked(criteria.fts);
|
|
|
|
|
|
|
|
cbSenders.setChecked(criteria.in_senders);
|
|
|
|
|
|
|
|
cbRecipients.setChecked(criteria.in_recipients);
|
|
|
|
|
|
|
|
cbSubject.setChecked(criteria.in_subject);
|
|
|
|
|
|
|
|
cbKeywords.setChecked(criteria.in_keywords);
|
|
|
|
|
|
|
|
cbMessage.setChecked(criteria.in_message);
|
|
|
|
|
|
|
|
cbNotes.setChecked(criteria.in_notes);
|
|
|
|
|
|
|
|
cbFileNames.setChecked(criteria.in_filenames);
|
|
|
|
|
|
|
|
cbHeaders.setChecked(criteria.in_headers);
|
|
|
|
|
|
|
|
cbHtml.setChecked(criteria.in_html);
|
|
|
|
|
|
|
|
// criteria.with_folder_type
|
|
|
|
|
|
|
|
cbUnseen.setChecked(criteria.with_unseen);
|
|
|
|
|
|
|
|
cbFlagged.setChecked(criteria.with_flagged);
|
|
|
|
|
|
|
|
cbHidden.setChecked(criteria.with_hidden);
|
|
|
|
|
|
|
|
cbImportance.setChecked(criteria.with_importance != null);
|
|
|
|
|
|
|
|
spImportance.setSelection(criteria.with_importance == null ? 0 : criteria.with_importance);
|
|
|
|
|
|
|
|
cbEncrypted.setChecked(criteria.with_encrypted);
|
|
|
|
|
|
|
|
cbAttachments.setChecked(criteria.with_attachments);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (criteria.with_size != null) {
|
|
|
|
|
|
|
|
int[] sizes = getResources().getIntArray(R.array.sizeValues);
|
|
|
|
|
|
|
|
for (int pos = 0; pos < sizes.length; pos++)
|
|
|
|
|
|
|
|
if (Objects.equals(sizes[pos], criteria.with_size)) {
|
|
|
|
|
|
|
|
spMessageSize.setSelection(pos);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbSearchTrash.setChecked(criteria.in_trash);
|
|
|
|
|
|
|
|
cbSearchJunk.setChecked(criteria.in_junk);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DateFormat DF = Helper.getDateInstance(getContext());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (criteria.after == null) {
|
|
|
|
|
|
|
|
tvAfter.setText(null);
|
|
|
|
|
|
|
|
tvAfter.setTag(null);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
tvAfter.setText(DF.format(criteria.after));
|
|
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|
|
|
|
|
cal.setTimeInMillis(criteria.after);
|
|
|
|
|
|
|
|
tvAfter.setTag(cal);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (criteria.before == null) {
|
|
|
|
|
|
|
|
tvBefore.setText(null);
|
|
|
|
|
|
|
|
tvBefore.setTag(null);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
tvBefore.setText(DF.format(criteria.before));
|
|
|
|
|
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
|
|
|
|
|
cal.setTimeInMillis(criteria.before);
|
|
|
|
|
|
|
|
tvBefore.setTag(cal);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbSearchDevice.setChecked(!server);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
grpMore.setVisibility(View.GONE);
|
|
|
|
grpMore.setVisibility(View.GONE);
|
|
|
|
cbHeaders.setVisibility(View.GONE);
|
|
|
|
cbHeaders.setVisibility(View.GONE);
|
|
|
|
|