btate / btandroidwebviewselection Goto Github PK
View Code? Open in Web Editor NEWExample user selection for android web views.
Example user selection for android web views.
I have another problem: when I start the selection, the webview can be easily dragged horizontally even if I disabled the horizontal scrollbar.
Any idea how can I disable the drag of the webview itself and keep the drag for the selection.
Thank you again for all your effort.
Though default action of Webview is arrested by returning True on onTouchListener, along with BTWebView Text selection , default text selection is also gets enabled.Please help to resolve this
Hi
I downloaded your latest zip and ran the code directly on my device. The activity with latin text pops up, but no selection is possible.
I cannot see any errors in Eclipse.
Any ideas?
Thanks
I'm trying to load a epub file BTWebView by using loadDataWithBaseURL method. my code is:
Book book = (new EpubReader()).readEpub(epubInputStream);
String baseUrl=Environment.getExternalStorageDirectory().toString()+"/lohqalam/epub/";
String data = new String(book.getContents().get(0).getData());
this.loadDataWithBaseURL(baseUrl, data, "text/html", "UTF-8", null);
after the file gets load selection not working!
how can I fix that??
hy,
I would like to thank u for this excellent webview selection, saved my life.
but I'm facing a small issue with the import.
When I use loadDataWithBaseURL the javascript import is not working,
any idea why?
I need to use loadDataWithBaseURL cause I'm making some modification to the html before loading it.
Thank u in advance for your time,
Good Day,
I have successfully executed this sample project using Eclipse, but i have this problem... When I add a simple button in the html file provided and attach an event to that button(I would like to call a javascript function), the javascript is not triggering.
Also, I tried to call a javascript function inside the BTWebView
class at the OnActionItemClickListener
whenever an item is clicked, calling a javascript using this:
this.loadUrl("javascript: testFunction();"); but it's not triggering.
Hope to hear from you Soon.
Hi,
First of all I really appreciate the hard work as this is a very nice tool which we have been using in our app.
But the selection seems not to work on Samsung Tab since the default behaviour on the samsung devices is to show their own text selection tool which has copy search and other menu items and hence I am unable to use the custom text selection on the device. Any help or advice would be really appreciated as any workaround is not working too well for me.
The selection project stops working as we load a dynamic web page. It does not perform any action on the long click. What i did : I just made some changes
Hi,
I've tested sample app on Samsung Galaxy Tab (GT-P1000) with stock Android 2.2. Selection doesn't work.
Any ideas/fixes?
Thanks,
Alex
Problem in loading Arabic content BTAndroidWebView
very good work with this library!
Is there a way to get the html source of the highlighted text?
Hi,
this is an excellent work for selecting the text and highlighting the text in android webview
but
When i use these two below functions in the WebView
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView selection not selecting the text in the correct position where we select?
Hi,
first - good work! That's what I need.
I wan't to highlight after click in menu - and it works perfectly on the emulator.
On my galaxy S3 there comes a lot of errors - like JSError: selectionChanges - TypeError: cannot read property lef or "SPAN EXCLUSIVE_EXCLUSIVE spans cannot have a zero length" or "JSError: longTouch - TypeError: Cannot cal method 'expand' of null".
Is there a solution?
iam try to use your example and i want
this.loadUrl(filePath); to change this.loadData(PAGE_HTML, "text/html","utf-8") -- PAGE_HTML is sample data and its look like
<html>
<head>
<script src='jquery.js'></script>
<script src='rangy-core.js'></script>
<script src='rangy-serializer.js'></script>
<script src='android.selection.js'></script>
</head>
<body>
<p> 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.</p>
</body>
</html>
bt now pop up window is not working , pls help binush4u@gmail
I want to have the text actively highlight text as I drag my finger, like native text selection works.
Hy, I'm applying the selection on a webview which is put horizontally, so I scroll over the webview horizontally to go from a page to another. when I want to make the selection the drag handlers show only on the first page but do not show on the others, while the quickAction popupwindow and the actual selection show everywhere. I tried to manipulate the x of startParams in drawSelectionHandlesHandler I decrease it by the screen width so it can show on the next page, but still not working.
when I apply createSelectionLayer(context) the context given is the one of the webview, I was wondering if there is a way to give the context of the parentLayer where the webview is initialized.
Any suggestion or hint would be appreciated,
Thanks in advance!
Hi,
This is a amazing work in android webview. Thanks for the effort. Presently I am try to make a selection in webview and save it in the android DB. I am able to save the serialized string from your code but I am not able to deserialize the string. I am getting this error
"Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1"
when I call the rangy.deserialize(selectedrange).
Please help me to save and highlight the text in webview by using your excellent idea.
Thank You,
Abu Saad Papa
Hello there,
i am facing trouble with lollipop device as when i try to select text from webView it shows CAB as well on top with Contextual Menu above selected text. Even it shows double selection draggers as well.
Please help me out with it
Thanks,
First off thanks for the WebView, it works brilliantly.
I have however tried it with an older phone and cannot see the cursor within the webview, nor can I see text being highlighted on selection.
Is this a known issue? Am I doing something wrong?
Matt
thank you for this project ,In my case i should load the javascript files dynamically after loading the html page instead of writing the script tag directly in the html file but i have problem with jquery.js an error message "undefined" on the log .
this is a sample of code :
this.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url)
{
/* This call inject JavaScript into the page which just finished loading. */
Log.d("call","call java script");
loadUrl("javascript:(function() { "
+
"var script=document.createElement('script');" +
"script.type='text/javascript';" +
"script.src='file:///android_asset/jquery.js';"
+
"document.getElementsByTagName('head').item(0).appendChild(script);"+
"})()");
....
}
please help me .
}
);
If used on a device that is not in English metrics, float
values are represented by commas and not dots, i.e. 302.2
will appear as 302,2
in French for example.
This causes all call to javascript methods with float
values to fail, for example:
android.selection.startTouch(100,00000, 20,00000);
A way to make this work in all cases would be to surround float
values by single quotes:
android.selection.startTouch('100,00000', '20,00000');
and parse them to float
in the javascript methods (parseFloat(value)
)
Hello,
Nice job done by the developer which allows us to use maximum functionality on webView content. I have only one complain that when i try to select text, selection area gets updated so slowly as it shows effect after drag end. Even this thing is happening on your demo project as well.
Can you please advise what this OSS is licensed under?
Thank you and Best Regards,
Wei
Hi
I'm going to select text in pages which contains tags like IMG and during selection i face below error:
at android.view.WindowManager$BadTokenExcpetion: Unable to add windows -- token null is not valid.
How can i handle this?
i tried
web.evaluateJavascript("javascript:android.selection.getRange();", new ValueCallback() {
@OverRide
public void onReceiveValue(String value) {
Log.e("text",value);
}
});
cant able to select the test
E/text﹕ null
W/art﹕ Suspending all threads took: 36.414ms
p W/cr.BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 7138
I/BTWebView﹕ scale 2.0
I/chromium﹕ [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'startTouch' of undefined", source: (1)
W/cr.BindingManager﹕ Cannot call determinedVisibility() - never saw a connection for the pid: 7138
I/BTWebView﹕ scale 2.0
p determinedVisibility() - never saw a connection for the pid: 7138
/chromium﹕ [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'startTouch' of undefined", source: (1)
I/chromium﹕ [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'longTouch' of undefined", source: (1)
I/chromium﹕ [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'apdAdmin' of null", source: (1)
I/chromium﹕ [INFO:CONSOLE(12)] "Uncaught TypeError: $(...).sidr is not a function", source: http://m.hindustantimes.com/res/mobile/js/customStories.js (12)
I/chromium﹕ [INFO:CONSOLE(570)] "Uncaught TypeError: $(...).easyResponsiveTabs is not a function", source: http://m.hindustantimes.com/india/pak-appeals-to-us-to-play-role-in-resolving-kashmir-issue/story-JC4RUWw7maxRpXJqnidg1J.html (570)
Hi,
Selection not working when we add setZoomSupport enabled, when we make pinch zoom and select the text its not working. if we don't add zoomSupport enabled then everything works fine
Thanks,
Suriya
i am working with btwebview to get the selected word but here problem is after some zoom i.e height and width params change but it is not selecting properly like i select somewhere and it goes anywhere
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.