Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Preview image in Android Studio layout editor #9480

Closed
tobrun opened this issue Jul 12, 2017 · 6 comments
Closed

Preview image in Android Studio layout editor #9480

tobrun opened this issue Jul 12, 2017 · 6 comments
Labels
Android Mapbox Maps SDK for Android archived Archived because of inactivity

Comments

@tobrun
Copy link
Member

tobrun commented Jul 12, 2017

To support the visual layout editor in Android Studio. We currently package a preview image inside our SDK. This image isn't used at runtime and it's currently growing the resulting .aar file. We should look into hosting this image online and only download it when the visual layout editor is shown to the developer.

The preview image can be found here

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Jul 12, 2017
@Guardiola31337
Copy link
Contributor

We should consider using the new @sample resource type included in Android Studio 3.0 as an option to tackle this one.

@tobrun tobrun changed the title Replace preview image asset with online resource Preview image in Android Studio layout editor Aug 1, 2017
@tobrun
Copy link
Member Author

tobrun commented Aug 1, 2017

I tried running with approach in OP but the IDE isn't able to perform network requests for content in the layout editor. For now I removed integration in #9657 (the preview image is taking up too much space in the aar). Let's wait until AS 3.0 is released with the @sample integration as mentioned in #9480 (comment)

@Guardiola31337
Copy link
Contributor

Have you ever tried creating a custom layout which loads the preview image when isInEditMode()? i.e. something like this:

public class CustomView extends View {
    public CustomView(Context ctx) {
        super(ctx);
	if(isInEditMode()) {
            loadResourceUrl();	
	}
    }
}

☝️ could be another solution ¯\_(ツ)_/¯

@tobrun
Copy link
Member Author

tobrun commented Aug 2, 2017

yes, see #9480 (comment)

@1ec5
Copy link
Contributor

1ec5 commented Aug 8, 2017

How much of a size increase would be acceptable for this feature? I noticed that the previously bundled preview images are JPEGs, whereas PNG or GIF would be more efficient representations of Streets style screenshots. Perhaps we could even switch to a less busy style like Light or Dark, or come up with a more abstract, stylized representation that could be represented as a vector drawable, to further reduce the file sizes?

@stale
Copy link

stale bot commented Dec 1, 2018

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Dec 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android archived Archived because of inactivity
Projects
None yet
Development

No branches or pull requests

3 participants