use of org.wordpress.android.models.Tag in project WordPress-Android by wordpress-mobile.
the class SuggestionUtils method setupTagSuggestions.
public static TagSuggestionAdapter setupTagSuggestions(final long siteId, Context context, SuggestionServiceConnectionManager serviceConnectionManager, boolean isDotcomFlag) {
if (!isDotcomFlag) {
return null;
}
TagSuggestionAdapter tagSuggestionAdapter = new TagSuggestionAdapter(context);
List<Tag> tags = SuggestionTable.getTagsForSite(siteId);
// if the tags are not stored yet, we want to trigger an update for it
if (tags.isEmpty()) {
serviceConnectionManager.bindToService();
}
tagSuggestionAdapter.setTagList(tags);
return tagSuggestionAdapter;
}
use of org.wordpress.android.models.Tag in project WordPress-Android by wordpress-mobile.
the class SuggestionTable method getTagsForSite.
public static List<Tag> getTagsForSite(long siteId) {
List<Tag> tags = new ArrayList<Tag>();
String[] args = { Long.toString(siteId) };
Cursor c = getReadableDb().rawQuery("SELECT * FROM " + TAXONOMY_TABLE + " WHERE site_id=? ORDER BY tag ASC", args);
try {
if (c.moveToFirst()) {
do {
Tag comment = getTagFromCursor(c);
tags.add(comment);
} while (c.moveToNext());
}
return tags;
} finally {
SqlUtils.closeCursor(c);
}
}
use of org.wordpress.android.models.Tag in project WordPress-Android by wordpress-mobile.
the class TagSuggestionAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final TagViewHolder holder;
if (convertView == null || convertView.getTag() == null) {
convertView = mInflater.inflate(R.layout.tag_list_row, parent, false);
holder = new TagViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (TagViewHolder) convertView.getTag();
}
Tag tag = getItem(position);
if (tag != null) {
holder.txtTag.setText(tag.getTag());
}
return convertView;
}
Aggregations