@Override protected void onPostExecute(ArrayList<RouteChangesEntity> routeChangesList) { super.onPostExecute(routeChangesList); if (routeChangesList == null) { ActivityUtils.showNoInternetToast(context); } else if (routeChangesList.size() == 0) { Toast.makeText( context, context.getString(R.string.route_changes_list_empty_text), Toast.LENGTH_LONG) .show(); } else { switch (loadType) { case INIT: Bundle bundle = new Bundle(); bundle.putSerializable(RouteChanges.BUNDLE_ROUTE_CHANGES_NEWS_LIST, routeChangesList); Intent routeChangesIntent; if (globalContext.isPhoneDevice()) { routeChangesIntent = new Intent(context, RouteChanges.class); } else { routeChangesIntent = new Intent(context, RouteChangesDialog.class); } routeChangesIntent.putExtras(bundle); context.startActivity(routeChangesIntent); break; default: ((RouteChanges) context).refreshRouteChangesList(routeChangesList); break; } } dismissLoadingView(); }
public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; FitnessExercise fEx = (FitnessExercise) getItem(position); if (fEx.isTrainingEntryFinished(fEx.getLastTrainingEntry())) { vi = mInflater.inflate(R.layout.list_row_fex_done, null); } else { vi = mInflater.inflate(R.layout.list_row_fex, null); int unfinished = calculateUnfinishedTrainingEntries(fEx); TextView textview_remaining_sets = (TextView) vi.findViewById(R.id.textview_remaining_sets); textview_remaining_sets.setText( mActivity.getString(R.string.remaining_sets) + " " + unfinished); } final ImageView imageview_ex_image = (ImageView) vi.findViewById(R.id.imageview_ex_image); DataHelper data = new DataHelper(mActivity); // Images if (!fEx.getImagePaths().isEmpty()) { String icon = fEx.getImagePaths().get(0).toString(); icon = icon.replace(".", "_icon."); imageview_ex_image.setImageDrawable(data.getDrawable(icon)); } else { // set default image if no image can be found imageview_ex_image.setImageResource(R.drawable.ic_launcher); } TextView textview_exercise_name = (TextView) vi.findViewById(R.id.textview_exercise_name); String ex_name = fEx.getLocalizedName(); textview_exercise_name.setText(ex_name, BufferType.SPANNABLE); return vi; }
@Override protected void onPostExecute(Boolean result) { // TODO Auto-generated method stub super.onPostExecute(result); PromptUtil.dissmiss(); if (mRsp == null) { PromptUtil.showToast(activity, activity.getString(R.string.net_error)); } else { try { mList.clear(); List<ProtocolData> mDatas = mRsp.mActions; parserResponse(mDatas); if (!ErrorUtil.create().errorDeal(LoginUtil.mLoginStatus, activity)) { if (LoginUtil.mLoginStatus.mResponseData.getRettype().equals(ProtocolUtil.HEADER_SUCCESS) && LoginUtil.mLoginStatus .mResponseData .getRetcode() .equals(ProtocolUtil.HEADER_SUCCESS)) { PromptUtil.showToast(activity, LoginUtil.mLoginStatus.message); } return; } if (LoginUtil.mLoginStatus.result.equals(ProtocolUtil.SUCCESS)) { Intent pwdIntent = new Intent(); pwdIntent.setClass(activity, ReadPwdProtectionActivity.class); activity.startActivity(pwdIntent); } } catch (Exception e) { PromptUtil.showToast(activity, activity.getString(R.string.req_error)); } } }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; int type = getItemViewType(position); if (view == null) { if (type == LOADING) view = inflater.inflate(R.layout.uv_loading_item, null); else if (type == FORUM) view = inflater.inflate(R.layout.uv_text_item, null); else if (type == KB_HEADER) view = inflater.inflate(R.layout.uv_header_item_light, null); else if (type == TOPIC) view = inflater.inflate(R.layout.uv_text_item, null); else if (type == CONTACT) view = inflater.inflate(R.layout.uv_text_item, null); else if (type == ARTICLE) view = inflater.inflate(R.layout.uv_text_item, null); else if (type == POWERED_BY) view = inflater.inflate(R.layout.uv_powered_by_item, null); } if (type == FORUM) { TextView textView = (TextView) view.findViewById(R.id.uv_text); textView.setText(R.string.uv_feedback_forum); TextView text2 = (TextView) view.findViewById(R.id.uv_text2); text2.setText( Utils.getQuantityString( text2, R.plurals.uv_ideas, Session.getInstance().getForum().getNumberOfOpenSuggestions())); } else if (type == KB_HEADER) { TextView textView = (TextView) view.findViewById(R.id.uv_header_text); textView.setText(R.string.uv_knowledge_base); } else if (type == TOPIC) { Topic topic = (Topic) getItem(position); TextView textView = (TextView) view.findViewById(R.id.uv_text); textView.setText(topic.getName()); textView = (TextView) view.findViewById(R.id.uv_text2); if (topic.getId() == -1) { textView.setVisibility(View.GONE); } else { textView.setVisibility(View.VISIBLE); textView.setText( String.format( "%d %s", topic.getNumberOfArticles(), context .getResources() .getQuantityString(R.plurals.uv_articles, topic.getNumberOfArticles()))); } } else if (type == CONTACT) { TextView textView = (TextView) view.findViewById(R.id.uv_text); textView.setText(R.string.uv_contact_us); view.findViewById(R.id.uv_text2).setVisibility(View.GONE); } else if (type == ARTICLE) { TextView textView = (TextView) view.findViewById(R.id.uv_text); Article article = (Article) getItem(position); textView.setText(article.getTitle()); } else if (type == POWERED_BY) { TextView textView = (TextView) view.findViewById(R.id.uv_version); textView.setText(context.getString(R.string.uv_android_sdk) + " v" + UserVoice.getVersion()); } View divider = view.findViewById(R.id.uv_divider); if (divider != null) divider.setVisibility( (position == getCount() - 2 && getItemViewType(getCount() - 1) == POWERED_BY) || position == getCount() - 1 ? View.GONE : View.VISIBLE); if (type == FORUM) divider.setVisibility(View.GONE); return view; }