List of usage examples for android.widget TextView getPaintFlags
public int getPaintFlags()
From source file:Main.java
public static void setPaintFlags(TextView textView) { textView.setPaintFlags(textView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); }
From source file:Main.java
/** * This method formats a TextView as if it was a hyperlink. This method * is useful when it's not a real HTML link but there's an OnClickListener * assigned to the TextView, taking you to some other action. * * @param t The TextView whose appearance is to be changed. *///from w w w . j a va2 s . co m public static TextView renderAsLink(TextView t) { t.setPaintFlags(t.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); t.setTextColor(Color.BLUE); return t; }
From source file:Main.java
public static void setStrikeThrough(TextView tv) { tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); }
From source file:Main.java
/** * Remove strike through text view text flag. * @param textView/*from www .j av a 2 s .c o m*/ * @return */ public static TextView removeStrikeThroughTextView(TextView textView) { textView.setPaintFlags(textView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG)); return textView; }
From source file:Main.java
/** * Set typeface for a TextView/* w w w. ja v a 2 s . com*/ * * @param typeFace * @param view */ public static void setTypeFace(Typeface typeFace, TextView view) { view.setTypeface(typeFace); view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG); }
From source file:eu.inmite.apps.smsjizdenka.framework.about.BaseAboutFragment.java
public static void setupLink(TextView textView, View.OnClickListener listener) { textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); textView.setTextColor(App.getInstance().getResources().getColorStateList(R.color.about_link_dark)); textView.setOnClickListener(listener); }
From source file:eu.inmite.apps.smsjizdenka.framework.about.OpenSourceAdapter.java
private void openPlayServices(TextView textView) { textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); textView.setOnClickListener(new View.OnClickListener() { @Override//from w w w. j av a2 s. c o m public void onClick(View v) { PlayServicesLicenceDialogFragment.show(mFragmentManager); } }); }
From source file:com.juanvvc.fschecklistreader.ChecklistFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { // if the fragment is showing checklists, pass the event if (mode == MODE_CHECKLISTS) { if (this.listener != null) { this.listener.onChecklistClick(position); }//from www . j a v a2 s .c om } // the the fragment is showing items, strike the item if (mode == MODE_ITEMS) { TextView tv = (TextView) v.findViewById(R.id.name); tv.setPaintFlags(tv.getPaintFlags() ^ Paint.STRIKE_THRU_TEXT_FLAG); tv = (TextView) v.findViewById(R.id.value); tv.setPaintFlags(tv.getPaintFlags() ^ Paint.STRIKE_THRU_TEXT_FLAG); } }
From source file:org.mozilla.focus.widget.TelemetrySwitchPreference.java
@Override protected void onBindView(final View view) { super.onBindView(view); final Switch switchWidget = view.findViewById(R.id.switch_widget); switchWidget.setChecked(TelemetryWrapper.isTelemetryEnabled(getContext())); switchWidget.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override/*from ww w. ja va 2 s . co m*/ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { TelemetryWrapper.setTelemetryEnabled(getContext(), isChecked); } }); final Resources resources = view.getResources(); final TextView summary = view.findViewById(android.R.id.summary); summary.setText(resources.getString(R.string.preference_mozilla_telemetry_summary2, resources.getString(R.string.app_name))); final TextView learnMoreLink = view.findViewById(R.id.link); learnMoreLink.setPaintFlags(learnMoreLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); learnMoreLink.setTextColor(ContextCompat.getColor(view.getContext(), R.color.colorAction)); learnMoreLink.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // This is a hardcoded link: if we ever end up needing more of these links, we should // move the link into an xml parameter, but there's no advantage to making it configurable now. final String url = SupportUtils.getSumoURLForTopic(getContext(), "usage-data"); final String title = getTitle().toString(); final Intent intent = InfoActivity.getIntentFor(getContext(), url, title); getContext().startActivity(intent); } }); final TypedArray backgroundDrawableArray = view.getContext() .obtainStyledAttributes(new int[] { R.attr.selectableItemBackground }); final Drawable backgroundDrawable = backgroundDrawableArray.getDrawable(0); backgroundDrawableArray.recycle(); learnMoreLink.setBackground(backgroundDrawable); // We still want to allow toggling the pref by touching any part of the pref (except for // the "learn more" link) setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { switchWidget.toggle(); return true; } }); }
From source file:com.anysoftkeyboard.ui.tutorials.ChangeLogFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); LayoutInflater inflater = LayoutInflater.from(getActivity()); ViewGroup logContainer = (ViewGroup) view.findViewById(getLogItemsContainerId()); for (VersionChangeLogs.VersionChangeLog change : VersionChangeLogs.createChangeLog()) { View logHeader = inflater.inflate(R.layout.changelogentry_header, logContainer, false); TextView versionName = (TextView) logHeader.findViewById(R.id.changelog_version_title); versionName.setPaintFlags(versionName.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); setTitleText(versionName, change.versionName); logContainer.addView(logHeader); for (String changeEntry : change.changes) { TextView entryView = (TextView) inflater.inflate(R.layout.changelogentry_item, logContainer, false); entryView.setText(getString(R.string.change_log_bullet_point, changeEntry)); logContainer.addView(entryView); }//from w ww . j ava 2 s .c o m //TODO: add milestone url if (mLogToShow == SHOW_LATEST_CHANGELOG) break;//in this case, one is enough. //adding a divider between version logContainer.addView(inflater.inflate(R.layout.transparent_divider, logContainer, false)); } }