is it possible to intercept and apply some custom effects/color correction before android webview's gets rendered on the screen. I want the web-view to stay responsive to touch interactions after applying the effects.
Asked
Active
Viewed 1,654 times
2
-
yes.. possible you have to inject your javascript file to the rendering page.. – Dinesh Kannan Apr 22 '15 at 12:30
-
@user1992200 can you please elaborate a bit with a link if available? – thunderbird Apr 22 '15 at 12:46
-
refer here http://stackoverflow.com/questions/21552912/android-web-view-inject-local-javascript-file-to-remote-webpage in the local script file should contain the java script code to modify the corrections – Dinesh Kannan Apr 22 '15 at 12:51
-
you can also use view.loadUrl("javascript:" +"function{ //your code };") .. – Dinesh Kannan Apr 22 '15 at 12:53
-
what i want to do is apply some sort of custom image processing effect to whatever is rendered on the webview – thunderbird Apr 22 '15 at 12:54
-
custom image processing means ?.. modifying properties of dom elements.. ? – Dinesh Kannan Apr 22 '15 at 12:57
-
something like this http://www.felixjones.co.uk/neo%20website/Android_View/ but with all the touch interactions – thunderbird Apr 22 '15 at 12:58
-
no it could not be done with js injection .. i think the link you provided is purely based on presenting webviews in 3d ... – Dinesh Kannan Apr 22 '15 at 13:03
1 Answers
3
Inherit your class from WebView
, override OnDraw
method. See this answer for an example: Override onDraw to change how the drawing occurs (Android)

Community
- 1
- 1

Mikhail Naganov
- 6,643
- 1
- 26
- 26
-
that was my first guess but somewhere on here i read onDraw wont be of much help and that completely dissuaded me from trying it..i will try it tomorrow and let you know how it works. – thunderbird Apr 22 '15 at 18:45
-
Sorry for that! Drawing an html page is already an expensive task, so adding extra image processing without slowing everything down is not trivial. – Mikhail Naganov Apr 23 '15 at 08:41