use of com.android.launcher3.search.StringMatcherUtility.matches in project android_packages_apps_Launcher3 by crdroidandroid.
the class DefaultAppSearchAlgorithm method getTitleMatchResult.
/**
* Filters {@link AppInfo}s matching specified query
*/
@AnyThread
public static ArrayList<AdapterItem> getTitleMatchResult(List<AppInfo> apps, String query) {
// Do an intersection of the words in the query and each title, and filter out all the
// apps that don't match all of the words in the query.
final String queryTextLower = query.toLowerCase();
final ArrayList<AdapterItem> result = new ArrayList<>();
StringMatcherUtility.StringMatcher matcher = StringMatcherUtility.StringMatcher.getInstance();
int resultCount = 0;
int total = apps.size();
for (int i = 0; i < total && resultCount < MAX_RESULTS_COUNT; i++) {
AppInfo info = apps.get(i);
if (StringMatcherUtility.matches(queryTextLower, info.title.toString(), matcher)) {
AdapterItem appItem = AdapterItem.asApp(resultCount, "", info, resultCount);
result.add(appItem);
resultCount++;
}
}
return result;
}
use of com.android.launcher3.search.StringMatcherUtility.matches in project android_packages_apps_Launcher3 by ArrowOS.
the class DefaultAppSearchAlgorithm method getTitleMatchResult.
/**
* Filters {@link AppInfo}s matching specified query
*/
@AnyThread
public static ArrayList<AdapterItem> getTitleMatchResult(List<AppInfo> apps, String query) {
// Do an intersection of the words in the query and each title, and filter out all the
// apps that don't match all of the words in the query.
final String queryTextLower = query.toLowerCase();
final ArrayList<AdapterItem> result = new ArrayList<>();
StringMatcherUtility.StringMatcher matcher = StringMatcherUtility.StringMatcher.getInstance();
int resultCount = 0;
int total = apps.size();
for (int i = 0; i < total && resultCount < MAX_RESULTS_COUNT; i++) {
AppInfo info = apps.get(i);
if (StringMatcherUtility.matches(queryTextLower, info.title.toString(), matcher)) {
AdapterItem appItem = AdapterItem.asApp(resultCount, "", info, resultCount);
result.add(appItem);
resultCount++;
}
}
return result;
}
use of com.android.launcher3.search.StringMatcherUtility.matches in project android_packages_apps_Launcher3 by ProtonAOSP.
the class DefaultAppSearchAlgorithm method getTitleMatchResult.
/**
* Filters {@link AppInfo}s matching specified query
*/
@AnyThread
public static ArrayList<AdapterItem> getTitleMatchResult(List<AppInfo> apps, String query) {
// Do an intersection of the words in the query and each title, and filter out all the
// apps that don't match all of the words in the query.
final String queryTextLower = query.toLowerCase();
final ArrayList<AdapterItem> result = new ArrayList<>();
StringMatcherUtility.StringMatcher matcher = StringMatcherUtility.StringMatcher.getInstance();
int resultCount = 0;
int total = apps.size();
for (int i = 0; i < total && resultCount < MAX_RESULTS_COUNT; i++) {
AppInfo info = apps.get(i);
if (StringMatcherUtility.matches(queryTextLower, info.title.toString(), matcher)) {
AdapterItem appItem = AdapterItem.asApp(resultCount, "", info, resultCount);
result.add(appItem);
resultCount++;
}
}
return result;
}
use of com.android.launcher3.search.StringMatcherUtility.matches in project android_packages_apps_404Launcher by P-404.
the class DefaultAppSearchAlgorithm method getTitleMatchResult.
/**
* Filters {@link AppInfo}s matching specified query
*/
@AnyThread
public static ArrayList<AdapterItem> getTitleMatchResult(List<AppInfo> apps, String query) {
// Do an intersection of the words in the query and each title, and filter out all the
// apps that don't match all of the words in the query.
final String queryTextLower = query.toLowerCase();
final ArrayList<AdapterItem> result = new ArrayList<>();
StringMatcherUtility.StringMatcher matcher = StringMatcherUtility.StringMatcher.getInstance();
int resultCount = 0;
int total = apps.size();
for (int i = 0; i < total && resultCount < MAX_RESULTS_COUNT; i++) {
AppInfo info = apps.get(i);
if (StringMatcherUtility.matches(queryTextLower, info.title.toString(), matcher)) {
AdapterItem appItem = AdapterItem.asApp(resultCount, "", info, resultCount);
result.add(appItem);
resultCount++;
}
}
return result;
}
use of com.android.launcher3.search.StringMatcherUtility.matches in project android_packages_apps_Launcher3 by AOSPA.
the class DefaultAppSearchAlgorithm method getTitleMatchResult.
/**
* Filters {@link AppInfo}s matching specified query
*/
@AnyThread
public static ArrayList<AdapterItem> getTitleMatchResult(List<AppInfo> apps, String query) {
// Do an intersection of the words in the query and each title, and filter out all the
// apps that don't match all of the words in the query.
final String queryTextLower = query.toLowerCase();
final ArrayList<AdapterItem> result = new ArrayList<>();
StringMatcherUtility.StringMatcher matcher = StringMatcherUtility.StringMatcher.getInstance();
int resultCount = 0;
int total = apps.size();
for (int i = 0; i < total && resultCount < MAX_RESULTS_COUNT; i++) {
AppInfo info = apps.get(i);
if (StringMatcherUtility.matches(queryTextLower, info.title.toString(), matcher)) {
AdapterItem appItem = AdapterItem.asApp(resultCount, "", info, resultCount);
result.add(appItem);
resultCount++;
}
}
return result;
}
Aggregations