List of usage examples for android.widget TextView getContext
@ViewDebug.CapturedViewProperty public final Context getContext()
From source file:Main.java
public static void setTextAppearance(TextView tv, @StyleRes int textAppearanceRes) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { tv.setTextAppearance(textAppearanceRes); } else {//ww w .j a v a2s . com //noinspection deprecation tv.setTextAppearance(tv.getContext(), textAppearanceRes); } }
From source file:org.kontalk.ui.view.TextContentView.java
public static void setTextStyle(TextView textView) { Context context = textView.getContext(); String size = Preferences.getFontSize(context); int sizeId;/*from w w w.j a v a 2 s . co m*/ if (size.equals("small")) sizeId = android.R.style.TextAppearance_Small; else if (size.equals("large")) sizeId = android.R.style.TextAppearance_Large; else sizeId = android.R.style.TextAppearance; TextViewCompat.setTextAppearance(textView, sizeId); //setEmojiconSize((int) getTextSize()); }
From source file:com.nadmm.airports.utils.UiUtils.java
static public void setDefaultTintedTextViewDrawable(TextView tv, int resid) { Drawable d = getDefaultTintedDrawable(tv.getContext(), resid); setTextViewDrawable(tv, d);/*w w w .j a v a2 s .c om*/ }
From source file:com.nadmm.airports.utils.UiUtils.java
static public void setTintedTextViewDrawable(TextView tv, int resid, int color) { Drawable d = getTintedDrawable(tv.getContext(), resid, color); setTextViewDrawable(tv, d);/*from w ww . ja v a2 s. c o m*/ }
From source file:com.ada.utils.Ui.java
public static void setTypeface(TextView view, String path) { if (!view.isInEditMode()) { view.setTypeface(TypefaceUtils.getTypeface(view.getContext(), path)); }/* w w w .j a v a2 s. c o m*/ }
From source file:com.nadmm.airports.utils.UiUtils.java
static public void setTintedTextViewDrawable(TextView tv, int resid, ColorStateList tintList) { Drawable d = getTintedDrawable(tv.getContext(), resid, tintList); setTextViewDrawable(tv, d);//ww w .ja v a 2 s . c o m }
From source file:syncthing.android.api.model.EnumTextBinding.java
@BindingAdapter("modelStateTextColor") public static void modelStateTextColor(TextView view, ModelState state) { if (state == null) state = ModelState.UNKNOWN; switch (state) { case IDLE:/*from ww w. ja v a 2 s. c o m*/ view.setTextColor(ContextCompat.getColor(view.getContext(), R.color.folder_idle)); break; case SCANNING: case SYNCING: view.setTextColor(ContextCompat.getColor(view.getContext(), R.color.folder_scanning)); break; case ERROR: view.setTextColor(ContextCompat.getColor(view.getContext(), R.color.folder_error)); break; default: view.setTextColor(ContextCompat.getColor(view.getContext(), R.color.folder_default)); break; } }
From source file:com.example.ray.firstapp.bottombar.MiscUtils.java
/** * A convenience method for setting text appearance. * * @param textView a TextView which textAppearance to modify. * @param resId a style resource for the text appearance. *///from www.j av a2s .c o m @SuppressWarnings("deprecation") protected static void setTextAppearance(TextView textView, int resId) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { textView.setTextAppearance(resId); } else { textView.setTextAppearance(textView.getContext(), resId); } }
From source file:com.nadmm.airports.utils.UiUtils.java
static public void setTextViewDrawable(TextView tv, Drawable d) { tv.setCompoundDrawablesWithIntrinsicBounds(d, null, null, null); tv.setCompoundDrawablePadding(UiUtils.convertDpToPx(tv.getContext(), 6)); }
From source file:com.freshdigitable.udonroad.UserInfoActivity.java
public static void bindUserScreenName(TextView textView, User user) { final Resources resources = textView.getContext().getResources(); textView.setText(String.format(resources.getString(R.string.tweet_name), user.getScreenName())); }