mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
bug 710392 - exclude about:home from top sites on about:home r=lucasr
This commit is contained in:
parent
2ddf4b722d
commit
6cb042919a
@ -168,7 +168,7 @@ public class AboutHomeContent extends ScrollView {
|
|||||||
activity.stopManagingCursor(mCursor);
|
activity.stopManagingCursor(mCursor);
|
||||||
|
|
||||||
ContentResolver resolver = GeckoApp.mAppContext.getContentResolver();
|
ContentResolver resolver = GeckoApp.mAppContext.getContentResolver();
|
||||||
mCursor = BrowserDB.filter(resolver, "", NUMBER_OF_TOP_SITES_PORTRAIT);
|
mCursor = BrowserDB.filter(resolver, "", NUMBER_OF_TOP_SITES_PORTRAIT, "about:%");
|
||||||
activity.startManagingCursor(mCursor);
|
activity.startManagingCursor(mCursor);
|
||||||
|
|
||||||
mTopSitesAdapter = new TopSitesCursorAdapter(activity,
|
mTopSitesAdapter = new TopSitesCursorAdapter(activity,
|
||||||
|
@ -61,7 +61,7 @@ public class AndroidBrowserDB implements BrowserDB.BrowserDBIface {
|
|||||||
|
|
||||||
private static final Uri BOOKMARKS_CONTENT_URI_POST_11 = Uri.parse("content://com.android.browser/bookmarks");
|
private static final Uri BOOKMARKS_CONTENT_URI_POST_11 = Uri.parse("content://com.android.browser/bookmarks");
|
||||||
|
|
||||||
public Cursor filter(ContentResolver cr, CharSequence constraint, int limit) {
|
public Cursor filter(ContentResolver cr, CharSequence constraint, int limit, CharSequence urlFilter) {
|
||||||
Cursor c = cr.query(Browser.BOOKMARKS_URI,
|
Cursor c = cr.query(Browser.BOOKMARKS_URI,
|
||||||
new String[] { URL_COLUMN_ID,
|
new String[] { URL_COLUMN_ID,
|
||||||
BookmarkColumns.URL,
|
BookmarkColumns.URL,
|
||||||
@ -70,9 +70,11 @@ public class AndroidBrowserDB implements BrowserDB.BrowserDBIface {
|
|||||||
URL_COLUMN_THUMBNAIL },
|
URL_COLUMN_THUMBNAIL },
|
||||||
// The length restriction on URL is for the same reason as in the general bookmark query
|
// The length restriction on URL is for the same reason as in the general bookmark query
|
||||||
// (see comment earlier in this file).
|
// (see comment earlier in this file).
|
||||||
|
(urlFilter != null ? "(" + Browser.BookmarkColumns.URL + " NOT LIKE ? ) AND " : "" ) +
|
||||||
"(" + Browser.BookmarkColumns.URL + " LIKE ? OR " + Browser.BookmarkColumns.TITLE + " LIKE ?)"
|
"(" + Browser.BookmarkColumns.URL + " LIKE ? OR " + Browser.BookmarkColumns.TITLE + " LIKE ?)"
|
||||||
+ " AND LENGTH(" + Browser.BookmarkColumns.URL + ") > 0",
|
+ " AND LENGTH(" + Browser.BookmarkColumns.URL + ") > 0",
|
||||||
new String[] {"%" + constraint.toString() + "%", "%" + constraint.toString() + "%",},
|
urlFilter == null ? new String[] {"%" + constraint.toString() + "%", "%" + constraint.toString() + "%"} :
|
||||||
|
new String[] {urlFilter.toString(), "%" + constraint.toString() + "%", "%" + constraint.toString() + "%"},
|
||||||
// ORDER BY is number of visits times a multiplier from 1 - 120 of how recently the site
|
// ORDER BY is number of visits times a multiplier from 1 - 120 of how recently the site
|
||||||
// was accessed with a site accessed today getting 120 and a site accessed 119 or more
|
// was accessed with a site accessed today getting 120 and a site accessed 119 or more
|
||||||
// days ago getting 1
|
// days ago getting 1
|
||||||
|
@ -53,7 +53,7 @@ public class BrowserDB {
|
|||||||
private static BrowserDBIface sDb;
|
private static BrowserDBIface sDb;
|
||||||
|
|
||||||
public interface BrowserDBIface {
|
public interface BrowserDBIface {
|
||||||
public Cursor filter(ContentResolver cr, CharSequence constraint, int limit);
|
public Cursor filter(ContentResolver cr, CharSequence constraint, int limit, CharSequence urlFilter);
|
||||||
|
|
||||||
public void updateVisitedHistory(ContentResolver cr, String uri);
|
public void updateVisitedHistory(ContentResolver cr, String uri);
|
||||||
|
|
||||||
@ -88,8 +88,12 @@ public class BrowserDB {
|
|||||||
sDb = new AndroidBrowserDB();
|
sDb = new AndroidBrowserDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Cursor filter(ContentResolver cr, CharSequence constraint, int limit, CharSequence urlFilter) {
|
||||||
|
return sDb.filter(cr, constraint, limit, urlFilter);
|
||||||
|
}
|
||||||
|
|
||||||
public static Cursor filter(ContentResolver cr, CharSequence constraint, int limit) {
|
public static Cursor filter(ContentResolver cr, CharSequence constraint, int limit) {
|
||||||
return sDb.filter(cr, constraint, limit);
|
return sDb.filter(cr, constraint, limit, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateVisitedHistory(ContentResolver cr, String uri) {
|
public static void updateVisitedHistory(ContentResolver cr, String uri) {
|
||||||
@ -143,4 +147,4 @@ public class BrowserDB {
|
|||||||
public static void updateThumbnailForUrl(ContentResolver cr, String uri, BitmapDrawable thumbnail) {
|
public static void updateThumbnailForUrl(ContentResolver cr, String uri, BitmapDrawable thumbnail) {
|
||||||
sDb.updateThumbnailForUrl(cr, uri, thumbnail);
|
sDb.updateThumbnailForUrl(cr, uri, thumbnail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,15 +81,17 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
|
|||||||
return uri.buildUpon().appendQueryParameter(BrowserContract.PARAM_PROFILE, mProfile).build();
|
return uri.buildUpon().appendQueryParameter(BrowserContract.PARAM_PROFILE, mProfile).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor filter(ContentResolver cr, CharSequence constraint, int limit) {
|
public Cursor filter(ContentResolver cr, CharSequence constraint, int limit, CharSequence urlFilter) {
|
||||||
Cursor c = cr.query(appendProfileAndLimit(History.CONTENT_URI, limit),
|
Cursor c = cr.query(appendProfileAndLimit(History.CONTENT_URI, limit),
|
||||||
new String[] { History._ID,
|
new String[] { History._ID,
|
||||||
History.URL,
|
History.URL,
|
||||||
History.TITLE,
|
History.TITLE,
|
||||||
History.FAVICON,
|
History.FAVICON,
|
||||||
History.THUMBNAIL },
|
History.THUMBNAIL },
|
||||||
|
(urlFilter != null ? "(" + History.URL + " NOT LIKE ? )" : "" )+
|
||||||
"(" + History.URL + " LIKE ? OR " + History.TITLE + " LIKE ?)",
|
"(" + History.URL + " LIKE ? OR " + History.TITLE + " LIKE ?)",
|
||||||
new String[] {"%" + constraint.toString() + "%", "%" + constraint.toString() + "%"},
|
urlFilter == null ? new String[] {"%" + constraint.toString() + "%", "%" + constraint.toString() + "%"} :
|
||||||
|
new String[] {urlFilter.toString(), "%" + constraint.toString() + "%", "%" + constraint.toString() + "%"},
|
||||||
// ORDER BY is number of visits times a multiplier from 1 - 120 of how recently the site
|
// ORDER BY is number of visits times a multiplier from 1 - 120 of how recently the site
|
||||||
// was accessed with a site accessed today getting 120 and a site accessed 119 or more
|
// was accessed with a site accessed today getting 120 and a site accessed 119 or more
|
||||||
// days ago getting 1
|
// days ago getting 1
|
||||||
|
Loading…
Reference in New Issue
Block a user