Search in sources :

Example 1 with Tag

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;
}
Also used : Tag(org.wordpress.android.models.Tag) TagSuggestionAdapter(org.wordpress.android.ui.suggestion.adapters.TagSuggestionAdapter)

Example 2 with Tag

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);
    }
}
Also used : ArrayList(java.util.ArrayList) Tag(org.wordpress.android.models.Tag) Cursor(android.database.Cursor)

Example 3 with Tag

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;
}
Also used : Tag(org.wordpress.android.models.Tag)

Aggregations

Tag (org.wordpress.android.models.Tag)3 Cursor (android.database.Cursor)1 ArrayList (java.util.ArrayList)1 TagSuggestionAdapter (org.wordpress.android.ui.suggestion.adapters.TagSuggestionAdapter)1