From f19210b71d399689d7ae271611e7675ae68b5039 Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 23 Jan 2012 16:15:06 -0800 Subject: Enforce most visited limit Change-Id: If24a89703d74d359461c4c4c6c46449fd93d2be5 --- src/com/android/browser/homepages/RequestHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/com') diff --git a/src/com/android/browser/homepages/RequestHandler.java b/src/com/android/browser/homepages/RequestHandler.java index 1ae5b3e..b3a03b9 100644 --- a/src/com/android/browser/homepages/RequestHandler.java +++ b/src/com/android/browser/homepages/RequestHandler.java @@ -113,8 +113,13 @@ public class RequestHandler extends Thread { if (cursor.getCount() < 12) { Cursor bookmarkResults = mContext.getContentResolver().query( Bookmarks.CONTENT_URI, PROJECTION, SELECTION, - null, null); - cursor = new MergeCursor(new Cursor[] { historyResults, bookmarkResults }); + null, Bookmarks.DATE_CREATED + " DESC LIMIT 12"); + cursor = new MergeCursor(new Cursor[] { historyResults, bookmarkResults }) { + @Override + public int getCount() { + return Math.min(12, super.getCount()); + } + }; } t.assignLoop("most_visited", new Template.CursorListEntityWrapper(cursor) { -- cgit v1.1