use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class HomeOtherGroupTimeLineDBTask method getPosition.
static TimeLinePosition getPosition(String accountId, String groupId) {
String sql = "select * from " + HomeOtherGroupTable.TABLE_NAME + " where " + HomeOtherGroupTable.ACCOUNTID + " = " + accountId + " and " + HomeOtherGroupTable.GROUPID + " = " + groupId;
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(HomeOtherGroupTable.TIMELINEDATA));
if (!TextUtils.isEmpty(json)) {
try {
TimeLinePosition value = gson.fromJson(json, TimeLinePosition.class);
c.close();
return value;
} catch (JsonSyntaxException e) {
e.printStackTrace();
}
}
}
c.close();
return TimeLinePosition.empty();
}
use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class MentionCommentsTimeLineDBTask method getCommentLineMsgList.
public static CommentTimeLineData getCommentLineMsgList(String accountId) {
TimeLinePosition position = getPosition(accountId);
int limit = position.position + AppConfig.DB_CACHE_COUNT_OFFSET > AppConfig.DEFAULT_MSG_COUNT_50 ? position.position + AppConfig.DB_CACHE_COUNT_OFFSET : AppConfig.DEFAULT_MSG_COUNT_50;
CommentListBean result = new CommentListBean();
List<CommentBean> msgList = new ArrayList<CommentBean>();
String sql = "select * from " + MentionCommentsTable.MentionCommentsDataTable.TABLE_NAME + " where " + MentionCommentsTable.MentionCommentsDataTable.ACCOUNTID + " = " + accountId + " order by " + MentionCommentsTable.MentionCommentsDataTable.MBLOGID + " desc limit " + limit;
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(MentionCommentsTable.MentionCommentsDataTable.JSONDATA));
if (!TextUtils.isEmpty(json)) {
try {
CommentBean value = gson.fromJson(json, CommentBean.class);
if (!value.isMiddleUnreadItem()) {
value.getListViewSpannableString();
}
msgList.add(value);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
} else {
msgList.add(null);
}
}
result.setComments(msgList);
c.close();
CommentTimeLineData mentionTimeLineData = new CommentTimeLineData(result, position);
return mentionTimeLineData;
}
use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class MentionCommentsTimeLineDBTask method getPosition.
public static TimeLinePosition getPosition(String accountId) {
String sql = "select * from " + MentionCommentsTable.TABLE_NAME + " where " + MentionCommentsTable.ACCOUNTID + " = " + accountId;
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(MentionCommentsTable.TIMELINEDATA));
if (!TextUtils.isEmpty(json)) {
try {
TimeLinePosition value = gson.fromJson(json, TimeLinePosition.class);
c.close();
return value;
} catch (JsonSyntaxException e) {
e.printStackTrace();
}
}
}
c.close();
return TimeLinePosition.empty();
}
use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class MentionWeiboTimeLineDBTask method getPosition.
public static TimeLinePosition getPosition(String accountId) {
String sql = "select * from " + RepostsTable.TABLE_NAME + " where " + RepostsTable.ACCOUNTID + " = " + accountId;
Cursor c = getRsd().rawQuery(sql, null);
Gson gson = new Gson();
while (c.moveToNext()) {
String json = c.getString(c.getColumnIndex(RepostsTable.TIMELINEDATA));
if (!TextUtils.isEmpty(json)) {
try {
TimeLinePosition value = gson.fromJson(json, TimeLinePosition.class);
c.close();
return value;
} catch (JsonSyntaxException e) {
e.printStackTrace();
}
}
}
c.close();
return TimeLinePosition.empty();
}
use of org.qii.weiciyuan.bean.android.TimeLinePosition in project weiciyuan by qii.
the class FriendsTimeLineDBTask method getOtherGroupData.
public static List<MessageTimeLineData> getOtherGroupData(String accountId, String exceptGroupId) {
List<MessageTimeLineData> data = new ArrayList<MessageTimeLineData>();
if (!"0".equals(exceptGroupId)) {
TimeLinePosition position = getPosition(accountId);
MessageListBean msgList = getHomeLineMsgList(accountId, position.position + AppConfig.DB_CACHE_COUNT_OFFSET);
MessageTimeLineData home = new MessageTimeLineData("0", msgList, position);
data.add(home);
}
MessageTimeLineData biGroup = HomeOtherGroupTimeLineDBTask.getTimeLineData(accountId, "1");
data.add(biGroup);
GroupListBean groupListBean = GroupDBTask.get(accountId);
if (groupListBean != null) {
List<GroupBean> lists = groupListBean.getLists();
for (GroupBean groupBean : lists) {
MessageTimeLineData dbMsg = HomeOtherGroupTimeLineDBTask.getTimeLineData(accountId, groupBean.getId());
data.add(dbMsg);
}
}
Iterator<MessageTimeLineData> iterator = data.iterator();
while (iterator.hasNext()) {
MessageTimeLineData single = iterator.next();
if (single.groupId.equals(exceptGroupId)) {
iterator.remove();
break;
}
}
return data;
}
Aggregations