BTAndroidWebViewSelection-master

所属分类:编辑器/阅读器
开发工具:Others
文件大小:170KB
下载次数:1
上传日期:2016-07-28 14:28:07
上 传 者xjlv
说明:  电子书阅读器电子书阅读器电子书阅读器电子书阅读器电子书阅读器电子书阅读器
( E-book reader)

文件列表:
.project (831, 2014-08-20)
AndroidManifest.xml (803, 2014-08-20)
assets (0, 2014-08-20)
assets\android.selection.js (7188, 2014-08-20)
assets\content.html (6829, 2014-08-20)
assets\jquery.js (249159, 2014-08-20)
assets\rangy-core.js (42351, 2014-08-20)
assets\rangy-serializer.js (4340, 2014-08-20)
proguard.cfg (1248, 2014-08-20)
project.properties (361, 2014-08-20)
res (0, 2014-08-20)
res\anim (0, 2014-08-20)
res\anim\disappear.xml (259, 2014-08-20)
res\anim\grow_from_bottom.xml (509, 2014-08-20)
res\anim\grow_from_bottomleft_to_topright.xml (506, 2014-08-20)
res\anim\grow_from_bottomright_to_topleft.xml (521, 2014-08-20)
res\anim\grow_from_top.xml (507, 2014-08-20)
res\anim\grow_from_topleft_to_bottomright.xml (506, 2014-08-20)
res\anim\grow_from_topright_to_bottomleft.xml (520, 2014-08-20)
res\anim\pump_bottom.xml (509, 2014-08-20)
res\anim\pump_top.xml (507, 2014-08-20)
res\anim\rail.xml (199, 2014-08-20)
res\anim\shrink_from_bottom.xml (507, 2014-08-20)
res\anim\shrink_from_bottomleft_to_topright.xml (520, 2014-08-20)
res\anim\shrink_from_bottomright_to_topleft.xml (506, 2014-08-20)
res\anim\shrink_from_top.xml (509, 2014-08-20)
res\anim\shrink_from_topleft_to_bottomright.xml (522, 2014-08-20)
res\anim\shrink_from_topright_to_bottomleft.xml (508, 2014-08-20)
res\drawable-hdpi (0, 2014-08-20)
res\drawable-hdpi\ic_launcher.png (4147, 2014-08-20)
res\drawable-hdpi\selection_handle.png (3634, 2014-08-20)
res\drawable-ldpi (0, 2014-08-20)
res\drawable-ldpi\ic_launcher.png (1723, 2014-08-20)
res\drawable-ldpi\selection_handle.png (1488, 2014-08-20)
res\drawable-mdpi (0, 2014-08-20)
res\drawable-mdpi\ic_launcher.png (2574, 2014-08-20)
res\drawable-mdpi\selection_handle.png (2107, 2014-08-20)
... ...

I've Seen a lot of people trying to get user selections with a context menu working in Android web views. The problem lies in Android's use of an intermediate text view that it places between the user and the web view on selection. So the javascript in the page doesn't know what's selected.

This solution uses a javascript interface to pass touches to the page and effectively cut Android's native selection out of the equation. This has been tested from 2.2 to 4.0.3.

The example uses an html page in the assets folder with the javascript methods included. The BTWebView class implements the interface methods necessary to draw the selection layer with the handles and show the context menu. Any content you wish to use this with will need the following javascript imports.

    <script src='jquery.js'></script>
	<script src='rangy-core.js'></script>
	<script src='rangy-serializer.js'></script>
	<script src='android.selection.js'></script>

This solution employs a few libraries that deserve recognition.

  1. The rangy javascript library by Tim Down.
  2. A wonderful drag and drop library by Bill Lahti.
    *Note: The version of this library included in this project has been slightly modified.
  3. The Quick Action library by Lorensius Londa.
    *Note: The version of this library included in this project has been slightly modified.

This project is freely available for use.


近期下载者

相关文件


收藏者