mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 885884: Pin bookmark dialog list shouldn't show bookmark icon, switch to tab. [r=lucasr]
This commit is contained in:
parent
68d9fa2d00
commit
98cea62803
@ -165,6 +165,7 @@ class PinBookmarkDialog extends DialogFragment {
|
||||
@Override
|
||||
public void bindView(View view, Context context, Cursor cursor) {
|
||||
TwoLinePageRow row = (TwoLinePageRow) view;
|
||||
row.setShowIcons(false);
|
||||
row.updateFromCursor(cursor);
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ public class TwoLinePageRow extends LinearLayout {
|
||||
|
||||
private int mUrlIconId;
|
||||
private int mBookmarkIconId;
|
||||
private boolean mShowIcons;
|
||||
|
||||
public TwoLinePageRow(Context context) {
|
||||
this(context, null);
|
||||
@ -44,6 +45,7 @@ public class TwoLinePageRow extends LinearLayout {
|
||||
|
||||
mUrlIconId = NO_ICON;
|
||||
mBookmarkIconId = NO_ICON;
|
||||
mShowIcons = true;
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.two_line_page_row, this);
|
||||
mTitle = (TextView) findViewById(R.id.title);
|
||||
@ -85,6 +87,10 @@ public class TwoLinePageRow extends LinearLayout {
|
||||
mUrl.setCompoundDrawablesWithIntrinsicBounds(mUrlIconId, 0, mBookmarkIconId, 0);
|
||||
}
|
||||
|
||||
public void setShowIcons(boolean showIcons) {
|
||||
mShowIcons = showIcons;
|
||||
}
|
||||
|
||||
public void updateFromCursor(Cursor cursor) {
|
||||
if (cursor == null) {
|
||||
return;
|
||||
@ -101,12 +107,12 @@ public class TwoLinePageRow extends LinearLayout {
|
||||
setTitle(TextUtils.isEmpty(title) ? url : title);
|
||||
|
||||
// Update the url with "Switch to tab" if needed.
|
||||
if (Tabs.getInstance().hasUrl(url)) {
|
||||
setUrl(R.string.switch_to_tab);
|
||||
setUrlIcon(R.drawable.ic_url_bar_tab);
|
||||
} else {
|
||||
if (!mShowIcons || !Tabs.getInstance().hasUrl(url)) {
|
||||
setUrl(url);
|
||||
setUrlIcon(NO_ICON);
|
||||
} else {
|
||||
setUrl(R.string.switch_to_tab);
|
||||
setUrlIcon(R.drawable.ic_url_bar_tab);
|
||||
}
|
||||
|
||||
int faviconIndex = cursor.getColumnIndex(URLColumns.FAVICON);
|
||||
@ -127,6 +133,11 @@ public class TwoLinePageRow extends LinearLayout {
|
||||
setFaviconWithUrl(Favicons.getInstance().getFaviconFromMemCache(url), url);
|
||||
}
|
||||
|
||||
// Don't show bookmark/reading list icon, if not needed.
|
||||
if (!mShowIcons) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int bookmarkIdIndex = cursor.getColumnIndex(Combined.BOOKMARK_ID);
|
||||
if (bookmarkIdIndex != -1) {
|
||||
final long bookmarkId = cursor.getLong(bookmarkIdIndex);
|
||||
|
Loading…
Reference in New Issue
Block a user