コード例 #1
0
ファイル: AliasProvider.java プロジェクト: Cutta/KISS
  public ArrayList<Pojo> getResults(String query) {
    query = StringNormalizer.normalize(query);

    ArrayList<Pojo> results = new ArrayList<>();

    for (AliasPojo entry : pojos) {
      if (entry.alias.startsWith(query)) {
        // Retrieve the AppPojo from AppProvider, being careful not to create any side effect
        // (default behavior is to alter displayName, which is not what we want)
        Pojo appPojo = appProvider.findById(entry.app, false);
        // Only add if default AppProvider is not already displaying it
        if (appPojo != null && !appPojo.nameNormalized.contains(query)) {
          appPojo.displayName =
              appPojo.name
                  + " <small>("
                  + entry.alias.replaceFirst("(?i)(" + Pattern.quote(query) + ")", "{$1}")
                  + ")</small>";
          appPojo.relevance = 10;
          results.add(appPojo);
        }
      }
    }

    return results;
  }
コード例 #2
0
ファイル: ApkProvider.java プロジェクト: nutellarlz/AppHub
 private QuerySelection queryRepoApps(long repoId, String packageNames) {
   return queryRepo(repoId).add(AppProvider.queryApps(packageNames, DataColumns.PACKAGE_NAME));
 }