38 super(context, textViewResourceId, objects);
41 @Override
public View getView(
int position, View convertView, ViewGroup parent)
43 View curView = convertView;
47 (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
48 curView = vi.inflate(R.layout.bookmark_list_item,
null);
51 BookmarkBase bookmark = getItem(position);
52 TextView label = curView.findViewById(R.id.bookmark_text1);
53 TextView hostname = curView.findViewById(R.id.bookmark_text2);
54 ImageView star_icon = curView.findViewById(R.id.bookmark_icon2);
56 assert hostname !=
null;
58 label.setText(bookmark.getLabel());
59 star_icon.setVisibility(View.VISIBLE);
62 if (bookmark.getType() == BookmarkBase.TYPE_MANUAL)
64 hostname.setText(bookmark.<ManualBookmark>
get().getHostname());
65 refStr = ConnectionReference.getManualBookmarkReference(bookmark.getId());
66 star_icon.setImageResource(R.drawable.icon_star_on);
68 else if (bookmark.getType() == BookmarkBase.TYPE_QUICKCONNECT)
72 hostname.setText(
" ");
73 refStr = ConnectionReference.getHostnameReference(bookmark.getLabel());
74 star_icon.setImageResource(R.drawable.icon_star_off);
76 else if (bookmark.getType() == BookmarkBase.TYPE_PLACEHOLDER)
78 hostname.setText(
" ");
79 refStr = ConnectionReference.getPlaceholderReference(
80 bookmark.<PlaceholderBookmark>
get().getName());
81 star_icon.setVisibility(View.GONE);
90 star_icon.setOnClickListener(
new OnClickListener() {
91 @Override
public void onClick(View v)
94 Bundle bundle =
new Bundle();
95 String refStr = v.getTag().toString();
96 bundle.putString(BookmarkActivity.PARAM_CONNECTION_REFERENCE, refStr);
98 Intent bookmarkIntent =
new Intent(getContext(), BookmarkActivity.class);
99 bookmarkIntent.putExtras(bundle);
100 getContext().startActivity(bookmarkIntent);
104 curView.setTag(refStr);
105 star_icon.setTag(refStr);
110 public void addItems(List<BookmarkBase> newItems)
112 for (BookmarkBase item : newItems)
116 public void replaceItems(List<BookmarkBase> newItems)
119 for (BookmarkBase item : newItems)
123 public void remove(
long bookmarkId)
125 for (
int i = 0; i < getCount(); i++)
127 BookmarkBase bm = getItem(i);
128 if (bm.getId() == bookmarkId)