mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

Logo and Attribution margin modifications not applied

Open ChristopheHochP opened this issue 3 years ago • 5 comments

Environment

  • Android OS version: v28 and v31
  • Devices affected: Samsung Note 8 and Pixel 6
  • Maps SDK Version: 10.7.0

Observed behavior and steps to reproduce

After first initialisation of the MapView, I found that any attempt to modify either the logo or attribution settings is not having any visual impact.

I tried the following with no success whatsoever:

// First attempt
mapView.attribution.updateSettings { marginBottom = 50f }
mapView.logo.updateSettings { marginBottom = 50f }

// Second attempt
mapView.attribution.marginBottom = 50f
mapView.logo.marginBottom = 50f

// Third attempt
mapView.attribution.apply { marginBottom = 50f }
mapView.logo.apply { marginBottom = 50f }

// Fourth attempt
mapView.apply {
  attribution.marginBottom = 50f
  logo.marginBottom = 50f
}

// Fifth attempt
mapView.apply {
  attribution.updateSettings { marginBottom = 50f }
  logo.updateSettings { marginBottom = 50f }
}

Expected behavior

My expectation would have been for the logo and attribution icon to move when the margin is changed.

Notes / preliminary analysis

Unfortunately I could not find many up to date example or documentation explaining how to use this feature, if maybe I did not did it right/

ChristopheHochP avatar Aug 25 '22 01:08 ChristopheHochP

@ChristopheHochP could you simply try updating properly directly, like mapView. logo. marginBottom = 50f? Although indeed it looks a bit strange that updateSettings is not working..

kiryldz avatar Aug 25 '22 08:08 kiryldz

Thank you @kiryldz for taking the time to reply to me message, it is much appreciated!

Unfortunately, I tried to directly update the property like you suggested and it did not changed anything on the map. However, I can conform that for all of my different attempt, if I call mapView.logo.getSettings(), I can see that my changes are properly recorded, they just do not end up changing the logo or attribution position on the map.

For the sake of completeness, I did tried as well to change the position property and then also change other margins, but without any success. For some reason it only works for me when I first initialise the map, but not afterward.

ChristopheHochP avatar Aug 25 '22 20:08 ChristopheHochP

@ChristopheHochP we do have sample activity that actually updates margins for all our ornaments when rotating the map - and it does work expected at least on my devices. Can you give it a try as well?

kiryldz avatar Aug 29 '22 08:08 kiryldz

Thanks for the suggestion @kiryldz , I tried using the same code and it still failed to make the logo or attribution move after the first initialisation.

The one difference in our code with the examples that I can see is that our class is actually extending MapView directly instead of extending AppCompatActivity. The reason is that we are integrating Mapbox into our own React Native application. I do not think this should be too much of a problem, since other plugins are updating correctly when we need them to.

ChristopheHochP avatar Aug 29 '22 21:08 ChristopheHochP

Thanks for the suggestion @kiryldz , I tried using the same code and it still failed to make the logo or attribution move after the first initialisation.

The one difference in our code with the examples that I can see is that our class is actually extending MapView directly instead of extending AppCompatActivity. The reason is that we are integrating Mapbox into our own React Native application. I do not think this should be too much of a problem, since other plugins are updating correctly when we need them to.

Well, if an example that does work for Android but does not work for React Native app - then for me it seems that the issue could be exactly in React Native setup 😄 Can you by chance try your code / our example code in pure Android example? I don't have experience with using our SDK with react native tbh so can't say anything for sure here.

kiryldz avatar Aug 31 '22 13:08 kiryldz

@ChristopheHochP were you able to get this resolved?

ZiZasaurus avatar Oct 24 '22 14:10 ZiZasaurus

Hi @ZiZasaurus, we abandoned for now and do not move the attribution and info icon on Android. We planned to check again in a few months. It's a shame, we have it working just fine on iOS and it is very smooth.

ChristopheHochP avatar Oct 24 '22 20:10 ChristopheHochP

Closing this ticket as it is specific to React Native. Please feel free to reach back out if you encounter this behavior within the native Maps SDK.

ZiZasaurus avatar Nov 14 '22 18:11 ZiZasaurus