Search in sources :

Example 1 with StatusHots

use of org.aisen.weibo.sina.sinasdk.bean.StatusHots in project AisenWeiBo by wangdan.

the class TimelineHotHttpUtility method parseResponse.

@Override
protected <T> T parseResponse(String resultStr, Class<T> responseCls) throws TaskException {
    try {
        StatusHots statusHots = super.parseResponse(resultStr, StatusHots.class);
        if (statusHots.getCards().size() == 0) {
            StatusContents result = new StatusContents();
            result.setStatuses(new ArrayList<StatusContent>());
            result.setEndPaging(true);
            return (T) result;
        }
        String[] ids = new String[statusHots.getCards().size()];
        for (int i = 0; i < statusHots.getCards().size(); i++) {
            ids[i] = statusHots.getCards().get(i).getMblog().getId() + "";
        }
        return (T) SinaSDK.getInstance(AppContext.getAccount().getAccessToken()).statusShowBatch(ids);
    } catch (Exception e) {
        throw new TaskException(TaskException.TaskError.resultIllegal.toString());
    }
}
Also used : StatusContent(org.aisen.weibo.sina.sinasdk.bean.StatusContent) TaskException(org.aisen.android.network.task.TaskException) StatusHots(org.aisen.weibo.sina.sinasdk.bean.StatusHots) StatusContents(org.aisen.weibo.sina.sinasdk.bean.StatusContents) TaskException(org.aisen.android.network.task.TaskException)

Aggregations

TaskException (org.aisen.android.network.task.TaskException)1 StatusContent (org.aisen.weibo.sina.sinasdk.bean.StatusContent)1 StatusContents (org.aisen.weibo.sina.sinasdk.bean.StatusContents)1 StatusHots (org.aisen.weibo.sina.sinasdk.bean.StatusHots)1