linkify

Open TextView links at another activity, not default browser

别等时光非礼了梦想. 提交于 2019-11-28 17:17:58
Having the textView with autoLinkMask set to Linkify.ALL , i'm able to open the links and the browser shows the web-page. I need to call another activity that will do it with it's webView not leaving the application. Important notes: changing the textView content is not an option, i need to have the links displayed as they are with the schemes they have, there's lot of text in the textView, not only the link. I looked through movementMethod and IntentFilters , might miss something but looks like it can't help. So, any option to intercept the touched link in the TextView to do something with it

Disable the automatic Linkify of Webview

核能气质少年 提交于 2019-11-28 04:00:49
问题 I have a webview that I am creating. It seems to automatically be linkifying numbers into tel: urls. I didn't see a way to remove this ability (at least nothing similar to the way to enable it on a textview). The code is pretty simple: // populate the web view WebView webView = (WebView) findViewById(R.id.app_info_webview); webView.getSettings().setJavaScriptEnabled(true); webView.setScrollBarStyle(WebView.SCROLLBARS_INSIDE_OVERLAY); webView.setBackgroundColor(0); String url = APP_INFO_BODY

Linkify Regex Function PHP Daring Fireball Method

心已入冬 提交于 2019-11-28 00:23:27
So, I know there are a ton of related questions on SO, but none of them are quite what I'm looking for. I'm trying to implement a PHP function that will convert text URLs from a user-generated post into links. I'm using the 'improved' Regex from Daring Fireball towards the bottom of the page: http://daringfireball.net/2010/07/improved_regex_for_matching_urls The function does not return anything, and I'm not sure why. <?php if ( false === function_exists('linkify') ): function linkify($str) { $pattern = '(?xi)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|

Open TextView links at another activity, not default browser

别等时光非礼了梦想. 提交于 2019-11-27 20:09:18
问题 Having the textView with autoLinkMask set to Linkify.ALL , i'm able to open the links and the browser shows the web-page. I need to call another activity that will do it with it's webView not leaving the application. Important notes: changing the textView content is not an option, i need to have the links displayed as they are with the schemes they have, there's lot of text in the textView, not only the link. I looked through movementMethod and IntentFilters , might miss something but looks

Android TextView Linkify intercepts with parent View gestures

别说谁变了你拦得住时间么 提交于 2019-11-27 12:15:05
The problem is that if i Linkify the textView the underliyng ScrollView don't listen the sweep Gestures I've setted.Is there a way to have Linkify without messing with the underliyng view's gestures? I tried to override ontouchEvent and return false to ACTION_MOVE but the scrollview's gesture needs the ACTION_DOWN and ACTION_UP event to function. Is there a way to achieve that? Linkify applies to a movementMethod to the textView LinkMovementMethod . That movement method thought it implements a scrolling vertically method it overrides any other scrolling method the parent has. Although

Android Linkify both web and @mentions all in the same TextView

邮差的信 提交于 2019-11-27 11:30:30
Ok so I asked this yesterday: AutoLink @mentions in a twitter client I got my @mentions linking correctly. But in order to get it to work I had to take android:autoLink="web" out my xml for the TextView. So now I get links to @mentions but it no longer links URLs. I tried doing two seperate Linkify.addLinks() calls like this: mentionFilter = new TransformFilter() { public final String transformUrl(final Matcher match, String url) { return match.group(1); } }; // Match @mentions and capture just the username portion of the text. //pattern = Pattern.compile("@([A-Za-z0-9_-]+)"); pattern =

convert url to links from string except if they are in an attribute of an html tag

只愿长相守 提交于 2019-11-26 23:10:13
问题 I am trying to convert, from a textarea input ( $_POST['content'] ), all urls to link. $content = preg_replace('!(\s|^)((https?://)+[a-z0-9_./?=&-]+)!i', ' <a href="$2" target="_blank">$2</a> ', nl2br($_POST['content'])." "); $content = preg_replace('!(\s|^)((www\.)+[a-z0-9_./?=&-]+)!i', '<a target="_blank" href="http://$2" target="_blank">$2</a> ', $content." "); Target link formats: www.hello.com or http(s)://(www).hello.com But this seem to break any iframe, image or similar, How is/are

C# code to linkify urls in a string

冷暖自知 提交于 2019-11-26 21:56:45
Does anyone have any good c# code (and regular expressions) that will parse a string and "linkify" any urls that may be in the string? Konstantin Tarkus It's a pretty simple task you can acheive it with Regex and a ready-to-go regular expression from: http://regexlib.com/ Something like: var html = Regex.Replace(html, @"^(http|https|ftp)\://[a-zA-Z0-9\-\.]+" + "\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?" + "([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$", "<a href=\"$1\">$1</a>"); You may also be interested not only in creating links but in shortening URLs. Here is a good article on this subject: Resolve and

Android TextView Linkify intercepts with parent View gestures

纵饮孤独 提交于 2019-11-26 18:10:07
问题 The problem is that if i Linkify the textView the underliyng ScrollView don't listen the sweep Gestures I've setted.Is there a way to have Linkify without messing with the underliyng view's gestures? I tried to override ontouchEvent and return false to ACTION_MOVE but the scrollview's gesture needs the ACTION_DOWN and ACTION_UP event to function. Is there a way to achieve that? 回答1: Linkify applies to a movementMethod to the textView LinkMovementMethod . That movement method thought it

Android: Linkify TextView

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 15:30:52
I have textview which I need to linkify. Here's what I am doing.. TextView text = (TextView) view.findViewById(R.id.name); text.setText("Android...Update from Android"); Pattern pattern = Pattern.compile("Android"); String scheme = "www.android.com"; Linkify.addLinks(text, pattern, scheme); The text-view is displayed correctly with the text "Android...Update from Android", but I am facing two problems. 1) My text string has two instances of the string "Android". So, both the text are linkified. I want only the first occurrence to be linkified. How should I go about it? 2) When I click the