11 package com.freerdp.freerdpcore.utils;
13 import android.content.Context;
14 import android.content.Intent;
15 import android.os.Bundle;
16 import android.view.LayoutInflater;
17 import android.view.View;
18 import android.view.View.OnClickListener;
19 import android.view.ViewGroup;
20 import android.widget.ArrayAdapter;
21 import android.widget.ImageView;
22 import android.widget.TextView;
24 import com.freerdp.freerdpcore.R;
25 import com.freerdp.freerdpcore.domain.BookmarkBase;
26 import com.freerdp.freerdpcore.domain.ConnectionReference;
27 import com.freerdp.freerdpcore.domain.ManualBookmark;
28 import com.freerdp.freerdpcore.domain.PlaceholderBookmark;
29 import com.freerdp.freerdpcore.presentation.BookmarkActivity;
31 import java.util.List;
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);
52 TextView label = (TextView)curView.findViewById(R.id.bookmark_text1);
53 TextView hostname = (TextView)curView.findViewById(R.id.bookmark_text2);
54 ImageView star_icon = (ImageView)curView.findViewById(R.id.bookmark_icon2);
56 assert hostname !=
null;
58 label.setText(bookmark.getLabel());
59 star_icon.setVisibility(View.VISIBLE);
66 star_icon.setImageResource(R.drawable.icon_star_on);
68 else if (bookmark.getType() ==
BookmarkBase.TYPE_QUICKCONNECT)
72 hostname.setText(
" ");
74 star_icon.setImageResource(R.drawable.icon_star_off);
76 else if (bookmark.getType() ==
BookmarkBase.TYPE_PLACEHOLDER)
78 hostname.setText(
" ");
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();
99 bookmarkIntent.putExtras(bundle);
100 getContext().startActivity(bookmarkIntent);
104 curView.setTag(refStr);
105 star_icon.setTag(refStr);
110 public void addItems(List<BookmarkBase> newItems)
116 public void replaceItems(List<BookmarkBase> newItems)
123 public void remove(
long bookmarkId)
125 for (
int i = 0; i < getCount(); i++)
128 if (bm.getId() == bookmarkId)