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

Commit

Permalink
[android] #5237 - Adding InfoWindow Title and Snippet to DynamicMarke…
Browse files Browse the repository at this point in the history
…r as it's test case
  • Loading branch information
bleege committed Jun 6, 2016
1 parent b711979 commit bc0b238
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public void setPosition(LatLng position) {
}
}

void setSnippet(String snippet) {
public void setSnippet(String snippet) {
this.snippet = snippet;
}

Expand All @@ -112,7 +112,7 @@ public Icon getIcon() {
return icon;
}

void setTitle(String title) {
public void setTitle(String title) {
this.title = title;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;

import com.mapbox.mapboxsdk.annotations.IconFactory;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
Expand Down Expand Up @@ -58,12 +57,13 @@ public void onMapReady(@NonNull MapboxMap mapboxMap) {
// Create marker
MarkerOptions markerOptions = new MarkerOptions()
.position(LAT_LNG_CHELSEA)
.icon(mIconFactory.fromResource(R.drawable.ic_chelsea));
.icon(mIconFactory.fromResource(R.drawable.ic_chelsea))
.title(getString(R.string.dynamic_marker_chelsea_title))
.snippet(getString(R.string.dynamic_marker_chelsea_snippet));
mMarker = mapboxMap.addMarker(markerOptions);
}
});


FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setColorFilter(ContextCompat.getColor(this, R.color.primary));
fab.setOnClickListener(new View.OnClickListener() {
Expand All @@ -84,6 +84,8 @@ private void updateMarker() {
// update marker
mMarker.setPosition(first ? LAT_LNG_CHELSEA : LAT_LNG_ARSENAL);
mMarker.setIcon(mIconFactory.fromResource(first ? R.drawable.ic_chelsea : R.drawable.ic_arsenal));
mMarker.setTitle(first ? getString(R.string.dynamic_marker_chelsea_title) : getString(R.string.dynamic_marker_arsenal_title));
mMarker.setSnippet(first ? getString(R.string.dynamic_marker_chelsea_snippet) : getString(R.string.dynamic_marker_arsenal_snippet));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,9 @@

<string name="geocoder_instructions">Tap Map To Geocode Where Black Marker Is Currently Located</string>

<string name="dynamic_marker_chelsea_title">Chelsea</string>
<string name="dynamic_marker_chelsea_snippet">Stamford Bridge</string>
<string name="dynamic_marker_arsenal_title">Arsenal</string>
<string name="dynamic_marker_arsenal_snippet">Emirates Stadium</string>

</resources>

0 comments on commit bc0b238

Please sign in to comment.