Add click handler to links

This commit is contained in:
mvp76 2016-11-10 17:41:12 +01:00
parent 3eb2a5eb96
commit 0898db3490

View File

@ -460,10 +460,23 @@ public class AppDetails2 extends AppCompatActivity {
} }
private void onLinkClicked(String url) { private void onLinkClicked(String url) {
if (!TextUtils.isEmpty(url)) {
tryOpenUri(url);
}
} }
} }
private void tryOpenUri(String s) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(s));
if (intent.resolveActivity(getPackageManager()) == null) {
Toast.makeText(this,
getString(R.string.no_handler_app, intent.getDataString()),
Toast.LENGTH_LONG).show();
return;
}
startActivity(intent);
}
// The HTML formatter adds "\n\n" at the end of every paragraph. This // The HTML formatter adds "\n\n" at the end of every paragraph. This
// is desired between paragraphs, but not at the end of the whole // is desired between paragraphs, but not at the end of the whole
// string as it adds unwanted spacing at the end of the TextView. // string as it adds unwanted spacing at the end of the TextView.