use of org.qii.weiciyuan.bean.CommentBean in project weiciyuan by qii.
the class CommentsTimeLineByMeDao method getGSONMsgList.
public CommentListBean getGSONMsgList() throws WeiboException {
String url = URLHelper.COMMENTS_BY_ME_TIMELINE;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("since_id", since_id);
map.put("max_id", max_id);
map.put("count", count);
map.put("page", page);
map.put("filter_by_source", filter_by_source);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
CommentListBean value = null;
try {
value = gson.fromJson(jsonData, CommentListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (value != null && value.getSize() > 0) {
List<CommentBean> msgList = value.getItemList();
Iterator<CommentBean> iterator = msgList.iterator();
while (iterator.hasNext()) {
CommentBean msg = iterator.next();
if (msg.getUser() == null) {
iterator.remove();
} else {
msg.getListViewSpannableString();
TimeUtility.dealMills(msg);
}
}
}
return value;
}
use of org.qii.weiciyuan.bean.CommentBean in project weiciyuan by qii.
the class MainCommentsTimeLineDao method getGSONMsgListWithoutClearUnread.
public CommentListBean getGSONMsgListWithoutClearUnread() throws WeiboException {
String url = getUrl();
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("since_id", since_id);
map.put("max_id", max_id);
map.put("count", count);
map.put("page", page);
map.put("filter_by_author", filter_by_author);
map.put("filter_by_source", filter_by_source);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
CommentListBean value = null;
try {
value = gson.fromJson(jsonData, CommentListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (value != null && value.getSize() > 0) {
List<CommentBean> msgList = value.getItemList();
Iterator<CommentBean> iterator = msgList.iterator();
while (iterator.hasNext()) {
CommentBean msg = iterator.next();
if (msg.getUser() == null) {
iterator.remove();
} else {
msg.getListViewSpannableString();
TimeUtility.dealMills(msg);
}
}
}
return value;
}
use of org.qii.weiciyuan.bean.CommentBean in project weiciyuan by qii.
the class CommentsTimeLineByIdDao method getGSONMsgList.
public CommentListBean getGSONMsgList() throws WeiboException {
String url = URLHelper.COMMENTS_TIMELINE_BY_MSGID;
Map<String, String> map = new HashMap<String, String>();
map.put("access_token", access_token);
map.put("id", id);
map.put("since_id", since_id);
map.put("max_id", max_id);
map.put("count", count);
map.put("page", page);
map.put("filter_by_author", filter_by_author);
String jsonData = HttpUtility.getInstance().executeNormalTask(HttpMethod.Get, url, map);
Gson gson = new Gson();
CommentListBean value = null;
try {
value = gson.fromJson(jsonData, CommentListBean.class);
} catch (JsonSyntaxException e) {
AppLogger.e(e.getMessage());
}
if (value != null && value.getItemList().size() > 0) {
List<CommentBean> msgList = value.getItemList();
Iterator<CommentBean> iterator = msgList.iterator();
while (iterator.hasNext()) {
CommentBean msg = iterator.next();
if (msg.getUser() == null) {
iterator.remove();
} else {
msg.getListViewSpannableString();
TimeUtility.dealMills(msg);
}
}
}
return value;
}
use of org.qii.weiciyuan.bean.CommentBean in project weiciyuan by qii.
the class BrowserCommentActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setDisplayHomeAsUpEnabled(true);
Intent intent = getIntent();
CommentBean bean = (CommentBean) intent.getParcelableExtra("comment");
token = intent.getStringExtra("token");
if (getFragmentManager().findFragmentByTag(BrowserCommentActivity.class.getName()) == null) {
getFragmentManager().beginTransaction().replace(android.R.id.content, new BrowserCommentFragment(bean), BrowserCommentFragment.class.getName()).commit();
}
}
use of org.qii.weiciyuan.bean.CommentBean in project weiciyuan by qii.
the class CommentListAdapter method setTopTipBar.
public void setTopTipBar(TopTipBar bar) {
this.topTipBar = bar;
AutoScrollListView autoScrollListView = (AutoScrollListView) listView;
autoScrollListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
View childView = Utility.getListViewItemViewFromPosition(listView, firstVisibleItem);
if (childView == null) {
return;
}
int position = firstVisibleItem - ((ListView) view).getHeaderViewsCount();
if (childView.getTop() == 0 && position <= 0) {
topTipBar.clearAndReset();
} else {
handle(position + 1);
}
}
private void handle(int position) {
if (position > 0 && topTipBar != null && position < bean.size()) {
CommentBean next = bean.get(position);
if (next != null) {
CommentBean helperMsg = bean.get(position - 1);
long helperId = 0L;
if (helperMsg != null) {
helperId = helperMsg.getIdLong();
}
topTipBar.handle(next.getIdLong(), helperId);
}
}
}
});
}
Aggregations