public class

EditableWebView

extends WebView
implements ViewTreeObserver.OnPreDrawListener
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.AbsoluteLayout
         ↳ android.webkit.WebView
           ↳ android.webkit.EditableWebView

Summary

Nested Classes
class EditableWebView.ImageInfo  
interface EditableWebView.OnContentChangedListener Interface definition for a callback to be invoked when content has been changed. 
interface EditableWebView.OnImageSelectedListener Interface definition for a callback to be invoked when content has been changed. 
interface EditableWebView.OnOverScrollListener Interface definition for a callback to be invoked when vertical is over-scrolled  
interface EditableWebView.OnScrollChangedListener  
Constants
String CUSTOM_CLIP_LABEL
[Expand]
Inherited Constants
From class android.webkit.WebView
From class android.view.ViewGroup
From class android.view.View
Fields
public static int DELAY_CURSOR_ANCHOR_DISAPPEAR
[Expand]
Inherited Fields
From class android.webkit.WebView
From class android.view.ViewGroup
From class android.view.View
Public Constructors
EditableWebView(Context context)
EditableWebView(Context context, AttributeSet attrs)
Public Methods
boolean GetImageAttr(String[] strImagePath, int[] nImageNode, Rect rectImage)
void SetBackColor(int color, boolean enableBackColor)
void SetFontSize(int size)
void SetForeColor(int color)
void SetImageAttr(int pointer, int width, int height)
void SetOwnerActivityContext(Context ctx)
void alignCenter()
void alignJustified()
void alignLeft()
void alignRight()
void beginBatchEdit()
void cancelAnchorSpan()
boolean commitText(CharSequence text, int newCursorPosition)
void copy()
void cut()
void deleteSurroundingText(int leftStart, int leftEnd, int rightStart, int rightEnd)
void destroy()
void enableMultiTouch()
void enableOrientationCustomScale(float portraitScale, float landscapeScale)
void endBatchEdit()
void exportHTML(String path)
void exportHTML(String path, Message callback)
void findContinuousBRFromEnd(int bottom, Message callback)
ArrayList<ArrayList<String>> getAllAnchorSpan()
Rect getAnchorRect(String id)
for Note API: get ID specified anchor node rectangle
void getAnchorSpanRect(Rect r, String id)
Rect getAnchorSpanRect(String id)
int getBackColor()
int getBoldState()
final Rect getCaretRect()
get rect of caret
int getContentWidth()
Editable getEditableText()
Return the text the WebView is editing as an Editable object.
boolean getEnableBackColor()
int getFontSize()
int getForeColor()
void getHTML(Message callback)
final Rect getHighlightRect()
get rect of highlight region
int getItalicState()
KeyListener getKeyListener()
View.OnTouchListener getPenHighlightListener()
View.OnTouchListener getPenSelectionListener()
Bitmap getRegionCapture(Rect r, boolean isContentDim, Bitmap bmp)
get partial capture of a region
Bitmap getRegionCapture(Rect r, boolean isContentDim)
get partial capture of a region
Bitmap getRegionCapture(int l, int t, int w, int h, boolean isContentDim, Bitmap bmp)
Bitmap getRegionCapture(int l, int t, int w, int h, boolean isContentDim)
get partial capture of a region
Bitmap getRegionCapture(int l, int t, int w, int h, boolean isContentDim, Bitmap bmp, int bgColor)
void getRegionCaptureByMessage(Message m)
It will call invalidate and do capture after draw finished then send message to your handler.
WebViewSelectionMethod getSelectionMethod()
int getStrikethroughState()
int getUnderlineState()
HTCWebCore gethTCWebCoreInst()
void hideSingleTapQuickActions()
void insertAnchorSpan(String title, Message msg)
void insertHTML(String path)
void insertHTMLString(String html)
void insertHtmlContainsAnchorSpan(String html)
void insertHtmlToTheEnd(String htmlString)
void insertImage(String src, int width, int height)
Insert an image into current cursor position.
boolean onCheckIsTextEditor()
void onCommitCompletion(CompletionInfo text)
InputConnection onCreateInputConnection(EditorInfo outAttrs)
void onEditorAction(int actionCode)
void onEndSelect(boolean removeSelection)
void onEndSelect()
boolean onKeyDown(int keyCode, KeyEvent event)
boolean onKeyShortcut(int keyCode, KeyEvent event)
boolean onKeyUp(int keyCode, KeyEvent event)
boolean onPreDraw()
boolean onPrivateIMECommand(String action, Bundle data)
Called by the framework in response to a private command from the current method, provided by it calling InputConnection.performPrivateCommand().
boolean onTextContextMenuItem(int id)
void onWindowFocusChanged(boolean hasWindowFocus)
void pasteLatestContentFromClipboard()
void pastePlainText()
void pasteWithStyle()
void pauseTextReflow(int nTextWrapWidth)
boolean performLongClick()
void resumeTextReflow()
void setAllowVerticalBouncing(boolean allow, int threshold, EditableWebView.OnOverScrollListener l)
Enable/disable vertical bouncing (bottom only), and also set the listener
final void setCaretPos(int x, int y)
move caret to (x, y)
boolean setComposingText(CharSequence text, int newCursorPosition)
void setEditable(boolean editable)
void setOnContentChangedListener(EditableWebView.OnContentChangedListener l)
Register a callback to be invoked when it's content has been changed.
void setOnImageSelectedListener(EditableWebView.OnImageSelectedListener l)
Register a callback to be invoked when it's content has been changed.
void setOnScrollChangedListener(EditableWebView.OnScrollChangedListener l)
void setPrivateImeOptions(String type)
Set the private content type of the text, which is the EditorInfo.privateImeOptions field that will be filled in when creating an input connection.
void setScaleWithoutCheck(boolean bSet)
void setWillDrawFind(boolean willDraw)
void setZoomLowerBound(float fLower)
void setZoomUpperBound(float fUpper)
void showSingleTapQuickActions()
void toggleBold()
void toggleItalic()
void toggleStrikethrough()
void toggleUnderline()
final Point transferDimension(Point source, boolean viewToContent)
transfer dimension
final Rect transferDimension(Rect source, boolean viewToContent)
transfer dimension
Protected Methods
boolean checkVerticalBouncingCallback(int distance)
void enableQuickSelection(boolean enable)
This method is deprecated. should be hidden fuinction, only used by framework
ResultReceiver getResultReceiver()
void initQuickSelect()
This method is deprecated. should be hidden fuinction, only used by framework
void initSingleTapQuickAction()
void myInitQuickAction()
void onAttachedToWindow()
void onConfigurationChanged(Configuration newConfig)
void onDetachedFromWindow()
void onDraw(Canvas canvas)
void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect)
void onScrollChanged(int l, int t, int oldl, int oldt)
void onSizeChanged(int w, int h, int ow, int oh)
boolean setFrame(int left, int top, int right, int bottom)
void singleTapInEditableWebView()
void updateContentFromMessage(int pointer)
void updateTextAndSelection(int nodePointer, int startIndx, int endIndx)
[Expand]
Inherited Methods
From class android.webkit.WebView
From class android.widget.AbsoluteLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.graphics.drawable.Drawable.Callback2
From interface android.view.HtcIfViewGroup
From interface android.view.KeyEvent.Callback
From interface android.view.ViewGroup.OnHierarchyChangeListener
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.ViewTreeObserver.OnGlobalFocusChangeListener
From interface android.view.ViewTreeObserver.OnPreDrawListener
From interface android.view.accessibility.AccessibilityEventSource

Constants

public static final String CUSTOM_CLIP_LABEL

Constant Value: "HTC_MODIFIED_CLIPDATA="

Fields

public static int DELAY_CURSOR_ANCHOR_DISAPPEAR

Public Constructors

public EditableWebView (Context context)

public EditableWebView (Context context, AttributeSet attrs)

Public Methods

public boolean GetImageAttr (String[] strImagePath, int[] nImageNode, Rect rectImage)

public void SetBackColor (int color, boolean enableBackColor)

public void SetFontSize (int size)

public void SetForeColor (int color)

public void SetImageAttr (int pointer, int width, int height)

public void SetOwnerActivityContext (Context ctx)

Since: API Level

public void alignCenter ()

public void alignJustified ()

public void alignLeft ()

public void alignRight ()

public void beginBatchEdit ()

public void cancelAnchorSpan ()

public boolean commitText (CharSequence text, int newCursorPosition)

public void copy ()

public void cut ()

public void deleteSurroundingText (int leftStart, int leftEnd, int rightStart, int rightEnd)

public void destroy ()

Since: API Level

public void enableMultiTouch ()

Since: API Level

public void enableOrientationCustomScale (float portraitScale, float landscapeScale)

public void endBatchEdit ()

public void exportHTML (String path)

public void exportHTML (String path, Message callback)

public void findContinuousBRFromEnd (int bottom, Message callback)

public ArrayList<ArrayList<String>> getAllAnchorSpan ()

public Rect getAnchorRect (String id)

for Note API: get ID specified anchor node rectangle

Parameters
id the ID of anchor node.
Returns
  • the rectangle of anchor node.

public void getAnchorSpanRect (Rect r, String id)

public Rect getAnchorSpanRect (String id)

public int getBackColor ()

public int getBoldState ()

public final Rect getCaretRect ()

get rect of caret

Returns
  • may be empty rect

public int getContentWidth ()

Since: API Level

public Editable getEditableText ()

Return the text the WebView is editing as an Editable object. If the WebView is not editable, null is returned.

public boolean getEnableBackColor ()

public int getFontSize ()

public int getForeColor ()

public void getHTML (Message callback)

public final Rect getHighlightRect ()

get rect of highlight region

Returns
  • may be empty rect

public int getItalicState ()

public KeyListener getKeyListener ()

public View.OnTouchListener getPenHighlightListener ()

public View.OnTouchListener getPenSelectionListener ()

public Bitmap getRegionCapture (Rect r, boolean isContentDim, Bitmap bmp)

get partial capture of a region

Parameters
r rect of capture region
isContentDim r is in view/content dimension
Returns
  • captured bitmap(w * h), null if something wrong

public Bitmap getRegionCapture (Rect r, boolean isContentDim)

get partial capture of a region

Parameters
r rect of capture region
isContentDim r is in view/content dimension
Returns
  • captured bitmap(w * h), null if something wrong

public Bitmap getRegionCapture (int l, int t, int w, int h, boolean isContentDim, Bitmap bmp)

public Bitmap getRegionCapture (int l, int t, int w, int h, boolean isContentDim)

get partial capture of a region

Parameters
l left
t top
w width
h height
isContentDim parameter is in view/content dimension
Returns
  • captured bitmap(w * h), null if something wrong

public Bitmap getRegionCapture (int l, int t, int w, int h, boolean isContentDim, Bitmap bmp, int bgColor)

public void getRegionCaptureByMessage (Message m)

It will call invalidate and do capture after draw finished then send message to your handler.

Parameters
m Set target as your handler, ar1 is 1 if isContentDim, obj is region rect and it will be replaced by captured bitmap

public WebViewSelectionMethod getSelectionMethod ()

public int getStrikethroughState ()

public int getUnderlineState ()

public HTCWebCore gethTCWebCoreInst ()

Since: API Level

public void hideSingleTapQuickActions ()

public void insertAnchorSpan (String title, Message msg)

public void insertHTML (String path)

public void insertHTMLString (String html)

public void insertHtmlContainsAnchorSpan (String html)

public void insertHtmlToTheEnd (String htmlString)

Since: API Level

public void insertImage (String src, int width, int height)

Insert an image into current cursor position.

Parameters
src The source path of the image, like an URL started with http or a file path started with file://.
width The final width of the image.
height The final height of the image.

public boolean onCheckIsTextEditor ()

Since: API Level

public void onCommitCompletion (CompletionInfo text)

public InputConnection onCreateInputConnection (EditorInfo outAttrs)

Since: API Level

public void onEditorAction (int actionCode)

public void onEndSelect (boolean removeSelection)

public void onEndSelect ()

public boolean onKeyDown (int keyCode, KeyEvent event)

Since: API Level

public boolean onKeyShortcut (int keyCode, KeyEvent event)

Since: API Level

public boolean onKeyUp (int keyCode, KeyEvent event)

Since: API Level

public boolean onPreDraw ()

public boolean onPrivateIMECommand (String action, Bundle data)

Called by the framework in response to a private command from the current method, provided by it calling InputConnection.performPrivateCommand().

Parameters
action The action name of the command.
data Any additional data for the command. This may be null.
Returns
  • Return true if you handled the command, else false.

public boolean onTextContextMenuItem (int id)

public void onWindowFocusChanged (boolean hasWindowFocus)

Since: API Level

public void pasteLatestContentFromClipboard ()

public void pastePlainText ()

public void pasteWithStyle ()

public void pauseTextReflow (int nTextWrapWidth)

Since: API Level

public boolean performLongClick ()

Since: API Level

public void resumeTextReflow ()

Since: API Level

public void setAllowVerticalBouncing (boolean allow, int threshold, EditableWebView.OnOverScrollListener l)

Enable/disable vertical bouncing (bottom only), and also set the listener

Parameters
allow allow vertical bouncing or not
threshold EditableWebView will call-back the listener if the distance of over-scroll larger than threshold
l the call-back listener

public final void setCaretPos (int x, int y)

move caret to (x, y)

Parameters
x in content dimension
y in content dimension

public boolean setComposingText (CharSequence text, int newCursorPosition)

public void setEditable (boolean editable)

public void setOnContentChangedListener (EditableWebView.OnContentChangedListener l)

Register a callback to be invoked when it's content has been changed.

Parameters
l The callback that will run

public void setOnImageSelectedListener (EditableWebView.OnImageSelectedListener l)

Register a callback to be invoked when it's content has been changed.

Parameters
l The callback that will run

public void setOnScrollChangedListener (EditableWebView.OnScrollChangedListener l)

public void setPrivateImeOptions (String type)

Set the private content type of the text, which is the EditorInfo.privateImeOptions field that will be filled in when creating an input connection.

See Also

public void setScaleWithoutCheck (boolean bSet)

Since: API Level

public void setWillDrawFind (boolean willDraw)

Since: API Level

public void setZoomLowerBound (float fLower)

Since: API Level

public void setZoomUpperBound (float fUpper)

Since: API Level

public void showSingleTapQuickActions ()

public void toggleBold ()

public void toggleItalic ()

public void toggleStrikethrough ()

public void toggleUnderline ()

public final Point transferDimension (Point source, boolean viewToContent)

transfer dimension

Parameters
source original dimension
viewToContent transfer dimension from view to content or content to view
Returns
  • new dimension

public final Rect transferDimension (Rect source, boolean viewToContent)

transfer dimension

Parameters
source original dimension
viewToContent transfer dimension from view to content or content to view
Returns
  • new dimension

Protected Methods

protected boolean checkVerticalBouncingCallback (int distance)

Since: API Level

protected void enableQuickSelection (boolean enable)

Since: API Level

This method is deprecated.
should be hidden fuinction, only used by framework

protected ResultReceiver getResultReceiver ()

Since: API Level

protected void initQuickSelect ()

Since: API Level

This method is deprecated.
should be hidden fuinction, only used by framework

protected void initSingleTapQuickAction ()

protected void myInitQuickAction ()

protected void onAttachedToWindow ()

Since: API Level

protected void onConfigurationChanged (Configuration newConfig)

Since: API Level

protected void onDetachedFromWindow ()

Since: API Level

protected void onDraw (Canvas canvas)

Since: API Level

protected void onFocusChanged (boolean focused, int direction, Rect previouslyFocusedRect)

Since: API Level

protected void onScrollChanged (int l, int t, int oldl, int oldt)

Since: API Level

protected void onSizeChanged (int w, int h, int ow, int oh)

Since: API Level

protected boolean setFrame (int left, int top, int right, int bottom)

Since: API Level

protected void singleTapInEditableWebView ()

Since: API Level

protected void updateContentFromMessage (int pointer)

Since: API Level

protected void updateTextAndSelection (int nodePointer, int startIndx, int endIndx)

Since: API Level