naoak / WebViewMarker

Support library for text selection on Android WebView. (forked from BTAndroidWebViewSelection)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Has two right dragView ?

liufsd opened this issue · comments

some times ,it's happen.
Normal:left and right.
Wrong:left and two right drag view .
when you touch your webview and then move right tag ,and then it will show two right drag view .and this new drag view can select the text (the web view selected) but not show toast. only normal right drag view can do it.
what's wrong ?

Maybe, I also have met this issue. On chromium-base webview, native drag handlers would also show by long touch. I think there is nothing for it not to use WebViewMarker on such a devices.

oh. i know . the right new drag view is the system drag view ,Am i right ?

Yeah, you are right. What device do you use?

nexus -7

2013 version? I think this issue occurs from Android 4.4.

Yeah.

so.i guess. if you override the web view longCick ,you can not select the text .but if you don't override .the bug it is/

if you got some ideas,please tell me !
Thanks.

OK, I'll take some investigation. Thanks for your submission.

But if you scroll web view , it also show select text .
The Adobe Reader App do it nice.i do not how he did .

Great! That link works like a charm. I merged the fix and bumped the version to v1.0.1.
What do you mean?

But if you scroll web view , it also show select text .

Adobe Reader App might not use a webview to show pdf, i think.

oh,
1.select text.
2.scroll the web view
and you will find that it's also select text again some times/

I could not reproduce this on my Nexus 7. Could you try it by current master?

yes.sometimes

Do you have msn or gmail ?

I have gmail. See my commit log.

oK.
I have sent a email .

Here is my code:
webview.loadDataWithBaseURL(null, "\n" +
"\n" +
"\n" +
"<meta charset="utf-8"/>\n" +
"<title>content</title>\n" +
"<link rel="stylesheet" href="css/sample.css"/>\n" +
"<script src='"+IOUtils.FILE_PATH_ARTICLES_JS_JQEURY+"'></script>\n" +
"<script src='"+IOUtils.FILE_PATH_ARTICLES_JS_JP+"'></script>\n" +
"<script src='"+IOUtils.FILE_PATH_ARTICLES_JS_RANGY+"'></script>\n" +
"<script src='"+IOUtils.FILE_PATH_ARTICLES_JS_RANGY_SER+"'></script>\n" +
"<script src='"+IOUtils.FILE_PATH_ARTICLES_JS_SEL+"'></script>\n" +
"" +
"" +
"

" +
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras pellentesque, dolor nec luctus ullamcorper, massa quam interdum metus, ac ultricies mauris risus nec purus. Fusce et nunc mi, ut consequat velit. Cras orci sapien, tincidunt sed iaculis ac, commodo sed neque. Sed gravida, quam id imperdiet venenatis, odio erat faucibus nisi, sed imperdiet velit nulla nec risus. Duis eget vehicula nibh. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec tincidunt, augue vitae feugiat cursus, nunc nunc volutpat ligula, ac molestie purus lectus sit amet mauris. Nunc nec felis tortor, a dignissim eros. Vivamus diam mauris, scelerisque molestie bibendum ut, dignissim quis neque. Aliquam ac turpis mi. Sed pretium interdum orci, sed semper lorem viverra id. Vivamus diam eros, convallis sit amet facilisis in, facilisis eget nibh. Aenean porttitor, neque nec ultrices laoreet, dolor metus cursus purus, non auctor lectus urna a enim. In nec lectus nunc, ac commodo arcu. Proin bibendum ligula non mi bibendum porta. Nam ac metus a magna tristique euismod eget vitae purus.\n" +
"

" +
"\n" +
"", "text/html", "utf-8", null);

(IOUtils.FILE_PATH_ARTICLES_JS_JQEURY :/sdcard/.../your js File name....)
But:
@OverRide
public void selectionChanged(String range, String text, String handleBounds, boolean isReallyChanged){
final Context ctx = mActivity;
try {
Log.e(TAG, "selectionChanged: "+text +" isReallyChanged"+isReallyChanged);

isReallyChanged always false.
Why ????
Do you know ?

Such as:
log: ..... E/SelectionSupport﹕ selectionChanged: sapien isReallyChanged:false

Strange...

er...
me too. I have use your html and run success . but my html not ok ,of course both them is the same html ,the only different is the js path .your html is android assets and my path is the sdcard path.
so ,guess,what's wrong with this ???
I have no idea about this ...

shell@grouper:/sdcard/..../..../js $ ls -a
android_selection.js
jpnnext.js
jquery.js
rangy_core.js
rangy_serializer.js

Is there any reason for setting js files in SD cards?
I actually used like this in my project.

Set js and css files in assets. And load like this.

webview.loadDataWithBaseURL(
    "file:///android_asset/", 
    "<?doctype html><html>...</html>",
    "text/html",
    "utf-8",
    "SOME_URL"
);

Fix it.
Thanks.

This resolution fixes selection bug on kitkat, but newly introduces another bug to froyo.
http://stackoverflow.com/questions/20391783/how-to-avoid-default-selection-on-long-press-in-android-kitkat-4-4
We should switch ACTION_UP logics by versions.

Fix it. @c6ba2c98408d4edbfec9b5c6d6e7627a170238a5