diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-13 13:04:22 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-13 13:04:22 -0700 |
commit | ba87e3e6c985e7175152993b5efcc7dd2f0e1c93 (patch) | |
tree | ee35f76532767dc29411a8738a434d1d88d330f2 /core/java/android/text | |
parent | c39a6e0c51e182338deb8b63d07933b585134929 (diff) | |
download | frameworks_base-ba87e3e6c985e7175152993b5efcc7dd2f0e1c93.zip frameworks_base-ba87e3e6c985e7175152993b5efcc7dd2f0e1c93.tar.gz frameworks_base-ba87e3e6c985e7175152993b5efcc7dd2f0e1c93.tar.bz2 |
auto import from //branches/cupcake_rel/...@138607
Diffstat (limited to 'core/java/android/text')
-rw-r--r-- | core/java/android/text/style/ImageSpan.java | 3 | ||||
-rw-r--r-- | core/java/android/text/style/URLSpan.java | 7 | ||||
-rw-r--r-- | core/java/android/text/util/Regex.java | 12 |
3 files changed, 14 insertions, 8 deletions
diff --git a/core/java/android/text/style/ImageSpan.java b/core/java/android/text/style/ImageSpan.java index efb88a0..29c0c76 100644 --- a/core/java/android/text/style/ImageSpan.java +++ b/core/java/android/text/style/ImageSpan.java @@ -88,6 +88,7 @@ public class ImageSpan extends DynamicDrawableSpan { super(verticalAlignment); mContext = context; mContentUri = uri; + mSource = uri.toString(); } public ImageSpan(Context context, int resourceId) { @@ -117,6 +118,8 @@ public class ImageSpan extends DynamicDrawableSpan { mContentUri); bitmap = BitmapFactory.decodeStream(is); drawable = new BitmapDrawable(bitmap); + drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), + drawable.getIntrinsicHeight()); is.close(); } catch (Exception e) { Log.e("sms", "Failed to loaded content " + mContentUri, e); diff --git a/core/java/android/text/style/URLSpan.java b/core/java/android/text/style/URLSpan.java index f458611..d29bfb6 100644 --- a/core/java/android/text/style/URLSpan.java +++ b/core/java/android/text/style/URLSpan.java @@ -16,9 +16,11 @@ package android.text.style; +import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Parcel; +import android.provider.Browser; import android.text.ParcelableSpan; import android.text.TextUtils; import android.view.View; @@ -54,8 +56,9 @@ public class URLSpan extends ClickableSpan implements ParcelableSpan { @Override public void onClick(View widget) { Uri uri = Uri.parse(getURL()); + Context context = widget.getContext(); Intent intent = new Intent(Intent.ACTION_VIEW, uri); - intent.addCategory(Intent.CATEGORY_BROWSABLE); - widget.getContext().startActivity(intent); + intent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName()); + context.startActivity(intent); } } diff --git a/core/java/android/text/util/Regex.java b/core/java/android/text/util/Regex.java index 4c128ad..a349b82 100644 --- a/core/java/android/text/util/Regex.java +++ b/core/java/android/text/util/Regex.java @@ -66,9 +66,9 @@ public class Regex { public static final Pattern WEB_URL_PATTERN = Pattern.compile( "((?:(http|https|Http|Https):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)" - + "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2}))+(?:\\:(?:[a-zA-Z0-9\\$\\-\\_" - + "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2}))+)?\\@)?)?" - + "((?:(?:[a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+" // named host + + "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_" + + "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?" + + "((?:(?:[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}\\.)+" // named host + "(?:" // plus top level domain + "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])" + "|(?:biz|b[abdefghijmnorstvwyz])" @@ -122,12 +122,12 @@ public class Regex { public static final Pattern EMAIL_ADDRESS_PATTERN = Pattern.compile( - "[a-zA-Z0-9\\+\\.\\_\\%\\-]+" + + "[a-zA-Z0-9\\+\\.\\_\\%\\-]{1,256}" + "\\@" + - "[a-zA-Z0-9][a-zA-Z0-9\\-]*" + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + "(" + "\\." + - "[a-zA-Z0-9][a-zA-Z0-9\\-]*" + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + ")+" ); |