Skip to content

Commit aeddc24

Browse files
authored
Update Stylesheets (#465)
* migrate all styles to use themed repos * fix tests and temporarily comment out two * tmp deploy sdk for this branch * update style switcher example * deploy samples temporarily * disable location in sample on destroy * tangram 0.8.1 * refill default lod 10 * autoselect theme defaults when style switched * yaml generator cleanup * update zinc lod default * update test * https for submodules * fix MapInitializerTests * add test coverage for themes * rm tmp circle branch deployment * deprecate zinc style * rm log
1 parent 5a841de commit aeddc24

37 files changed

+844
-106
lines changed

.gitmodules

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
[submodule "core/src/main/assets/styles/bubble-wrap"]
22
path = core/src/main/assets/styles/bubble-wrap
33
url = https://github.com/tangrams/bubble-wrap.git
4-
[submodule "core/src/main/assets/styles/cinnabar-more-labels"]
5-
path = core/src/main/assets/styles/cinnabar-more-labels
6-
url = https://github.com/tangrams/cinnabar-style-more-labels.git
7-
[submodule "core/src/main/assets/styles/walkabout-style-more-labels"]
8-
path = core/src/main/assets/styles/walkabout-style-more-labels
9-
url = https://github.com/tangrams/walkabout-style-more-labels.git
10-
[submodule "core/src/main/assets/styles/zinc-style-more-labels"]
11-
path = core/src/main/assets/styles/zinc-style-more-labels
12-
url = https://github.com/tangrams/zinc-style-more-labels.git
134
[submodule "samples/mapzen-android-sdk-sample/src/main/assets/styles/tron-style"]
145
path = samples/mapzen-android-sdk-sample/src/main/assets/styles/tron-style
156
url = https://github.com/tangrams/tron-style.git
167
[submodule "core/src/main/assets/styles/refill-style"]
178
path = core/src/main/assets/styles/refill-style
189
url = https://github.com/tangrams/refill-style
10+
[submodule "core/src/main/assets/styles/cinnabar-style"]
11+
path = core/src/main/assets/styles/cinnabar-style
12+
url = https://github.com/tangrams/cinnabar-style.git
13+
[submodule "core/src/main/assets/styles/walkabout-style"]
14+
path = core/src/main/assets/styles/walkabout-style
15+
url = https://github.com/tangrams/walkabout-style.git

core/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ group = GROUP
1919
version = VERSION_NAME
2020
project.archivesBaseName = POM_ARTIFACT_ID
2121

22-
ext.tangram_version = "0.8.0"
22+
ext.tangram_version = "0.8.1"
2323

2424
def SDK_VERSION = hasProperty('version') ? '"' + version + '"' : "null";
2525

@@ -64,7 +64,7 @@ task checkstyle(type: Checkstyle) {
6464
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
6565

6666
task submodules {
67-
def folder = new File( 'core/src/main/assets/styles/walkabout-style-more-labels/walkabout-style-more-labels.yaml' )
67+
def folder = new File( 'core/src/main/assets/styles/walkabout-style/walkabout-style.yaml' )
6868
if(!folder.exists()) {
6969
throw new GradleException("Submodules aren't present, please run:\n`git submodule init`, " +
7070
"\n`git submodule update`\nfrom your root directory")
Lines changed: 0 additions & 1 deletion
This file was deleted.
Submodule cinnabar-style added at 079418b
Submodule walkabout-style added at 291d90a
Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 0 additions & 1 deletion
This file was deleted.

core/src/main/java/com/mapzen/android/graphics/ImportYamlGenerator.java

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import com.mapzen.android.graphics.model.ThemeColor;
44
import com.mapzen.android.graphics.model.ThemedMapStyle;
55

6+
import static com.mapzen.android.graphics.model.ThemedMapStyle.NONE;
7+
68
/**
79
* Handles creating fully qualified import yaml for a given {@link ThemedMapStyle} so that
810
* it can be applied by {@link MapzenMap}.
@@ -17,26 +19,45 @@ class ImportYamlGenerator {
1719
*/
1820
String getImportYaml(ThemedMapStyle themedMapStyle, int labelLevel, int detailLevel,
1921
ThemeColor color) {
20-
String labelFileName = new StringBuilder()
21-
.append("label-")
22-
.append(labelLevel)
23-
.append(".yaml")
24-
.toString();
25-
String detailFileName = new StringBuilder()
26-
.append("detail-")
27-
.append(detailLevel)
28-
.append(".yaml")
29-
.toString();
30-
String colorFileName = new StringBuilder()
31-
.append("color-")
32-
.append(color.toString())
33-
.append(".yaml")
34-
.toString();
35-
return "{ import: [ "
36-
+ themedMapStyle.getBaseStyleFilename() + ", "
37-
+ themedMapStyle.getThemesPath() + labelFileName + ", "
38-
+ themedMapStyle.getThemesPath() + detailFileName + ", "
39-
+ themedMapStyle.getThemesPath() + colorFileName
40-
+ " ] }";
22+
StringBuilder importBuilder = new StringBuilder()
23+
.append("{ import: [ ")
24+
.append(themedMapStyle.getBaseStyleFilename())
25+
.append(", ");
26+
27+
if (labelLevel != NONE) {
28+
importBuilder.append(themedMapStyle.getThemesPath());
29+
importBuilder.append("label-");
30+
importBuilder.append(labelLevel);
31+
importBuilder.append(".yaml");
32+
}
33+
34+
if (labelLevel != NONE && (detailLevel != NONE || colorExists(color))) {
35+
importBuilder.append(", ");
36+
}
37+
38+
if (detailLevel != NONE) {
39+
importBuilder.append(themedMapStyle.getThemesPath());
40+
importBuilder.append("detail-");
41+
importBuilder.append(detailLevel);
42+
importBuilder.append(".yaml");
43+
}
44+
45+
if (detailLevel != NONE && colorExists(color)) {
46+
importBuilder.append(", ");
47+
}
48+
49+
if (colorExists(color)) {
50+
importBuilder.append(themedMapStyle.getThemesPath());
51+
importBuilder.append("color-");
52+
importBuilder.append(color.toString());
53+
importBuilder.append(".yaml");
54+
}
55+
56+
importBuilder.append(" ] }");
57+
return importBuilder.toString();
58+
}
59+
60+
private boolean colorExists(ThemeColor color) {
61+
return color != null && color != ThemeColor.NONE;
4162
}
4263
}

0 commit comments

Comments
 (0)