private void onTaskTipsComplete(Group<Tip> group, boolean recentOnly, Exception ex) { SegmentedButton buttons = getHeaderButton(); boolean update = false; if (group != null) { if (recentOnly) { mStateHolder.setTipsRecent(group); if (buttons.getSelectedButtonIndex() == 0) { mListAdapter.setGroup(mStateHolder.getTipsRecent()); update = true; } } else { mStateHolder.setTipsPopular(group); if (buttons.getSelectedButtonIndex() == 1) { mListAdapter.setGroup(mStateHolder.getTipsPopular()); update = true; } } } else { if (recentOnly) { mStateHolder.setTipsRecent(new Group<Tip>()); if (buttons.getSelectedButtonIndex() == 0) { mListAdapter.setGroup(mStateHolder.getTipsRecent()); update = true; } } else { mStateHolder.setTipsPopular(new Group<Tip>()); if (buttons.getSelectedButtonIndex() == 1) { mListAdapter.setGroup(mStateHolder.getTipsPopular()); update = true; } } NotificationsUtil.ToastReasonForFailure(this, ex); } if (recentOnly) { mStateHolder.setIsRunningTaskTipsRecent(false); mStateHolder.setRanOnceTipsRecent(true); if (mStateHolder.getTipsRecent().size() == 0 && buttons.getSelectedButtonIndex() == 0) { setEmptyView(mLayoutEmpty); } } else { mStateHolder.setIsRunningTaskTipsPopular(false); mStateHolder.setRanOnceTipsPopular(true); if (mStateHolder.getTipsPopular().size() == 0 && buttons.getSelectedButtonIndex() == 1) { setEmptyView(mLayoutEmpty); } } if (update) { mListAdapter.notifyDataSetChanged(); getListView().setSelection(0); } if (!mStateHolder.getIsRunningTaskTipsRecent() && !mStateHolder.getIsRunningTaskTipsPopular()) { setProgressBarIndeterminateVisibility(false); } }
@Override protected void onPostExecute(Venue venue) { try { if (VenueUtils.isValid(venue)) { setVenue(venue); } else { NotificationsUtil.ToastReasonForFailure(VenueActivity.this, mReason); finish(); } } finally { stopProgressBar(PROGRESS_BAR_TASK_ID); } }
@Override public void onPostExecute(Group<Group<Venue>> groups) { try { if (groups == null) { NotificationsUtil.ToastReasonForFailure(SearchVenuesActivity.this, mReason); } else { setSearchResults(groups); putSearchResultsInAdapter(groups); } } finally { setProgressBarIndeterminateVisibility(false); ensureTitle(true); ensureSearchResults(); } }
@Override public void onPostExecute(Tip tip) { if (DEBUG) Log.d(TAG, "TipAddTask: onPostExecute()"); try { if (tip == null) { NotificationsUtil.ToastReasonForFailure(VenueActivity.this, mReason); } else { String tipToastString = "Added Tip #" + tip.getId() + " " + tip.getText(); // Refresh the tips list. Toast.makeText(VenueActivity.this, tipToastString, Toast.LENGTH_LONG).show(); new VenueTask().execute(mStateHolder.venueId); } } finally { stopProgressBar(PROGRESS_BAR_TASK_ID); mStateHolder.tip = null; } }