use of org.wordpress.android.models.ReaderTag in project WordPress-Android by wordpress-mobile.
the class ReaderTagTable method addOrUpdateTags.
private static void addOrUpdateTags(ReaderTagList tagList) {
if (tagList == null || tagList.size() == 0) {
return;
}
SQLiteStatement stmt = null;
try {
stmt = ReaderDatabase.getWritableDb().compileStatement("INSERT OR REPLACE INTO tbl_tags (tag_slug, tag_display_name, tag_title, tag_type, endpoint) VALUES (?1,?2,?3,?4,?5)");
for (ReaderTag tag : tagList) {
stmt.bindString(1, tag.getTagSlug());
stmt.bindString(2, tag.getTagDisplayName());
stmt.bindString(3, tag.getTagTitle());
stmt.bindLong(4, tag.tagType.toInt());
stmt.bindString(5, tag.getEndpoint());
stmt.execute();
}
} finally {
SqlUtils.closeStatement(stmt);
}
}
use of org.wordpress.android.models.ReaderTag in project WordPress-Android by wordpress-mobile.
the class ReaderTagTable method getTagFromCursor.
private static ReaderTag getTagFromCursor(Cursor c) {
if (c == null) {
throw new IllegalArgumentException("null tag cursor");
}
String tagSlug = c.getString(c.getColumnIndex("tag_slug"));
String tagDisplayName = c.getString(c.getColumnIndex("tag_display_name"));
String tagTitle = c.getString(c.getColumnIndex("tag_title"));
String endpoint = c.getString(c.getColumnIndex("endpoint"));
ReaderTagType tagType = ReaderTagType.fromInt(c.getInt(c.getColumnIndex("tag_type")));
return new ReaderTag(tagSlug, tagDisplayName, tagTitle, endpoint, tagType);
}
use of org.wordpress.android.models.ReaderTag in project WordPress-Android by wordpress-mobile.
the class ReaderTagStrip method addTag.
private void addTag(@NonNull final String tagName) {
String tagDisplayName = mNumTags > 0 ? ", " + ReaderUtils.makeHashTag(tagName) : ReaderUtils.makeHashTag(tagName);
// inflate a new textView to show this tag
LayoutInflater inflater = LayoutInflater.from(getContext());
TextView txtTag = (TextView) inflater.inflate(R.layout.reader_tag_strip_label, mView, false);
txtTag.setText(tagDisplayName);
mView.addView(txtTag);
mNumTags++;
// show all posts with this tag when clicked
txtTag.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ReaderTag tag = ReaderUtils.createTagFromTagName(tagName, ReaderTagType.FOLLOWED);
ReaderActivityLauncher.showReaderTagPreview(v.getContext(), tag);
}
});
}
Aggregations