mapbox-gl-native icon indicating copy to clipboard operation
mapbox-gl-native copied to clipboard

[Android] Setting logo/attribution visibility bug

Open mpuchala opened this issue 10 years ago • 4 comments

Probably there is a bug when you set logo/attribution visibility in attributes (xml layout file).

Here those two views are invisible:

<com.mapbox.mapboxsdk.maps.MapView
    android:background="@color/map_background"
    android:id="@+id/map_view"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    app:attribution_visibility="visible"
    app:compass_enabled="false"
    app:logo_visibility="visible"
    app:my_location_enabled="true"
    app:rotate_enabled="false" />

When I set logo or attribution to gone/invisible it appears on map.

mpuchala avatar Mar 14 '16 16:03 mpuchala

Thanks for the report, picking this up asap.

tobrun avatar Mar 14 '16 18:03 tobrun

Found the bug, we are exposing the attrs as

    <attr name="logo_visibility">
            <enum name="visible" value="0x0" />
            <enum name="invisible" value="0x4" />
            <enum name="gone" value="0x8" />
        </attr>

while the SDK resolves this as a boolean:

mapboxMapOptions.logoEnabled(typedArray.getBoolean(R.styleable.MapView_logo_visibility, true));

Since the SDK exposes:

 /**
     * <p>
     * Enables or disables the Mapbox logo.
     * </p>
     * By default, the compass is enabled.
     *
     * @param enabled True to enable the logo; false to disable the logo.
     */
    public void setLogoEnabled(boolean enabled) {
        logoSettings.setEnabled(enabled);
        mapView.setLogoEnabled(enabled);
    }

I'm going to change the attrs to take in account and change the name from visibility to enabled.

tobrun avatar Mar 14 '16 18:03 tobrun

This will be fixed on the release branch here

tobrun avatar Mar 14 '16 20:03 tobrun

Merged with https://github.com/mapbox/mapbox-gl-native/commit/e04fea8409714c6c4c055b95ddfc67122a2b860d. Closing.

tobrun avatar Mar 14 '16 20:03 tobrun