Use FTS if enable to search for email addresses

pull/194/head
M66B 4 years ago
parent c004070ca0
commit 3ee1fe454b

@ -128,7 +128,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
static final String ACTION_VIEW_FOLDERS = BuildConfig.APPLICATION_ID + ".VIEW_FOLDERS";
static final String ACTION_VIEW_MESSAGES = BuildConfig.APPLICATION_ID + ".VIEW_MESSAGES";
static final String ACTION_SEARCH = BuildConfig.APPLICATION_ID + ".SEARCH";
static final String ACTION_SEARCH_ADDRESS = BuildConfig.APPLICATION_ID + ".SEARCH_ADDRESS";
static final String ACTION_VIEW_THREAD = BuildConfig.APPLICATION_ID + ".VIEW_THREAD";
static final String ACTION_EDIT_FOLDER = BuildConfig.APPLICATION_ID + ".EDIT_FOLDER";
static final String ACTION_EDIT_ANSWERS = BuildConfig.APPLICATION_ID + ".EDIT_ANSWERS";
@ -639,7 +639,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
IntentFilter iff = new IntentFilter();
iff.addAction(ACTION_VIEW_FOLDERS);
iff.addAction(ACTION_VIEW_MESSAGES);
iff.addAction(ACTION_SEARCH);
iff.addAction(ACTION_SEARCH_ADDRESS);
iff.addAction(ACTION_VIEW_THREAD);
iff.addAction(ACTION_EDIT_FOLDER);
iff.addAction(ACTION_EDIT_ANSWERS);
@ -1096,7 +1096,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
searching = true;
FragmentMessages.search(
ActivityView.this, ActivityView.this, getSupportFragmentManager(),
-1, -1, false, search);
-1, -1, false, new BoundaryCallbackMessages.SearchCriteria(search));
}
intent.removeExtra(Intent.EXTRA_PROCESS_TEXT);
@ -1291,8 +1291,8 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
onViewFolders(intent);
else if (ACTION_VIEW_MESSAGES.equals(action))
onViewMessages(intent);
else if (ACTION_SEARCH.equals(action))
onSearchMessages(intent);
else if (ACTION_SEARCH_ADDRESS.equals(action))
onSearchAddress(intent);
else if (ACTION_VIEW_THREAD.equals(action))
onViewThread(intent);
else if (ACTION_EDIT_FOLDER.equals(action))
@ -1331,13 +1331,21 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
fragmentTransaction.commit();
}
private void onSearchMessages(Intent intent) {
private void onSearchAddress(Intent intent) {
long account = intent.getLongExtra("account", -1);
long folder = intent.getLongExtra("folder", -1);
String query = intent.getStringExtra("query");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean fts = prefs.getBoolean("fts", false);
BoundaryCallbackMessages.SearchCriteria criteria = new BoundaryCallbackMessages.SearchCriteria();
criteria.query = query;
criteria.fts = fts;
FragmentMessages.search(
this, this, getSupportFragmentManager(),
account, folder, false, query);
account, folder, false, criteria);
}
private void onViewThread(Intent intent) {

@ -3408,7 +3408,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
String query = ((InternetAddress) addresses[0]).getAddress();
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
lbm.sendBroadcast(
new Intent(ActivityView.ACTION_SEARCH)
new Intent(ActivityView.ACTION_SEARCH_ADDRESS)
.putExtra("account", -1L)
.putExtra("folder", -1L)
.putExtra("query", query));

@ -7682,14 +7682,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
startActivity(edit);
}
static void search(
final Context context, final LifecycleOwner owner, final FragmentManager manager,
long account, long folder, boolean server, String query) {
search(context, owner, manager,
account, folder,
server, new BoundaryCallbackMessages.SearchCriteria(query));
}
static void search(
final Context context, final LifecycleOwner owner, final FragmentManager manager,
long account, long folder, boolean server, BoundaryCallbackMessages.SearchCriteria criteria) {

Loading…
Cancel
Save