Giter Club home page Giter Club logo

btandroidwebviewselection's People

Contributors

btate avatar netomin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btandroidwebviewselection's Issues

Select text in complext web pages

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?

How to Deserialize the selected Range?

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

Selection not working Perfectly

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?

Selection Problem on using loadDataWithBaseURL to load data

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??

CAB comes up context menu as well in lollipop device

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,

import js files

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,

Selection works Very Slow

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.

License?

Can you please advise what this OSS is licensed under?

Thank you and Best Regards,

Wei

Add support for localization

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 floatvalues by single quotes:

android.selection.startTouch('100,00000', '20,00000');

and parse them to float in the javascript methods (parseFloat(value))

drag handlers not showing on next page

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!

Selection not working on Samsung Galaxy Tab2

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.

load Data method is not working

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

drag webview

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.

Javascript call from WebView to Android and Vice Versa

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.

cursor not visible with gingerbread.

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

I dont know how to use BTAndroidWebView i tried BTWebView bt=new BTWebView(this);

i tried

BTWebView web=new BTWebView(this);


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)

Not working on Galaxy S3

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?

Not Properly working in Android KItkat

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

jquery is not working when loading dynamically

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 .
}

    );

Not working as the data loaded from a web address.

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

  1. BtWebView.java : in setup() changed the line : this.loadUrl("http://www.google.com") and run the project after giving the network permissions. It loads the web page and then I tried to select the text then found that nothing happen after the long touch event.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.