atom feed3 messages in[android-developers] WebView text sel...
FromSent OnAttachments
IcedNetJul 28, 2011 7:52 am 
IcedNetJul 29, 2011 2:29 pm 
IcedNetAug 19, 2011 6:39 am 
Subject:[android-developers] WebView text selection and persistent highlighting dilemma
From:IcedNet (
Date:Jul 28, 2011 7:52:32 am

Hello All,

I am working on a non-trivial epub format book reader project in 3.1+, implementing it within a WebView.

I am stymied at the text selection/highlight phase (luckily ? I have many more operations to polish up and implement).

I can , of course highlight text and use the Clipboard manager in it's intended role (copy/paste, et al). The problem is twofold when I attempt to enable persistent text highlighting within the WebView itself:

1) the ClipboardManager does not (currently) seem well-suited for this -- I have implemented the OnPrimaryClipChangedListener to capture the clipboard text and process it within my WebView, but, being that I cannot override the System Clipboard ActionBar menu, I receive the text as would any app, only upon clicking "Copy" etc... and the menu, though nice, is not "ours". I have seen the results of polling the ClipboardManager.hasPrimaryClip() for it's text as well so I believe that path is doom-laden :)

2) I have attempted to use the ActionMode pattern, but overriding onDragEvent() within my WebView is non-responsive (as in it never fires) and gives me the dreaded "Miss a drag as we are waiting for WebCore's response for touch down." -- as I am trying to control page turning/navigation within the WebView (javascript disables ontouch events) for the obvious reason that it is a book reader, not a webpage.

As an aside, I notice that Google's flagship "Books" app, though pretty, also does not allow highlighting/text selection... with the splitting of images between pages, we were thinking it might be a WebView implementation as well -- just a slight beg for source code... only slight, really :)

If it is not clear from the above, I am wondering how to get control of the ClipboardManager, or barring that (which I assume I cannot do as it is a System service), maybe someone can point me in the direction of a workaround for webcore so cruelly denying Java the ability to control the world. I am open to taking complete control of motion events if need be, but that is so demanding for such a seemingly simple task as this... I mean, really, Amazon does what we want to do in Kindle for Droid... :)

Thanks for your time!

Peace, Dan