use of org.wordpress.android.models.ReaderPostList in project WordPress-Android by wordpress-mobile.
the class ReaderPostAdapter method removePostsInBlog.
public void removePostsInBlog(long blogId) {
int numRemoved = 0;
ReaderPostList postsInBlog = mPosts.getPostsInBlog(blogId);
for (ReaderPost post : postsInBlog) {
int index = mPosts.indexOfPost(post);
if (index > -1) {
numRemoved++;
mPosts.remove(index);
}
}
if (numRemoved > 0) {
notifyDataSetChanged();
}
}
use of org.wordpress.android.models.ReaderPostList in project WordPress-Android by wordpress-mobile.
the class ReaderPostTable method getPostsWithTag.
public static ReaderPostList getPostsWithTag(ReaderTag tag, int maxPosts, boolean excludeTextColumn) {
if (tag == null) {
return new ReaderPostList();
}
String columns = (excludeTextColumn ? COLUMN_NAMES_NO_TEXT : "*");
String sql = "SELECT " + columns + " FROM tbl_posts WHERE tag_name=? AND tag_type=?";
if (tag.tagType == ReaderTagType.DEFAULT) {
// longer followed if this is "Followed Sites"
if (tag.isPostsILike()) {
sql += " AND is_liked != 0";
} else if (tag.isFollowedSites()) {
sql += " AND is_followed != 0";
}
}
sql += " ORDER BY " + getSortColumnForTag(tag) + " DESC";
if (maxPosts > 0) {
sql += " LIMIT " + Integer.toString(maxPosts);
}
String[] args = { tag.getTagSlug(), Integer.toString(tag.tagType.toInt()) };
Cursor cursor = ReaderDatabase.getReadableDb().rawQuery(sql, args);
try {
return getPostListFromCursor(cursor);
} finally {
SqlUtils.closeCursor(cursor);
}
}
use of org.wordpress.android.models.ReaderPostList in project WordPress-Android by wordpress-mobile.
the class ReaderPostTable method addOrUpdatePost.
public static void addOrUpdatePost(ReaderPost post) {
if (post == null) {
return;
}
ReaderPostList posts = new ReaderPostList();
posts.add(post);
addOrUpdatePosts(null, posts);
}
Aggregations