@Override protected List<com.cattong.entity.Status> doInBackground(Void... params) { if (microBlog == null) { return null; } List<com.cattong.entity.Status> listStatus = null; paging = adapter.getPaging(); com.cattong.entity.Status max = adapter.getMin(); paging.setGlobalMax(max); if (paging.moveToNext()) { try { if (type == StatusCatalog.Hot_Retweet.getCatalogNo()) { listStatus = microBlog.getDailyHotRetweets(paging); } else { listStatus = microBlog.getDailyHotComments(paging); } } catch (LibException e) { if (Logger.isDebug()) Log.e(TAG, "Task", e); message = ResourceBook.getResultCodeValue(e.getErrorCode(), context); paging.moveToPrevious(); } } ResponseCountUtil.getResponseCounts(listStatus, microBlog); return listStatus; }
@Override protected void onPostExecute(List<com.cattong.entity.Status> result) { if (result != null && result.size() > 0) { adapter.addCacheToDivider(null, result); } else { if (message != null) { Toast.makeText(adapter.getContext(), message, Toast.LENGTH_LONG).show(); } } if (paging.hasNext()) { context.showMoreFooter(); } else { context.showNoMoreFooter(); } }
public HotStatusesTask(HotStatusesActivity context, HotStatusesListAdapter adapter, int type) { this.context = context; this.adapter = adapter; this.type = type; microBlog = GlobalVars.getMicroBlog(adapter.getAccount()); }