IITC-CE / ingress-intel-total-conversion

intel.ingress.com total conversion user script with some new features. Should allow easier extension of the intel map.
https://iitc.app
ISC License
285 stars 110 forks source link

Screenshots has no portal and links #140

Closed uryevich closed 4 years ago

uryevich commented 5 years ago

In mobile version, when sharing screenshot with map view, there is no portal circles and links/fields on a result image. Portal names if it turned on in plugins appears.

johnd0e commented 5 years ago

Stock iitc also suffers from this problem in canvas rendering mode. And iitc-ce has canvas by default..

May be there is a bug in WebView (https://stackoverflow.com/questions/30223117/draw-webview-into-a-canvas-in-android-l).

johnd0e commented 5 years ago

Notes:

May be it's possible to fix getDrawingCache for canvas (I saw some posts at stackoverflow) Or use some other api. I saw these was recommended (among others):

@modos189 , could you look at this?

modos189 commented 5 years ago

I can try, but have little experience in Android development.

modos189 commented 5 years ago

I replaced deprecated getDrawingCache to Canvas https://github.com/IITC-CE/ingress-intel-total-conversion/commit/347fee00e9497c4c710d6cf09f588709152a7439

But in screenshots there are no portals for another reason. We need to disable hardware acceleration to have access to the portals and links. https://github.com/IITC-CE/ingress-intel-total-conversion/commit/bfb1a94fdd32e3a4ea2c7825d5235e98a739c64e

If we do this, it will return the speed of the IITC to SVG.

I'll try to take a screenshot using JavaScript. If it does not work, I propose to remove function of creating screenshots.

johnd0e commented 5 years ago

We can remove screenshot sharing until solution not found. I believe such base functionality should be possible, we just need find proper way.

May be portals not shown because it is needed to capture them in some particular moment? Isn't onDraw related? https://stackoverflow.com/questions/20942623/which-can-replace-capturepicture-function/20963109#20963109 https://stackoverflow.com/questions/19856832/how-to-use-ondrawcanvas-to-obtain-a-bitmap-snapshot-of-the-webviewandroid

Edit As per [enableSlowWholeDocumentDraw](https://developer.android.com/reference/android/webkit/WebView.html#enableSlowWholeDocumentDraw()) documentation: using onDraw we still need enableSlowWholeDocumentDraw...

johnd0e commented 5 years ago

After googling I found almost nothing promising.. (But I still want to mention that there was advise recommending using of TextureView, and another: use page print).

johnd0e commented 5 years ago

If it does not work, I propose to remove function of creating screenshots.

I'd would not remove function completely, as someone still have the possibility to disable preferCanvas option (for some reason).