bugshaker-android icon indicating copy to clipboard operation
bugshaker-android copied to clipboard

Refactor map bitmap integration code to properly handle multiple, possibly overlapping, maps

Open stkent opened this issue 9 years ago • 0 comments

Currently, I don't believe the library will produce accurate representations of activities that contain multiple and/or overlapping MapView instances. The fix shouldn't be too hard, but the priority is probably also pretty low (the cases described are probably pretty rare).

Here are some notes on this task:

  • Does the MapScreenshotProvider function BITMAP_COMBINING_FUNCTION do what we think it does?
private static final Func2<Bitmap, List<LocatedBitmap>, Bitmap> BITMAP_COMBINING_FUNCTION
        = new Func2<Bitmap, List<LocatedBitmap>, Bitmap>() {
            @Override
            public Bitmap call(
                    final Bitmap baseLocatedBitmap,
                    final List<LocatedBitmap> overlayLocatedBitmaps) {

                final Canvas canvas = new Canvas(baseLocatedBitmap);

                for (final LocatedBitmap locatedBitmap : overlayLocatedBitmaps) {
                    final int[] overlayLocation = locatedBitmap.getLocation();

                    canvas.drawBitmap(
                            locatedBitmap.getBitmap(),
                            overlayLocation[0],
                            overlayLocation[1],
                            MAP_PAINT);
                }

                return baseLocatedBitmap;
            }
};

In particular, once we've combined the first map bitmap with the base bitmap, I'm not sure that any other map bitmaps that may overlay the first map bitmap will be visible?

  • Does the MapScreenshotProvider getMapViewBitmapsObservable method preserve view hierarchy ordering?

Probable plan of attack: lay out all map bitmaps on a separate screen-sized bitmap first, being careful to match view hierarchy layering; then combine this result with the non-map views bitmap.

stkent avatar Mar 01 '16 16:03 stkent