public void reset( final Context context, final RedditPreparedInboxItem item, final ActiveTextView.OnLinkClickedListener listener) { header.setText(item.getHeader()); bodyHolder.removeAllViews(); bodyHolder.addView(item.getBody(context, 13.0f, bodyCol, listener)); }
private void setProgressMessage( boolean indeterminate, final int max, final int current, final String message) { if (progressBar == null || progressMessageTextView == null) return; if (indeterminate) { progressBar.setIndeterminate(true); } else { progressBar.setIndeterminate(false); progressBar.setMax(max); progressBar.setProgress(current); } progressMessageTextView.setText(message); }
@Override public void setShortcut(boolean showShortcut, char shortcutKey) { final int newVisibility = showShortcut && mItemData.shouldShowShortcut() ? View.VISIBLE : View.GONE; if (newVisibility == View.VISIBLE) { mShortcutView.setText(mItemData.getShortcutLabel()); } if (mShortcutView.getVisibility() != newVisibility) { mShortcutView.setVisibility(newVisibility); } }
/** {@inheritDoc} */ @Override public void onLoadFinished(final Loader<Cursor> loader, final Cursor data) { if (data == null || data.isClosed() || data.getCount() <= 0) { // Set the empty text final TextView empty = (TextView) findViewById(R.id.empty); empty.setText(getString(R.string.empty_search)); mGridView.setEmptyView(empty); return; } // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) mAdapter.swapCursor(data); }
@Override public void setTitle(CharSequence title) { if (title != null) { mTitleView.setText(title); if (mTitleView.getVisibility() != View.VISIBLE) { mTitleView.setVisibility(View.VISIBLE); } } else { if (mTitleView.getVisibility() != View.GONE) { mTitleView.setVisibility(View.GONE); } } }
private void fillComponent() { if (mRecipeDetailInfo != null) { mImageLoader.displayImage( MeishiApplication.getApplication().isShowPic() ? mRecipeDetailInfo.getRecipeCover().trim() : null, mImageViewTop, mOptions); mImageLoader.displayImage( MeishiApplication.getApplication().isShowPic() ? mRecipeDetailInfo.getRecipeAuthorAvator().trim() : null, mImageViewUser, mOptions2); mTextViewUserName.setText(mRecipeDetailInfo.getRecipeAuthor().trim()); mTextViewRecipeName.setText(mRecipeDetailInfo.getRecipeTitle().trim()); mTextViewDescr.setText( mRecipeDetailInfo.getRecipeDescr().replace("<br />", "").replace(" ", "")); mTextViewKouwei.setText(mRecipeDetailInfo.getCuisine().trim()); mTextViewGongyi.setText(mRecipeDetailInfo.getTechnics().trim()); mTextViewTime.setText(mRecipeDetailInfo.getDuring().trim()); mTextViewDifficulty.setText(mRecipeDetailInfo.getLevel().trim()); mImageViewUser.setOnClickListener(RecipeDetailFragment.this); List<IngredientInfo> mIngredientInfos01 = mRecipeDetailInfo.getmIngredientInfos1(); if (mIngredientInfos01 != null && mIngredientInfos01.size() > 0) { RelativeLayout localRelativeLayout = (RelativeLayout) LayoutInflater.inflate( getSupportActivity(), R.layout.recipe_detail_ingredients_category_name); TextView mTextView = (TextView) localRelativeLayout.findViewById(R.id.ingredientsCategoryName); mTextView.setText( MeishiApplication.getApplication().getString(R.string.fragment_recipe_detail_zhuliao)); mLinearLayoutIngredients.addView(localRelativeLayout); for (int i = 0; i < mIngredientInfos01.size(); i = i + 2) { View view = LayoutInflater.inflate(getSupportActivity(), R.layout.recipe_detail_ingredients_item); TextView textView01 = (TextView) view.findViewById(R.id.text11); TextView textView02 = (TextView) view.findViewById(R.id.text12); textView01.setText(mIngredientInfos01.get(i).getIngredientName().trim()); textView02.setText(mIngredientInfos01.get(i).getIngredientScale().trim()); if (i + 1 < mIngredientInfos01.size()) { TextView textView03 = (TextView) view.findViewById(R.id.text21); TextView textView04 = (TextView) view.findViewById(R.id.text22); textView03.setText(mIngredientInfos01.get(i + 1).getIngredientName().trim()); textView04.setText(mIngredientInfos01.get(i + 1).getIngredientScale().trim()); } this.mLinearLayoutIngredients.addView(view); } } List<IngredientInfo> mIngredientInfos02 = mRecipeDetailInfo.getmIngredientInfos2(); if (mIngredientInfos02 != null && mIngredientInfos02.size() > 0) { RelativeLayout localRelativeLayout = (RelativeLayout) LayoutInflater.inflate( getSupportActivity(), R.layout.recipe_detail_ingredients_category_name); TextView mTextView = (TextView) localRelativeLayout.findViewById(R.id.ingredientsCategoryName); mTextView.setText( MeishiApplication.getApplication().getString(R.string.fragment_recipe_detail_fuliao)); mLinearLayoutIngredients.addView(localRelativeLayout); for (int i = 0; i < mIngredientInfos02.size(); i = i + 2) { View view = LayoutInflater.inflate(getSupportActivity(), R.layout.recipe_detail_ingredients_item); TextView textView01 = (TextView) view.findViewById(R.id.text11); TextView textView02 = (TextView) view.findViewById(R.id.text12); textView01.setText(mIngredientInfos02.get(i).getIngredientName().trim()); textView02.setText(mIngredientInfos02.get(i).getIngredientScale().trim()); if (i + 1 < mIngredientInfos02.size()) { TextView textView03 = (TextView) view.findViewById(R.id.text21); TextView textView04 = (TextView) view.findViewById(R.id.text22); textView03.setText(mIngredientInfos02.get(i + 1).getIngredientName().trim()); textView04.setText(mIngredientInfos02.get(i + 1).getIngredientScale().trim()); } this.mLinearLayoutIngredients.addView(view); } } List<IngredientInfo> mIngredientInfos03 = mRecipeDetailInfo.getmIngredientInfos3(); if (mIngredientInfos03 != null && mIngredientInfos03.size() > 0) { RelativeLayout localRelativeLayout = (RelativeLayout) LayoutInflater.inflate( getSupportActivity(), R.layout.recipe_detail_ingredients_category_name); TextView mTextView = (TextView) localRelativeLayout.findViewById(R.id.ingredientsCategoryName); mTextView.setText( MeishiApplication.getApplication().getString(R.string.fragment_recipe_detail_peiliao)); mLinearLayoutIngredients.addView(localRelativeLayout); for (int i = 0; i < mIngredientInfos03.size(); i = i + 2) { View view = LayoutInflater.inflate(getSupportActivity(), R.layout.recipe_detail_ingredients_item); TextView textView01 = (TextView) view.findViewById(R.id.text11); TextView textView02 = (TextView) view.findViewById(R.id.text12); textView01.setText(mIngredientInfos03.get(i).getIngredientName().trim()); textView02.setText(mIngredientInfos03.get(i).getIngredientScale().trim()); if (i + 1 < mIngredientInfos03.size()) { TextView textView03 = (TextView) view.findViewById(R.id.text21); TextView textView04 = (TextView) view.findViewById(R.id.text22); textView03.setText(mIngredientInfos03.get(i + 1).getIngredientName().trim()); textView04.setText(mIngredientInfos03.get(i + 1).getIngredientScale().trim()); } this.mLinearLayoutIngredients.addView(view); } } if ((mIngredientInfos01 == null || mIngredientInfos01.size() == 0) && (mIngredientInfos02 == null || mIngredientInfos02.size() == 0) && (mIngredientInfos03 == null || mIngredientInfos03.size() == 0)) { TextView mTextView = (TextView) this.mLinearLayoutIngredients.findViewById( R.id.fragment_recipe_detail_main_ingredients_text); mTextView.setVisibility(View.VISIBLE); mTextView.setText( mRecipeDetailInfo.getMainIngredient().replace("<br />", "").replace(" ", "")); } if (!"".equals(mRecipeDetailInfo.getRecipeTips().trim())) { mTextViewTips.setText( mRecipeDetailInfo.getRecipeTips().replace("<br />", "").replace(" ", "")); } else { mTextViewTips.setVisibility(View.GONE); mTextViewTipsText.setVisibility(View.GONE); } mStepInfos = mRecipeDetailInfo.getmStepInfos(); if (mStepInfos != null && mStepInfos.size() > 0) { for (int i = 0; i < mStepInfos.size(); i++) { View view = LayoutInflater.inflate(getSupportActivity(), R.layout.recipe_detail_step_item); ImageView mImageView = (ImageView) view.findViewById(R.id.fragment_recipe_detail_step_image); TextView mTextViewIndex = (TextView) view.findViewById(R.id.fragment_recipe_detail_step_index); TextView mTextViewDesc = (TextView) view.findViewById(R.id.fragment_recipe_detail_step_description); String idx = mStepInfos.get(i).getIdx(); String pic = mStepInfos.get(i).getPic(); String note = mStepInfos.get(i).getNote(); if (!"".equals(pic.trim())) { mImageLoader.displayImage( MeishiApplication.getApplication().isShowPic() ? pic.trim() : null, mImageView, mOptions); } SpannableString spannableString = new SpannableString(idx + "."); spannableString.setSpan( new StyleSpan(Typeface.BOLD_ITALIC), 0, idx.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); mTextViewIndex.setText(spannableString); mTextViewDesc.setText(note.replace("<br />", "").replace(" ", "")); this.mLinearLayoutSteps.addView(view); view.setTag(Integer.valueOf(i)); StepInfoClick stepInfoClick = new StepInfoClick(); view.setOnClickListener(stepInfoClick); } } } }
public void setHeader(String header) { mHeader = header; mTopicName.setText(mHeader); }
@SuppressWarnings("deprecation") public View bindView( SliderItem item, View view, boolean selected, int defaultTextAppearance, int defaultTextAppearanceInverse) { TextView labelView = (TextView) view.findViewById(android.R.id.text1); if (labelView != null) { labelView.setText(item.mLabel); } final int textAppereance = item.mTextAppereance != 0 ? item.mTextAppereance : defaultTextAppearance; final int textAppereanceInverse = item.mTextAppereanceInverse != 0 ? item.mTextAppereanceInverse : defaultTextAppearanceInverse; setTextAppearance( labelView, mInverseTextColorWhenSelected ? selected ? textAppereanceInverse : textAppereance : textAppereance); if (mSelectionBehavior == null) { return view; } View selectionHandlerView = view.findViewById(R.id.selectionHandler); switch (mSelectionBehavior) { case Default: if (selected) { view.setBackgroundColor(item.mBackgroundColor); if (selectionHandlerView != null) { selectionHandlerView.setBackgroundColor(item.mSelectionHandlerColor); } } else { view.setBackgroundDrawable(null); if (selectionHandlerView != null) { selectionHandlerView.setBackgroundDrawable(null); } } break; case BackgroundWhenSelected: if (selectionHandlerView != null) { selectionHandlerView.setBackgroundColor(item.mSelectionHandlerColor); } if (selected) { view.setBackgroundColor(item.mBackgroundColor); } else { view.setBackgroundDrawable(null); } break; case OnlyBackground: if (selected) { view.setBackgroundColor(item.mBackgroundColor); } else { view.setBackgroundDrawable(null); } break; case OnlyHandler: if (selectionHandlerView != null) { if (selected) { selectionHandlerView.setBackgroundColor(item.mSelectionHandlerColor); } else { selectionHandlerView.setBackgroundDrawable(null); } } break; } return view; }