+ private static int getHintFlags(CharSequence text, int start, int end) {
+ int flag = 0;
+ final CharSequence subText = text.subSequence(start, end);
+ if (Patterns.AUTOLINK_EMAIL_ADDRESS.matcher(subText).matches()) {
+ flag |= SmartSelection.HINT_FLAG_EMAIL;
+ }
+ if (Patterns.AUTOLINK_WEB_URL.matcher(subText).matches()
+ && Linkify.sUrlMatchFilter.acceptMatch(text, start, end)) {
+ flag |= SmartSelection.HINT_FLAG_URL;
+ }
+ // TODO: Added this log for debug only. Remove before release.
+ Log.d(LOG_TAG, String.format("Email hint: %b",
+ (flag & SmartSelection.HINT_FLAG_EMAIL) != 0));
+ Log.d(LOG_TAG, String.format("Url hint: %b",
+ (flag & SmartSelection.HINT_FLAG_URL) != 0));
+ return flag;
+ }
+