Search in sources :

Example 1 with StringMatcher

use of com.android.launcher3.search.StringMatcherUtility.StringMatcher in project Neo-Launcher by NeoApplications.

the class DefaultAppSearchAlgorithm method getTitleMatchResult.

private ArrayList<ComponentKey> getTitleMatchResult(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<ComponentKey> result = new ArrayList<>();
    StringMatcher matcher = StringMatcher.getInstance();
    for (AppInfo info : getApps(mContext, mApps, mBaseFilter)) {
        if (matches(info, queryTextLower, matcher)) {
            result.add(info.toComponentKey());
        }
    }
    return result;
}
Also used : ComponentKey(com.android.launcher3.util.ComponentKey) ArrayList(java.util.ArrayList) AppInfo(com.android.launcher3.AppInfo)

Example 2 with StringMatcher

use of com.android.launcher3.search.StringMatcherUtility.StringMatcher in project android_packages_apps_Trebuchet by LineageOS.

the class DefaultAppSearchAlgorithm method getTitleMatchResult.

private ArrayList<ComponentKey> getTitleMatchResult(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<ComponentKey> result = new ArrayList<>();
    StringMatcher matcher = StringMatcher.getInstance();
    for (AppInfo info : mApps) {
        if (matches(info, queryTextLower, matcher)) {
            result.add(info.toComponentKey());
        }
    }
    return result;
}
Also used : ComponentKey(com.android.launcher3.util.ComponentKey) ArrayList(java.util.ArrayList) AppInfo(com.android.launcher3.model.data.AppInfo)

Aggregations

ComponentKey (com.android.launcher3.util.ComponentKey)2 ArrayList (java.util.ArrayList)2 AppInfo (com.android.launcher3.AppInfo)1 AppInfo (com.android.launcher3.model.data.AppInfo)1