use of android.text.method.LinkMovementMethod in project muzei by romannurik.
the class AboutActivity method onCreate.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.about_activity);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
((Toolbar) findViewById(R.id.app_bar)).setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
onNavigateUp();
}
});
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.demo_view_container, MuzeiRendererFragment.createInstance(true, false)).commit();
}
// Get app version
PackageManager pm = getPackageManager();
String packageName = getPackageName();
String versionName;
try {
PackageInfo info = pm.getPackageInfo(packageName, 0);
versionName = info.versionName;
} catch (PackageManager.NameNotFoundException e) {
versionName = VERSION_UNAVAILABLE;
}
// Build the about body view and append the link to see OSS licenses
TextView versionView = (TextView) findViewById(R.id.app_version);
versionView.setText(Html.fromHtml(getString(R.string.about_version_template, versionName)));
TextView aboutBodyView = (TextView) findViewById(R.id.about_body);
aboutBodyView.setText(Html.fromHtml(getString(R.string.about_body)));
aboutBodyView.setMovementMethod(new LinkMovementMethod());
findViewById(R.id.android_experiment_link).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CustomTabsIntent cti = new CustomTabsIntent.Builder().setShowTitle(true).setToolbarColor(ContextCompat.getColor(AboutActivity.this, R.color.theme_primary)).build();
try {
cti.launchUrl(AboutActivity.this, Uri.parse("https://www.androidexperiments.com/experiment/muzei"));
} catch (ActivityNotFoundException ignored) {
}
}
});
}
use of android.text.method.LinkMovementMethod in project making-apps-beautiful by ankurkotwal.
the class ArticleDetailFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_article_detail, container, false);
// Show the dummy content as text in a TextView.
if (mItem != null) {
((TextView) rootView.findViewById(R.id.article_title)).setText(mItem.title);
((TextView) rootView.findViewById(R.id.article_byline)).setText(Html.fromHtml(mItem.time.toUpperCase(Locale.getDefault()) + " BY <font color='" + getResources().getString(R.string.author_font_color) + "'>" + mItem.author.toUpperCase(Locale.getDefault()) + "</a>"));
((TextView) rootView.findViewById(R.id.article_byline)).setMovementMethod(new LinkMovementMethod());
// ((TextView) rootView.findViewById(R.id.article_date))
// .setText(mItem.time);
((TextView) rootView.findViewById(R.id.article_body)).setText(Html.fromHtml(mItem.content));
((TextView) rootView.findViewById(R.id.article_body)).setTypeface(Typeface.createFromAsset(getResources().getAssets(), "Rosario-Regular.ttf"));
((ImageView) rootView.findViewById(R.id.photo)).setImageDrawable(getResources().getDrawable(mItem.photoResId));
}
return rootView;
}
use of android.text.method.LinkMovementMethod in project platform_frameworks_base by android.
the class LinkifyTest method testNothing.
@SmallTest
public void testNothing() throws Exception {
TextView tv;
tv = new TextView(getContext());
tv.setText("Hey, foo@google.com, call 415-555-1212.");
assertFalse(tv.getMovementMethod() instanceof LinkMovementMethod);
assertTrue(tv.getUrls().length == 0);
}
use of android.text.method.LinkMovementMethod in project platform_frameworks_base by android.
the class LinkifyTest method testUnclickable.
@SmallTest
public void testUnclickable() throws Exception {
TextView tv;
tv = new TextView(getContext());
tv.setAutoLinkMask(Linkify.ALL);
tv.setLinksClickable(false);
tv.setText("Hey, foo@google.com, call 415-555-1212.");
assertFalse(tv.getMovementMethod() instanceof LinkMovementMethod);
assertTrue(tv.getUrls().length == 2);
}
use of android.text.method.LinkMovementMethod in project apps-android-wikipedia by wikimedia.
the class PageHeaderView method updateText.
private void updateText() {
avPlayer.stop();
SpannableStringBuilder builder = new SpannableStringBuilder(title);
builder.setSpan(new TypefaceSpan("serif"), 0, title.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
if (hasPronunciation()) {
builder.append(" ");
builder.append(pronunciationSpanned());
}
titleText.setMovementMethod(new LinkMovementMethod());
titleText.setText(builder);
if (hasSubtitle() || allowDescriptionEdit) {
subtitleText.setMovementMethod(hasSubtitle() ? null : new LinkMovementMethod());
subtitleText.setText(subtitleSpanned());
subtitleText.setVisibility(VISIBLE);
} else {
subtitleText.setVisibility(INVISIBLE);
}
}
Aggregations