From 6ef7af508903eddc76f7bb693b71a547df94cb6e Mon Sep 17 00:00:00 2001 From: Satoshi Kataoka <> Date: Tue, 24 Mar 2009 19:05:08 -0700 Subject: [PATCH] Automated import from //branches/donutburger/...@140966,140966 --- .../android/internal/widget/EditStyledText.java | 60 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/core/java/com/android/internal/widget/EditStyledText.java b/core/java/com/android/internal/widget/EditStyledText.java index b7af4e45a240..1eba5c251007 100644 --- a/core/java/com/android/internal/widget/EditStyledText.java +++ b/core/java/com/android/internal/widget/EditStyledText.java @@ -16,6 +16,8 @@ package com.android.internal.widget; +import java.util.ArrayList; + import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; @@ -323,7 +325,7 @@ public class EditStyledText extends EditText { } /** - * Check editing is started. + * Check whether editing is started or not. * * @return Whether editing is started or not. */ @@ -331,6 +333,11 @@ public class EditStyledText extends EditText { return mManager.isEditting(); } + /** + * Check whether SoftKey is Blocked or not. + * + * @return whether SoftKey is Blocked or not. + */ public boolean isSoftKeyBlocked() { return mManager.isSoftKeyBlocked(); } @@ -353,6 +360,15 @@ public class EditStyledText extends EditText { return mManager.getSelectState(); } + @Override + public Bundle getInputExtras(boolean create) { + Bundle bundle = super.getInputExtras(create); + if (bundle != null) { + bundle.putBoolean("allowEmoji", true); + } + return bundle; + } + /** * Get the state of the selection. * @@ -363,6 +379,18 @@ public class EditStyledText extends EditText { } /** + * Get the state of the selection. + * + * @param uris + * The array of used uris. + * @return The state of the selection. + */ + public String getHtml(ArrayList uris) { + mConverter.getUriArray(uris, this.getText()); + return mConverter.getConvertedBody(); + } + + /** * Initialize members. */ private void init() { @@ -423,15 +451,6 @@ public class EditStyledText extends EditText { } } - @Override - public Bundle getInputExtras(boolean create) { - Bundle bundle = super.getInputExtras(create); - if (bundle != null) { - bundle.putBoolean("allowEmoji", true); - } - return bundle; - } - /** * EditorManager manages the flow and status of editing actions. */ @@ -1011,6 +1030,27 @@ public class EditStyledText extends EditText { } return htmlBody; } + + public void getUriArray(ArrayList uris, Editable text) { + uris.clear(); + if (DBG) { + Log.d(LOG_TAG, "--- getUriArray:"); + } + int len = text.length(); + int next; + for (int i = 0; i < text.length(); i = next) { + next = text.nextSpanTransition(i, len, ImageSpan.class); + ImageSpan[] images = text.getSpans(i, next, ImageSpan.class); + for (int j = 0; j < images.length; j++) { + if (DBG) { + Log.d(LOG_TAG, "--- getUriArray: foundArray" + + ((ImageSpan) images[j]).getSource()); + } + uris.add(Uri.parse( + ((ImageSpan) images[j]).toString())); + } + } + } } private class StyledTextToast { -- 2.11.0