Skip to content

Commit

Permalink
[android] Add missing satellite streets style to Android and iOS.
Browse files Browse the repository at this point in the history
As well as default_styles.cpp
Fixes mapbox#2739
Fixes mapbox#2740
  • Loading branch information
Leith Bade committed Oct 23, 2015
1 parent ec4aeba commit 82082d5
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,37 @@ public class Style {
/**
* Indicates the parameter accepts one of the values from {@link Style}.
*/
@StringDef({MAPBOX_STREETS, EMERALD, LIGHT, DARK, SATELLITE})
@StringDef({MAPBOX_STREETS, EMERALD, LIGHT, DARK, SATELLITE, SATELLITE_STREETS})
@Retention(RetentionPolicy.SOURCE)
public @interface StyleUrl {
}

// IMPORTANT: If you change any of these you also need to edit them in strings.xml

/**
* Mapbox Streets: Our signature style.
* Mapbox Streets: A complete basemap, perfect for incorporating your own data.
*/
public static final String MAPBOX_STREETS = "asset://styles/streets-v8.json";
/**
* Emerald: Great for transportation and outdoor terrain.
* Emerald: A versatile style, with emphasis on road networks and public transit.
*/
public static final String EMERALD = "asset://styles/emerald-v8.json";
/**
* Light: Light-colored style that is great for data overlay.
* Light: Subtle light backdrop for data visualizations.
*/
public static final String LIGHT = "asset://styles/light-v8.json";
/**
* Dark: Dark-colored style that is great for data overlay.
* Dark: Subtle dark backdrop for data visualizations.
*/
public static final String DARK = "asset://styles/dark-v8.json";
/**
* Satellite: The best-looking, most accurate, and most up-to-date satellite imagery available anywhere.
* Satellite: A beautiful global satellite and aerial imagery layer.
*/
public static final String SATELLITE = "asset://styles/satellite-v8.json";

/**
* Satellite Streets: Global satellite and aerial imagery with unobtrusive labels.
*/
public static final String SATELLITE_STREETS = "asset://styles/satellite-hybrid-v8.json";

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<public name="style_light" type="string" />
<public name="style_dark" type="string" />
<public name="style_satellite" type="string" />
<public name="style_satellite_streets" type="string" />

<public name="center_longitude" type="attr" />
<public name="center_latitude" type="attr" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
<string name="style_light">asset://styles/light-v8.json</string>
<string name="style_dark">asset://styles/dark-v8.json</string>
<string name="style_satellite">asset://styles/satellite-v8.json</string>
<string name="style_satellite_streets">asset://styles/satellite-hybrid-v8.json</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,11 @@ private boolean changeMapStyle(int id) {
mSelectedStyle = id;
return true;

case R.id.actionStyleSatelliteStreets:
mMapView.setStyle(Style.SATELLITE_STREETS);
mSelectedStyle = id;
return true;

default:
return false;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

<item android:id="@+id/mainActivityMenu"
android:title="@string/navdrawer_menu_title_mainactivity_controls">
<item
android:id="@+id/mainActivityMenu"
android:title="@string/navdrawer_menu_title_mainactivity_controls">
<menu>
<group>
<item
Expand All @@ -25,11 +26,11 @@

<group android:id="@+id/stylesSeparator" />

<item android:id="@+id/mainActivityStylesMenue"
<item
android:id="@+id/mainActivityStylesMenue"
android:title="@string/navdrawer_menu_title_mainactivity_styles">
<menu>
<group
android:id="@+id/stylesGroup">
<group android:id="@+id/stylesGroup">
<item
android:id="@+id/actionStyleMapboxStreets"
android:title="@string/styleMapboxStreets" />
Expand All @@ -50,6 +51,10 @@
android:id="@+id/actionStyleSatellite"
android:title="@string/styleSatellite" />

<item
android:id="@+id/actionStyleSatelliteStreets"
android:title="@string/styleSatelliteStreets" />

</group>
</menu>
</item>
Expand All @@ -68,9 +73,10 @@
-->


<group android:id="@+id/testsSeparator"/>
<group android:id="@+id/testsSeparator" />

<item android:id="@+id/testsMenu"
<item
android:id="@+id/testsMenu"
android:title="@string/navdrawer_menu_title_individual_tests">
<menu>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
</menu>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"></menu>
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<string name="styleLight">Light</string>
<string name="styleDark">Dark</string>
<string name="styleSatellite">Satellite</string>
<string name="styleSatelliteStreets">Satellite Streets</string>

<string-array name="outdoors_class_list">
<item>Day</item>
Expand Down
9 changes: 5 additions & 4 deletions ios/app/MBXViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
@"Light",
@"Dark",
@"Satellite",
@"Satellite-Hybrid",
];

static NSUInteger const kStyleVersion = 8;
Expand Down Expand Up @@ -445,16 +446,16 @@ - (void)mapView:(__unused MGLMapView *)mapView didChangeUserTrackingMode:(MGLUse
{
UIImage *newButtonImage;
NSString *newButtonTitle;

switch (mode) {
case MGLUserTrackingModeNone:
newButtonImage = [UIImage imageNamed:@"TrackingLocationOffMask.png"];
break;

case MGLUserTrackingModeFollow:
newButtonImage = [UIImage imageNamed:@"TrackingLocationMask.png"];
break;

case MGLUserTrackingModeFollowWithHeading:
newButtonImage = [UIImage imageNamed:@"TrackingHeadingMask.png"];
break;
Expand All @@ -463,7 +464,7 @@ - (void)mapView:(__unused MGLMapView *)mapView didChangeUserTrackingMode:(MGLUse
newButtonTitle = @"Course";
break;
}

self.navigationItem.rightBarButtonItem.title = newButtonTitle;
[UIView animateWithDuration:0.25 animations:^{
self.navigationItem.rightBarButtonItem.image = newButtonImage;
Expand Down
1 change: 1 addition & 0 deletions platform/default/default_styles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const std::vector<std::pair<std::string, std::string>> defaultStyles = {
{ "asset://styles/light-v8.json", "Light" },
{ "asset://styles/dark-v8.json", "Dark" },
{ "asset://styles/satellite-v8.json", "Satellite" }
{ "asset://styles/satellite-hyrid-v8.json", "Satellite Streets" }
};

} // end namespace util
Expand Down
2 changes: 1 addition & 1 deletion scripts/ios/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ cp -pv LICENSE.md "${OUTPUT}/static"
mkdir -p "${OUTPUT}/static/${NAME}.bundle"
cp -pv platform/ios/resources/* "${OUTPUT}/static/${NAME}.bundle"
mkdir -p "${OUTPUT}/static/${NAME}.bundle/styles"
cp -pv styles/styles/{dark,emerald,light,streets,satellite}-v8.json "${OUTPUT}/static/${NAME}.bundle/styles"
cp -pv styles/styles/{dark,emerald,light,streets,satellite,satellite-hybrid}-v8.json "${OUTPUT}/static/${NAME}.bundle/styles"

step "Creating API Docs..."
if [ -z `which appledoc` ]; then
Expand Down

0 comments on commit 82082d5

Please sign in to comment.