diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2018-09-25 10:56:57 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-09-25 14:53:30 +0200 |
commit | 18f6e5a34e12771d6d65afb58e148006693c5fd0 (patch) | |
tree | 7b510c7fd2ca1f7263368709f12b371189b573c8 /platform | |
parent | c713d2202d5a3e4db5f2135f6e6d566393373967 (diff) | |
download | qtlocation-mapboxgl-18f6e5a34e12771d6d65afb58e148006693c5fd0.tar.gz |
[android] - update custom sprite example with iconAllowOverlap and iconIgnorePlacement
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java index 30cb0a8660..e5b98ff63e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java @@ -22,32 +22,35 @@ import com.mapbox.mapboxsdk.testapp.R; import timber.log.Timber; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconIgnorePlacement; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; /** * Test activity showcasing adding a sprite image and use it in a Symbol Layer */ public class CustomSpriteActivity extends AppCompatActivity { + private static final String CUSTOM_ICON = "custom-icon"; + private GeoJsonSource source; private MapboxMap mapboxMap; private MapView mapView; private Layer layer; - private GeoJsonSource source; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_sprite); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(map -> { mapboxMap = map; - final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + final FloatingActionButton fab = findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(CustomSpriteActivity.this, R.color.primary)); fab.setOnClickListener(new View.OnClickListener() { + private Point point; @Override @@ -69,7 +72,9 @@ public class CustomSpriteActivity extends AppCompatActivity { layer = new SymbolLayer("layer", "point"); layer.setProperties( // Set the id of the sprite to use - iconImage(CUSTOM_ICON) + iconImage(CUSTOM_ICON), + iconAllowOverlap(true), + iconIgnorePlacement(true) ); // lets add a circle below labels! |