Bug 757776 - Show reading list icon on awesomebar search (r=mfinkle)

This commit is contained in:
Lucas Rocha 2012-06-07 21:27:40 +01:00
parent 89ddf8a7b0
commit d6fcaf2657
6 changed files with 22 additions and 2 deletions

View File

@ -157,11 +157,16 @@ public class AwesomeBarTabs extends TabHost {
}
Integer bookmarkId = (Integer) historyItem.get(Combined.BOOKMARK_ID);
Integer display = (Integer) historyItem.get(Combined.DISPLAY);
// The bookmark id will be 0 (null in database) when the url
// is not a bookmark.
int visibility = (bookmarkId == 0 ? View.GONE : View.VISIBLE);
// is not a bookmark. Reading list items are irrelevant in history
// tab. We should never show any sign or them.
int visibility = (bookmarkId != 0 && display != Combined.DISPLAY_READER ?
View.VISIBLE : View.GONE);
viewHolder.bookmarkIconView.setVisibility(visibility);
viewHolder.bookmarkIconView.setImageResource(R.drawable.ic_awesomebar_star);
return convertView;
}
@ -481,6 +486,7 @@ public class AwesomeBarTabs extends TabHost {
byte[] favicon = cursor.getBlob(cursor.getColumnIndexOrThrow(URLColumns.FAVICON));
Integer bookmarkId = cursor.getInt(cursor.getColumnIndexOrThrow(Combined.BOOKMARK_ID));
Integer historyId = cursor.getInt(cursor.getColumnIndexOrThrow(Combined.HISTORY_ID));
Integer display = cursor.getInt(cursor.getColumnIndexOrThrow(Combined.DISPLAY));
// Use the URL instead of an empty title for consistency with the normal URL
// bar view - this is the equivalent of getDisplayTitle() in Tab.java
@ -495,6 +501,7 @@ public class AwesomeBarTabs extends TabHost {
historyItem.put(Combined.BOOKMARK_ID, bookmarkId);
historyItem.put(Combined.HISTORY_ID, historyId);
historyItem.put(Combined.DISPLAY, display);
return historyItem;
}
@ -1088,10 +1095,19 @@ public class AwesomeBarTabs extends TabHost {
int bookmarkIdIndex = cursor.getColumnIndexOrThrow(Combined.BOOKMARK_ID);
long id = cursor.getLong(bookmarkIdIndex);
int displayIndex = cursor.getColumnIndexOrThrow(Combined.DISPLAY);
int display = cursor.getInt(displayIndex);
// The bookmark id will be 0 (null in database) when the url
// is not a bookmark.
int visibility = (id == 0 ? View.GONE : View.VISIBLE);
bookmarkIconView.setVisibility(visibility);
if (display == Combined.DISPLAY_READER) {
bookmarkIconView.setImageResource(R.drawable.ic_awesomebar_reader);
} else {
bookmarkIconView.setImageResource(R.drawable.ic_awesomebar_star);
}
}
public void setOnUrlOpenListener(OnUrlOpenListener listener) {

View File

@ -368,6 +368,7 @@ RES_DRAWABLE_BASE = \
res/drawable/awesomebar_tab_pressed.9.png \
res/drawable/ic_addons_empty.png \
res/drawable/ic_awesomebar_go.png \
res/drawable/ic_awesomebar_reader.png \
res/drawable/ic_awesomebar_search.png \
res/drawable/ic_awesomebar_star.png \
res/drawable/ic_menu_back.xml \
@ -445,6 +446,7 @@ RES_DRAWABLE_HDPI = \
res/drawable-hdpi/awesomebar_tab_pressed.9.png \
res/drawable-hdpi/ic_addons_empty.png \
res/drawable-hdpi/ic_awesomebar_go.png \
res/drawable-hdpi/ic_awesomebar_reader.png \
res/drawable-hdpi/ic_awesomebar_search.png \
res/drawable-hdpi/ic_awesomebar_star.png \
res/drawable-hdpi/ic_menu_bookmark_add.png \
@ -549,6 +551,7 @@ RES_DRAWABLE_XHDPI_V11 = \
res/drawable-xhdpi-v11/awesomebar_tab_pressed.9.png \
res/drawable-xhdpi-v11/ic_addons_empty.png \
res/drawable-xhdpi-v11/ic_awesomebar_go.png \
res/drawable-xhdpi-v11/ic_awesomebar_reader.png \
res/drawable-xhdpi-v11/ic_awesomebar_search.png \
res/drawable-xhdpi-v11/ic_awesomebar_star.png \
res/drawable-xhdpi-v11/ic_menu_back.png \

View File

@ -253,6 +253,7 @@ public class LocalBrowserDB implements BrowserDB.BrowserDBIface {
Combined.URL,
Combined.TITLE,
Combined.FAVICON,
Combined.DISPLAY,
Combined.DATE_LAST_VISITED,
Combined.VISITS },
History.DATE_LAST_VISITED + " > 0",

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B