Use FTS if enable to search for email addresses

This commit is contained in:
M66B
2021-02-26 13:44:56 +01:00
parent c004070ca0
commit 3ee1fe454b
3 changed files with 16 additions and 16 deletions

View File

@@ -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) {