Exemplo n.º 1
0
  public static Cursor getTopSites(ContentResolver cr, int minLimit, int maxLimit) {
    // Note this is not a single query anymore, but actually returns a mixture
    // of two queries, one for topSites and one for pinned sites.
    Cursor pinnedSites = sDb.getPinnedSites(cr, minLimit);

    int pinnedCount = pinnedSites.getCount();
    Cursor topSites = sDb.getTopSites(cr, maxLimit - pinnedCount);
    int topCount = topSites.getCount();

    Cursor suggestedSites = null;
    if (sSuggestedSites != null) {
      final int count = minLimit - pinnedCount - topCount;
      if (count > 0) {
        final List<String> excludeUrls = new ArrayList<String>(pinnedCount + topCount);
        appendUrlsFromCursor(excludeUrls, pinnedSites);
        appendUrlsFromCursor(excludeUrls, topSites);

        suggestedSites = sSuggestedSites.get(count, excludeUrls);
      }
    }

    return new TopSitesCursorWrapper(pinnedSites, topSites, suggestedSites, minLimit);
  }
Exemplo n.º 2
0
 public static boolean hideSuggestedSite(String url) {
   return sSuggestedSites.hideSite(url);
 }