mattprecious / telescope

A simple tool to allow easy bug report capturing within your app.
Apache License 2.0
1.18k stars 116 forks source link

Bitmap Processor support #22

Closed tasomaniac closed 8 years ago

tasomaniac commented 9 years ago

What I did was to split capturing of the screenshot and saving it. onCapture with Bitmap parameter is called first in the Lens. Possible bitmap transformations can be made in that method. After the operation finishes, onBitmapReady method of BitmapProcessorListener will be called. The default implementation does nothing and just calls onBitmapReady.

This processing operation can take long. That's why I did it like this to inform TelescopeLayout to continue the operation when it finishes. While this operation continues, capturing is kept true and all the screen touch events are ignored.

I don't like introducing new classes into other people's libraries. Sorry about that.

This worked for me for my Google Maps screenshot problem. I opened the PR to discuss it. I also want to create Maps Activity in the sample to demonstrate it.

Thank you for the great library. Thank you for taking time to review this.

tasomaniac commented 9 years ago

Rebased this to the latest master branch to see the successful build on Travis. :)

mattprecious commented 9 years ago

I'm not too fond of the complete breakage of the API like this.

I finally got around to taking a look at what another team was doing internally to solve the maps problem and their solution was to extend from TelescopeLayout and to override getDrawingCache() which is where they put the tweaks/workarounds for the map view. Is this a reasonable solution for you? What are you doing in the processing step that takes a long time?

tasomaniac commented 9 years ago

The changes actually doesn't break the API. The only breakage is for custom Lens users. They only need to change 'implements' to 'extends' and will be fine.

GoogleMaps's snapshot function works async. That is the limitation. I wonder how they just override it.

mattprecious commented 8 years ago

Thanks! Looking forward to the sample.