Skip to content
Browse files

More Checkstyle fixes

  • Loading branch information...
1 parent c9fee42 commit d27606740ef51a3ee2767e37aa57160329044b6e @f2prateek f2prateek committed
Showing with 862 additions and 834 deletions.
  1. +176 −176 MapBox.xml
  2. +146 −144 MapboxAndroidSDK/build.gradle
  3. +3 −3 MapboxAndroidSDK/src/main/AndroidManifest.xml
  4. +8 −6 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/format/GeoJSON.java
  5. +7 −6 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/overlay/GeoJSONLayer.java
  6. +1 −1 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/tileprovider/constants/TileLayerConstants.java
  7. +2 −1 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/tileprovider/tilesource/MapboxTileLayer.java
  8. +1 −4 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
  9. +2 −2 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapViewScaleGestureDetectorListener.java
  10. +2 −1 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/safecanvas/SafeBitmapShader.java
  11. +2 −1 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/safecanvas/SafeTranslatedPath.java
  12. +44 −44 MapboxAndroidSDK/src/main/res/layout/tooltip.xml
  13. +2 −2 MapboxAndroidSDK/src/main/res/values/colors.xml
  14. +3 −3 MapboxAndroidSDK/src/main/res/values/strings.xml
  15. +52 −35 MapboxAndroidSDKTestApp/build.gradle
  16. +75 −74 ...DKTestApp/src/instrumentTest/java/com/mapbox/mapboxsdk/android/testapp/test/MainActivityTest.java
  17. +21 −21 MapboxAndroidSDKTestApp/src/main/AndroidManifest.xml
  18. +8 −8 ...ndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/android/testapp/AlternateMapTestActivity.java
  19. +213 −208 MapboxAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/android/testapp/MainActivity.java
  20. +8 −8 MapboxAndroidSDKTestApp/src/main/res/layout/activity_alternatemap.xml
  21. +64 −64 MapboxAndroidSDKTestApp/src/main/res/layout/activity_main.xml
  22. +7 −7 MapboxAndroidSDKTestApp/src/main/res/menu/activity_main.xml
  23. +4 −4 MapboxAndroidSDKTestApp/src/main/res/values-w820dp/dimens.xml
  24. +3 −3 MapboxAndroidSDKTestApp/src/main/res/values/dimens.xml
  25. +4 −4 MapboxAndroidSDKTestApp/src/main/res/values/strings.xml
  26. +4 −4 MapboxAndroidSDKTestApp/src/main/res/values/styles.xml
View
352 MapBox.xml
@@ -1,180 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="MapBox">
- <option name="USE_SAME_INDENTS" value="true" />
- <option name="IGNORE_SAME_INDENTS_FOR_LANGUAGES" value="true" />
- <option name="OTHER_INDENT_OPTIONS">
- <value>
- <option name="INDENT_SIZE" value="2" />
- <option name="CONTINUATION_INDENT_SIZE" value="4" />
- <option name="TAB_SIZE" value="2" />
- <option name="USE_TAB_CHARACTER" value="false" />
- <option name="SMART_TABS" value="false" />
- <option name="LABEL_INDENT_SIZE" value="0" />
- <option name="LABEL_INDENT_ABSOLUTE" value="false" />
- <option name="USE_RELATIVE_INDENTS" value="false" />
- </value>
- </option>
- <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
- <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
- <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
- <value />
- </option>
- <option name="IMPORT_LAYOUT_TABLE">
- <value>
- <package name="" withSubpackages="true" static="false" />
- <emptyLine />
- <package name="" withSubpackages="true" static="true" />
- </value>
- </option>
- <option name="RIGHT_MARGIN" value="100" />
- <option name="JD_ALIGN_PARAM_COMMENTS" value="false" />
- <option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false" />
- <option name="JD_P_AT_EMPTY_LINES" value="false" />
- <option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true" />
- <option name="JD_KEEP_EMPTY_PARAMETER" value="false" />
- <option name="JD_KEEP_EMPTY_RETURN" value="false" />
- <option name="JD_PRESERVE_LINE_FEEDS" value="true" />
- <option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
- <option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
- <option name="KEEP_LINE_BREAKS" value="false" />
- <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
- <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
- <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
- <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
- <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
- <option name="ALIGN_MULTILINE_FOR" value="false" />
- <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
- <option name="CALL_PARAMETERS_WRAP" value="1" />
- <option name="METHOD_PARAMETERS_WRAP" value="1" />
- <option name="RESOURCE_LIST_WRAP" value="1" />
- <option name="EXTENDS_LIST_WRAP" value="1" />
- <option name="THROWS_LIST_WRAP" value="1" />
- <option name="EXTENDS_KEYWORD_WRAP" value="1" />
- <option name="THROWS_KEYWORD_WRAP" value="1" />
- <option name="METHOD_CALL_CHAIN_WRAP" value="5" />
- <option name="BINARY_OPERATION_WRAP" value="5" />
- <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
- <option name="TERNARY_OPERATION_WRAP" value="1" />
- <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
- <option name="FOR_STATEMENT_WRAP" value="1" />
- <option name="ARRAY_INITIALIZER_WRAP" value="1" />
- <option name="ASSIGNMENT_WRAP" value="1" />
- <option name="WRAP_COMMENTS" value="true" />
- <option name="ASSERT_STATEMENT_WRAP" value="1" />
- <option name="IF_BRACE_FORCE" value="1" />
- <option name="DOWHILE_BRACE_FORCE" value="1" />
- <option name="WHILE_BRACE_FORCE" value="1" />
- <option name="METHOD_ANNOTATION_WRAP" value="1" />
- <option name="CLASS_ANNOTATION_WRAP" value="1" />
- <option name="FIELD_ANNOTATION_WRAP" value="1" />
- <option name="PARAMETER_ANNOTATION_WRAP" value="1" />
- <option name="VARIABLE_ANNOTATION_WRAP" value="1" />
- <option name="ENUM_CONSTANTS_WRAP" value="1" />
- <XML>
- <option name="XML_ALIGN_ATTRIBUTES" value="false" />
- <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
- </XML>
- <ADDITIONAL_INDENT_OPTIONS fileType="php">
- <option name="INDENT_SIZE" value="2" />
- <option name="CONTINUATION_INDENT_SIZE" value="4" />
- <option name="TAB_SIZE" value="2" />
- </ADDITIONAL_INDENT_OPTIONS>
- <ADDITIONAL_INDENT_OPTIONS fileType="scala">
- <option name="INDENT_SIZE" value="2" />
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
- <option name="TAB_SIZE" value="2" />
- </ADDITIONAL_INDENT_OPTIONS>
- <ADDITIONAL_INDENT_OPTIONS fileType="sql">
- <option name="INDENT_SIZE" value="2" />
- <option name="CONTINUATION_INDENT_SIZE" value="4" />
- <option name="TAB_SIZE" value="2" />
- </ADDITIONAL_INDENT_OPTIONS>
- <codeStyleSettings language="Groovy">
- <option name="KEEP_LINE_BREAKS" value="false" />
- <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
- <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
- <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
- <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
- <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
- <option name="ALIGN_MULTILINE_FOR" value="false" />
- <option name="CALL_PARAMETERS_WRAP" value="1" />
- <option name="METHOD_PARAMETERS_WRAP" value="1" />
- <option name="EXTENDS_LIST_WRAP" value="1" />
- <option name="THROWS_LIST_WRAP" value="1" />
- <option name="EXTENDS_KEYWORD_WRAP" value="1" />
- <option name="THROWS_KEYWORD_WRAP" value="1" />
- <option name="METHOD_CALL_CHAIN_WRAP" value="5" />
- <option name="BINARY_OPERATION_WRAP" value="5" />
- <option name="TERNARY_OPERATION_WRAP" value="1" />
- <option name="FOR_STATEMENT_WRAP" value="1" />
- <option name="ASSIGNMENT_WRAP" value="1" />
- <option name="ASSERT_STATEMENT_WRAP" value="1" />
- <option name="IF_BRACE_FORCE" value="1" />
- <option name="WHILE_BRACE_FORCE" value="1" />
- <option name="METHOD_ANNOTATION_WRAP" value="1" />
- <option name="CLASS_ANNOTATION_WRAP" value="1" />
- <option name="FIELD_ANNOTATION_WRAP" value="1" />
- <option name="PARAMETER_ANNOTATION_WRAP" value="1" />
- <option name="VARIABLE_ANNOTATION_WRAP" value="1" />
- <option name="PARENT_SETTINGS_INSTALLED" value="true" />
- <indentOptions>
- <option name="INDENT_SIZE" value="2" />
- <option name="CONTINUATION_INDENT_SIZE" value="4" />
- <option name="TAB_SIZE" value="2" />
- </indentOptions>
- </codeStyleSettings>
- <codeStyleSettings language="JAVA">
- <option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
- <option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
- <option name="KEEP_LINE_BREAKS" value="false" />
- <option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
- <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
- <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
- <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
- <option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
- <option name="ALIGN_MULTILINE_FOR" value="false" />
- <option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true" />
- <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
- <option name="CALL_PARAMETERS_WRAP" value="1" />
- <option name="METHOD_PARAMETERS_WRAP" value="1" />
- <option name="RESOURCE_LIST_WRAP" value="1" />
- <option name="EXTENDS_LIST_WRAP" value="1" />
- <option name="THROWS_LIST_WRAP" value="1" />
- <option name="EXTENDS_KEYWORD_WRAP" value="1" />
- <option name="THROWS_KEYWORD_WRAP" value="1" />
- <option name="METHOD_CALL_CHAIN_WRAP" value="5" />
- <option name="BINARY_OPERATION_WRAP" value="5" />
- <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
- <option name="TERNARY_OPERATION_WRAP" value="1" />
- <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
- <option name="FOR_STATEMENT_WRAP" value="1" />
- <option name="ARRAY_INITIALIZER_WRAP" value="1" />
- <option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
- <option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
- <option name="ASSIGNMENT_WRAP" value="1" />
- <option name="WRAP_COMMENTS" value="true" />
- <option name="ASSERT_STATEMENT_WRAP" value="1" />
- <option name="IF_BRACE_FORCE" value="1" />
- <option name="DOWHILE_BRACE_FORCE" value="1" />
- <option name="WHILE_BRACE_FORCE" value="1" />
- <option name="METHOD_ANNOTATION_WRAP" value="1" />
- <option name="CLASS_ANNOTATION_WRAP" value="1" />
- <option name="FIELD_ANNOTATION_WRAP" value="1" />
- <option name="PARAMETER_ANNOTATION_WRAP" value="1" />
- <option name="VARIABLE_ANNOTATION_WRAP" value="1" />
- <option name="PARENT_SETTINGS_INSTALLED" value="true" />
- <indentOptions>
- <option name="INDENT_SIZE" value="2" />
- <option name="CONTINUATION_INDENT_SIZE" value="4" />
- <option name="TAB_SIZE" value="2" />
- </indentOptions>
- </codeStyleSettings>
- <codeStyleSettings language="XML">
- <indentOptions>
- <option name="INDENT_SIZE" value="2" />
- <option name="CONTINUATION_INDENT_SIZE" value="4" />
- <option name="TAB_SIZE" value="2" />
- </indentOptions>
- </codeStyleSettings>
+ <option name="USE_SAME_INDENTS" value="true"/>
+ <option name="IGNORE_SAME_INDENTS_FOR_LANGUAGES" value="true"/>
+ <option name="OTHER_INDENT_OPTIONS">
+ <value>
+ <option name="INDENT_SIZE" value="2"/>
+ <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+ <option name="TAB_SIZE" value="2"/>
+ <option name="USE_TAB_CHARACTER" value="false"/>
+ <option name="SMART_TABS" value="false"/>
+ <option name="LABEL_INDENT_SIZE" value="0"/>
+ <option name="LABEL_INDENT_ABSOLUTE" value="false"/>
+ <option name="USE_RELATIVE_INDENTS" value="false"/>
+ </value>
+ </option>
+ <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
+ <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999"/>
+ <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
+ <value/>
+ </option>
+ <option name="IMPORT_LAYOUT_TABLE">
+ <value>
+ <package name="" withSubpackages="true" static="false"/>
+ <emptyLine/>
+ <package name="" withSubpackages="true" static="true"/>
+ </value>
+ </option>
+ <option name="RIGHT_MARGIN" value="100"/>
+ <option name="JD_ALIGN_PARAM_COMMENTS" value="false"/>
+ <option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false"/>
+ <option name="JD_P_AT_EMPTY_LINES" value="false"/>
+ <option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true"/>
+ <option name="JD_KEEP_EMPTY_PARAMETER" value="false"/>
+ <option name="JD_KEEP_EMPTY_RETURN" value="false"/>
+ <option name="JD_PRESERVE_LINE_FEEDS" value="true"/>
+ <option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false"/>
+ <option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false"/>
+ <option name="KEEP_LINE_BREAKS" value="false"/>
+ <option name="KEEP_FIRST_COLUMN_COMMENT" value="false"/>
+ <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
+ <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
+ <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0"/>
+ <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
+ <option name="ALIGN_MULTILINE_FOR" value="false"/>
+ <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/>
+ <option name="CALL_PARAMETERS_WRAP" value="1"/>
+ <option name="METHOD_PARAMETERS_WRAP" value="1"/>
+ <option name="RESOURCE_LIST_WRAP" value="1"/>
+ <option name="EXTENDS_LIST_WRAP" value="1"/>
+ <option name="THROWS_LIST_WRAP" value="1"/>
+ <option name="EXTENDS_KEYWORD_WRAP" value="1"/>
+ <option name="THROWS_KEYWORD_WRAP" value="1"/>
+ <option name="METHOD_CALL_CHAIN_WRAP" value="5"/>
+ <option name="BINARY_OPERATION_WRAP" value="5"/>
+ <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true"/>
+ <option name="TERNARY_OPERATION_WRAP" value="1"/>
+ <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true"/>
+ <option name="FOR_STATEMENT_WRAP" value="1"/>
+ <option name="ARRAY_INITIALIZER_WRAP" value="1"/>
+ <option name="ASSIGNMENT_WRAP" value="1"/>
+ <option name="WRAP_COMMENTS" value="true"/>
+ <option name="ASSERT_STATEMENT_WRAP" value="1"/>
+ <option name="IF_BRACE_FORCE" value="1"/>
+ <option name="DOWHILE_BRACE_FORCE" value="1"/>
+ <option name="WHILE_BRACE_FORCE" value="1"/>
+ <option name="METHOD_ANNOTATION_WRAP" value="1"/>
+ <option name="CLASS_ANNOTATION_WRAP" value="1"/>
+ <option name="FIELD_ANNOTATION_WRAP" value="1"/>
+ <option name="PARAMETER_ANNOTATION_WRAP" value="1"/>
+ <option name="VARIABLE_ANNOTATION_WRAP" value="1"/>
+ <option name="ENUM_CONSTANTS_WRAP" value="1"/>
+ <XML>
+ <option name="XML_ALIGN_ATTRIBUTES" value="false"/>
+ <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true"/>
+ </XML>
+ <ADDITIONAL_INDENT_OPTIONS fileType="php">
+ <option name="INDENT_SIZE" value="2"/>
+ <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+ <option name="TAB_SIZE" value="2"/>
+ </ADDITIONAL_INDENT_OPTIONS>
+ <ADDITIONAL_INDENT_OPTIONS fileType="scala">
+ <option name="INDENT_SIZE" value="2"/>
+ <option name="CONTINUATION_INDENT_SIZE" value="2"/>
+ <option name="TAB_SIZE" value="2"/>
+ </ADDITIONAL_INDENT_OPTIONS>
+ <ADDITIONAL_INDENT_OPTIONS fileType="sql">
+ <option name="INDENT_SIZE" value="2"/>
+ <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+ <option name="TAB_SIZE" value="2"/>
+ </ADDITIONAL_INDENT_OPTIONS>
+ <codeStyleSettings language="Groovy">
+ <option name="KEEP_LINE_BREAKS" value="false"/>
+ <option name="KEEP_FIRST_COLUMN_COMMENT" value="false"/>
+ <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
+ <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
+ <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0"/>
+ <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
+ <option name="ALIGN_MULTILINE_FOR" value="false"/>
+ <option name="CALL_PARAMETERS_WRAP" value="1"/>
+ <option name="METHOD_PARAMETERS_WRAP" value="1"/>
+ <option name="EXTENDS_LIST_WRAP" value="1"/>
+ <option name="THROWS_LIST_WRAP" value="1"/>
+ <option name="EXTENDS_KEYWORD_WRAP" value="1"/>
+ <option name="THROWS_KEYWORD_WRAP" value="1"/>
+ <option name="METHOD_CALL_CHAIN_WRAP" value="5"/>
+ <option name="BINARY_OPERATION_WRAP" value="5"/>
+ <option name="TERNARY_OPERATION_WRAP" value="1"/>
+ <option name="FOR_STATEMENT_WRAP" value="1"/>
+ <option name="ASSIGNMENT_WRAP" value="1"/>
+ <option name="ASSERT_STATEMENT_WRAP" value="1"/>
+ <option name="IF_BRACE_FORCE" value="1"/>
+ <option name="WHILE_BRACE_FORCE" value="1"/>
+ <option name="METHOD_ANNOTATION_WRAP" value="1"/>
+ <option name="CLASS_ANNOTATION_WRAP" value="1"/>
+ <option name="FIELD_ANNOTATION_WRAP" value="1"/>
+ <option name="PARAMETER_ANNOTATION_WRAP" value="1"/>
+ <option name="VARIABLE_ANNOTATION_WRAP" value="1"/>
+ <option name="PARENT_SETTINGS_INSTALLED" value="true"/>
+ <indentOptions>
+ <option name="INDENT_SIZE" value="2"/>
+ <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+ <option name="TAB_SIZE" value="2"/>
+ </indentOptions>
+ </codeStyleSettings>
+ <codeStyleSettings language="JAVA">
+ <option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false"/>
+ <option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false"/>
+ <option name="KEEP_LINE_BREAKS" value="false"/>
+ <option name="KEEP_FIRST_COLUMN_COMMENT" value="false"/>
+ <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/>
+ <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/>
+ <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0"/>
+ <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/>
+ <option name="ALIGN_MULTILINE_FOR" value="false"/>
+ <option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACES" value="true"/>
+ <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/>
+ <option name="CALL_PARAMETERS_WRAP" value="1"/>
+ <option name="METHOD_PARAMETERS_WRAP" value="1"/>
+ <option name="RESOURCE_LIST_WRAP" value="1"/>
+ <option name="EXTENDS_LIST_WRAP" value="1"/>
+ <option name="THROWS_LIST_WRAP" value="1"/>
+ <option name="EXTENDS_KEYWORD_WRAP" value="1"/>
+ <option name="THROWS_KEYWORD_WRAP" value="1"/>
+ <option name="METHOD_CALL_CHAIN_WRAP" value="5"/>
+ <option name="BINARY_OPERATION_WRAP" value="5"/>
+ <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true"/>
+ <option name="TERNARY_OPERATION_WRAP" value="1"/>
+ <option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true"/>
+ <option name="FOR_STATEMENT_WRAP" value="1"/>
+ <option name="ARRAY_INITIALIZER_WRAP" value="1"/>
+ <option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true"/>
+ <option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true"/>
+ <option name="ASSIGNMENT_WRAP" value="1"/>
+ <option name="WRAP_COMMENTS" value="true"/>
+ <option name="ASSERT_STATEMENT_WRAP" value="1"/>
+ <option name="IF_BRACE_FORCE" value="1"/>
+ <option name="DOWHILE_BRACE_FORCE" value="1"/>
+ <option name="WHILE_BRACE_FORCE" value="1"/>
+ <option name="METHOD_ANNOTATION_WRAP" value="1"/>
+ <option name="CLASS_ANNOTATION_WRAP" value="1"/>
+ <option name="FIELD_ANNOTATION_WRAP" value="1"/>
+ <option name="PARAMETER_ANNOTATION_WRAP" value="1"/>
+ <option name="VARIABLE_ANNOTATION_WRAP" value="1"/>
+ <option name="PARENT_SETTINGS_INSTALLED" value="true"/>
+ <indentOptions>
+ <option name="INDENT_SIZE" value="2"/>
+ <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+ <option name="TAB_SIZE" value="2"/>
+ </indentOptions>
+ </codeStyleSettings>
+ <codeStyleSettings language="XML">
+ <indentOptions>
+ <option name="INDENT_SIZE" value="2"/>
+ <option name="CONTINUATION_INDENT_SIZE" value="4"/>
+ <option name="TAB_SIZE" value="2"/>
+ </indentOptions>
+ </codeStyleSettings>
</code_scheme>
View
290 MapboxAndroidSDK/build.gradle
@@ -1,11 +1,11 @@
buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.9.+'
- classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.9.+'
- }
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.9.+'
+ classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.9.+'
+ }
}
apply plugin: 'android-sdk-manager'
@@ -15,197 +15,199 @@ apply plugin: 'maven'
apply plugin: 'signing'
allprojects {
- group project.GROUP
- version project.VERSION_NAME
+ group project.GROUP
+ version project.VERSION_NAME
- repositories {
- mavenCentral()
- }
+ repositories {
+ mavenCentral()
+ }
- tasks.withType(Compile) {
- options.encoding = 'UTF-8'
- }
+ tasks.withType(Compile) {
+ options.encoding = 'UTF-8'
+ }
}
repositories {
- mavenCentral()
+ mavenCentral()
}
dependencies {
- compile 'com.android.support:support-v4:19.1.+'
- compile 'com.squareup.okhttp:okhttp:1.3.0'
- compile 'com.nineoldandroids:library:2.4.0'
- compile 'com.jakewharton:disklrucache:2.0.1'
- compile 'com.google.guava:guava:16.0.1'
+ compile 'com.android.support:support-v4:19.1.+'
+ compile 'com.squareup.okhttp:okhttp:1.3.0'
+ compile 'com.nineoldandroids:library:2.4.0'
+ compile 'com.jakewharton:disklrucache:2.0.1'
+ compile 'com.google.guava:guava:16.0.1'
}
android {
- compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
- buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
+ compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
+ buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
- defaultConfig {
- minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
- targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
- }
+ defaultConfig {
+ minSdkVersion Integer.parseInt(project.ANDROID_MIN_SDK)
+ targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
+ }
- sourceSets {
+ sourceSets {
- main {
- manifest.srcFile 'src/main/AndroidManifest.xml'
+ main {
+ manifest.srcFile 'src/main/AndroidManifest.xml'
- java.srcDirs = ['src/main/java']
+ java.srcDirs = ['src/main/java']
- res.srcDirs = ['src/main/res']
+ res.srcDirs = ['src/main/res']
- assets {
- srcDir 'assets'
- }
+ assets {
+ srcDir 'assets'
+ }
+ }
}
- }
- lintOptions {
- abortOnError false
- }
+ lintOptions {
+ abortOnError false
+ }
}
android.libraryVariants.all { variant ->
- def name = variant.name
- task "javadoc$name"(type: Javadoc) {
- description = "Generates javadoc for build $name"
- failOnError = false
- destinationDir = new File(destinationDir, variant.baseName)
- source = files(variant.javaCompile.source)
- classpath = files(android.plugin.runtimeJarList, variant.javaCompile.classpath)
- options.links("http://docs.oracle.com/javase/7/docs/api/")
- options.links("http://d.android.com/reference/")
- exclude '**/R.html', '**/R.*.html'
- }
+ def name = variant.name
+ task "javadoc$name"(type: Javadoc) {
+ description = "Generates javadoc for build $name"
+ failOnError = false
+ destinationDir = new File(destinationDir, variant.baseName)
+ source = files(variant.javaCompile.source)
+ classpath = files(android.plugin.runtimeJarList, variant.javaCompile.classpath)
+ options.links("http://docs.oracle.com/javase/7/docs/api/")
+ options.links("http://d.android.com/reference/")
+ exclude '**/R.html', '**/R.*.html'
+ }
}
checkstyle {
- configFile project.file('../checks.xml')
- showViolations true
+ configFile project.file('../checks.xml')
+ showViolations true
}
android.libraryVariants.all { variant ->
- def name = variant.buildType.name
- def checkstyle = project.tasks.create "checkstyle${name.capitalize()}", Checkstyle
- checkstyle.dependsOn variant.javaCompile
- checkstyle.source variant.javaCompile.source
- checkstyle.classpath = project.fileTree(variant.javaCompile.destinationDir)
- checkstyle.exclude('**/BuildConfig.java')
- checkstyle.exclude('**/R.java')
- checkstyle.exclude('**/uk/co/senab/bitmapcache/*')
- project.tasks.getByName("check").dependsOn checkstyle
+ def name = variant.buildType.name
+ def checkstyle = project.tasks.create "checkstyle${name.capitalize()}", Checkstyle
+ checkstyle.dependsOn variant.javaCompile
+ checkstyle.source variant.javaCompile.source
+ checkstyle.classpath = project.fileTree(variant.javaCompile.destinationDir)
+ checkstyle.exclude('**/BuildConfig.java')
+ checkstyle.exclude('**/R.java')
+ checkstyle.exclude('**/uk/co/senab/bitmapcache/*')
+ project.tasks.getByName("check").dependsOn checkstyle
}
// From https://raw.github.com/mcxiaoke/gradle-mvn-push/master/jar.gradle
android.libraryVariants.all { variant ->
- def jarTask = project.tasks.create(name: "jar${variant.name.capitalize()}", type: Jar) {
- from variant.javaCompile.destinationDir
- exclude "**/R.class"
- exclude "**/BuildConfig.class"
- }
- jarTask.dependsOn variant.javaCompile
- artifacts.add('archives', jarTask);
+ def jarTask = project.tasks.create(name: "jar${variant.name.capitalize()}", type: Jar) {
+ from variant.javaCompile.destinationDir
+ exclude "**/R.class"
+ exclude "**/BuildConfig.class"
+ }
+ jarTask.dependsOn variant.javaCompile
+ artifacts.add('archives', jarTask);
}
// From https://raw.github.com/mcxiaoke/gradle-mvn-push/master/gradle-mvn-push.gradle
def isReleaseBuild() {
- return VERSION_NAME.contains("SNAPSHOT") == false
+ return VERSION_NAME.contains("SNAPSHOT") == false
}
def getReleaseRepositoryUrl() {
- return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL :
- "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+ return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL :
+ "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
def getSnapshotRepositoryUrl() {
- return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL :
- "https://oss.sonatype.org/content/repositories/snapshots/"
+ return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL :
+ "https://oss.sonatype.org/content/repositories/snapshots/"
}
def getRepositoryUsername() {
- return hasProperty('USERNAME') ? USERNAME : (hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "")
+ return hasProperty('USERNAME') ? USERNAME :
+ (hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "")
}
def getRepositoryPassword() {
- return hasProperty('PASSWORD') ? PASSWORD : (hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "")
+ return hasProperty('PASSWORD') ? PASSWORD :
+ (hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "")
}
afterEvaluate { project ->
- uploadArchives {
- repositories {
- mavenDeployer {
- beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+ uploadArchives {
+ repositories {
+ mavenDeployer {
+ beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+
+ pom.groupId = GROUP
+ pom.artifactId = POM_ARTIFACT_ID
+ pom.version = VERSION_NAME
+
+ repository(url: getReleaseRepositoryUrl()) {
+ authentication(userName: getRepositoryUsername(),
+ password: getRepositoryPassword())
+ }
+ snapshotRepository(url: getSnapshotRepositoryUrl()) {
+ authentication(userName: getRepositoryUsername(),
+ password: getRepositoryPassword())
+ }
+
+ pom.project {
+ name POM_NAME
+ packaging POM_PACKAGING
+ description POM_DESCRIPTION
+ url POM_URL
+
+ scm {
+ url POM_SCM_URL
+ connection POM_SCM_CONNECTION
+ developerConnection POM_SCM_DEV_CONNECTION
+ }
+
+ licenses {
+ license {
+ name POM_LICENCE_NAME
+ url POM_LICENCE_URL
+ distribution POM_LICENCE_DIST
+ }
+ }
+
+ developers {
+ developer {
+ id POM_DEVELOPER_ID
+ name POM_DEVELOPER_NAME
+ }
+ }
+ }
+ }
+ }
+ }
- pom.groupId = GROUP
- pom.artifactId = POM_ARTIFACT_ID
- pom.version = VERSION_NAME
+ signing {
+ required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
+ sign configurations.archives
+ }
- repository(url: getReleaseRepositoryUrl()) {
- authentication(userName: getRepositoryUsername(),
- password: getRepositoryPassword())
- }
- snapshotRepository(url: getSnapshotRepositoryUrl()) {
- authentication(userName: getRepositoryUsername(),
- password: getRepositoryPassword())
- }
+ task androidJavadocs(type: Javadoc) {
+ failOnError false
+ source = android.sourceSets.main.allJava
+ classpath += project.files(android.plugin.getRuntimeJarList().join(File.pathSeparator))
+ }
- pom.project {
- name POM_NAME
- packaging POM_PACKAGING
- description POM_DESCRIPTION
- url POM_URL
-
- scm {
- url POM_SCM_URL
- connection POM_SCM_CONNECTION
- developerConnection POM_SCM_DEV_CONNECTION
- }
-
- licenses {
- license {
- name POM_LICENCE_NAME
- url POM_LICENCE_URL
- distribution POM_LICENCE_DIST
- }
- }
+ task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
+ classifier = 'javadoc'
+ from androidJavadocs.destinationDir
+ }
- developers {
- developer {
- id POM_DEVELOPER_ID
- name POM_DEVELOPER_NAME
- }
- }
- }
- }
+ task androidSourcesJar(type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.allSource
+ }
+
+ artifacts {
+ archives androidSourcesJar
+ archives androidJavadocsJar
}
- }
-
- signing {
- required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
- sign configurations.archives
- }
-
- task androidJavadocs(type: Javadoc) {
- failOnError false
- source = android.sourceSets.main.allJava
- classpath += project.files(android.plugin.getRuntimeJarList().join(File.pathSeparator))
- }
-
- task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
- classifier = 'javadoc'
- from androidJavadocs.destinationDir
- }
-
- task androidSourcesJar(type: Jar) {
- classifier = 'sources'
- from android.sourceSets.main.allSource
- }
-
- artifacts {
- archives androidSourcesJar
- archives androidJavadocsJar
- }
}
View
6 MapboxAndroidSDK/src/main/AndroidManifest.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.mapbox.mapboxsdk">
- <application android:allowBackup="true"/>
- <uses-sdk android:minSdkVersion="9"/>
+ package="com.mapbox.mapboxsdk">
+ <application android:allowBackup="true"/>
+ <uses-sdk android:minSdkVersion="9"/>
</manifest>
View
14 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/format/GeoJSON.java
@@ -8,13 +8,12 @@
import com.mapbox.mapboxsdk.overlay.Marker;
import com.mapbox.mapboxsdk.overlay.PathOverlay;
import com.mapbox.mapboxsdk.views.MapView;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Locale;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* A GeoJSON parser.
@@ -66,7 +65,8 @@
* @param mv a mapview
* @throws JSONException
*/
- public static ArrayList<Object> featureCollectionToLayers(JSONObject featureCollection, MapView mv) throws JSONException {
+ public static ArrayList<Object> featureCollectionToLayers(JSONObject featureCollection,
+ MapView mv) throws JSONException {
ArrayList<Object> uiObjects = new ArrayList<Object>();
JSONArray features = (JSONArray) featureCollection.get("features");
@@ -107,7 +107,9 @@
String markerSize = properties.optString("marker-size");
String markerSymbol = properties.optString("marker-symbol");
- if (!Strings.isNullOrEmpty(markerColor) || !Strings.isNullOrEmpty(markerSize) || !Strings.isNullOrEmpty(markerSymbol)) {
+ if (!Strings.isNullOrEmpty(markerColor)
+ || !Strings.isNullOrEmpty(markerSize)
+ || !Strings.isNullOrEmpty(markerSymbol)) {
// Who knows what kind of stuff we are getting in
Icon.Size size;
@@ -131,7 +133,7 @@
}
uiObjects.add(marker);
-// mv.addMarker(marker);
+ // mv.addMarker(marker);
} else if (type.equalsIgnoreCase("MultiPoint")) {
JSONArray points = (JSONArray) geometry.get("coordinates");
for (j = 0; j < points.length(); j++) {
View
13 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/overlay/GeoJSONLayer.java
@@ -1,10 +1,10 @@
package com.mapbox.mapboxsdk.overlay;
-import com.google.common.base.Strings;
-import com.mapbox.mapboxsdk.views.MapView;
-import com.mapbox.mapboxsdk.format.GeoJSON;
import android.os.AsyncTask;
import android.util.Log;
+import com.google.common.base.Strings;
+import com.mapbox.mapboxsdk.format.GeoJSON;
+import com.mapbox.mapboxsdk.views.MapView;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -12,8 +12,8 @@
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
public class GeoJSONLayer {
@@ -43,7 +43,8 @@ public void loadURL(final String url) {
try {
Log.w(TAG, "Mapbox SDK downloading GeoJSON URL: " + params[0]);
is = new URL(params[0]).openStream();
- BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
+ BufferedReader rd =
+ new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
jsonText = readAll(rd);
List<Object> parsed = GeoJSON.parseString(jsonText, mapView);
@@ -60,7 +61,7 @@ public void loadURL(final String url) {
@Override
protected void onPostExecute(ArrayList<Object> objects) {
// Back on the Main Thread so add new UI Objects and refresh map
- for (Object obj: objects) {
+ for (Object obj : objects) {
if (obj instanceof Marker) {
mapView.addMarker((Marker) obj);
} else if (obj instanceof PathOverlay) {
View
2 ...roidSDK/src/main/java/com/mapbox/mapboxsdk/tileprovider/constants/TileLayerConstants.java
@@ -24,7 +24,7 @@
*/
public static final int MAXIMUM_ZOOMLEVEL = 22;
- public static final int DEFAULT_TILE_SIZE = 256;
+ public static final int DEFAULT_TILE_SIZE = 256;
/**
* Initial tile cache size. The size will be increased as required by calling {@link
View
3 ...ndroidSDK/src/main/java/com/mapbox/mapboxsdk/tileprovider/tilesource/MapboxTileLayer.java
@@ -36,7 +36,8 @@ protected void initialize(String pId, String aUrl, boolean enableSSL) {
@Override
public TileLayer setURL(final String aUrl) {
- if (!aUrl.toLowerCase(Locale.US).contains("http://") && !aUrl.toLowerCase(Locale.US).contains("https://") && Strings.isNullOrEmpty(aUrl)) {
+ if (!aUrl.toLowerCase(Locale.US).contains("http://") && !aUrl.toLowerCase(Locale.US)
+ .contains("https://") && Strings.isNullOrEmpty(aUrl)) {
super.setURL(MAPBOX_BASE_URL + aUrl + "/{z}/{x}/{y}{2x}.png");
} else {
super.setURL(aUrl);
View
5 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
@@ -23,7 +23,6 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.Scroller;
-
import com.mapbox.mapboxsdk.R;
import com.mapbox.mapboxsdk.api.ILatLng;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
@@ -56,14 +55,12 @@
import com.mapbox.mapboxsdk.views.util.TilesLoadedListener;
import com.mapbox.mapboxsdk.views.util.constants.MapViewConstants;
import com.mapbox.mapboxsdk.views.util.constants.MapViewLayouts;
-
-import org.json.JSONException;
-
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import org.json.JSONException;
/**
* The MapView class manages all of the content and
View
4 ...roidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapViewScaleGestureDetectorListener.java
@@ -41,8 +41,8 @@ public boolean onScaleBegin(ScaleGestureDetector detector) {
this.mapView.getController()
.aboutToStartAnimation(
lastFocusX + this.mapView.getScrollX() - (this.mapView.getWidth() / 2),
- lastFocusY + this.mapView.getScrollY() - (this.mapView.getHeight()
- / 2));
+ lastFocusY + this.mapView.getScrollY() - (this.mapView.getHeight() / 2)
+ );
scaling = true;
}
return true;
View
3 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/safecanvas/SafeBitmapShader.java
@@ -10,7 +10,8 @@
* call {@link #onDrawCycleStart} at the start of the
* {@link com.mapbox.mapboxsdk.overlay.OverlayOverlay#drawSafe}
* method of your {@link com.mapbox.mapboxsdk.overlay.OverlayOverlay}. This will set the adjustment
- * needed to draw your BitmapShader safely on the canvas without any drawing distortion at high zoom
+ * needed to draw your BitmapShader safely on the canvas without any drawing distortion at high
+ * zoom
* levels and without any scrolling issues.
*
* @author Marc Kurtz
View
3 MapboxAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/safecanvas/SafeTranslatedPath.java
@@ -12,7 +12,8 @@
* call {@link #onDrawCycleStart} at the start of the
* {@link com.mapbox.mapboxsdk.overlay.Overlay.Overlay#drawSafe}
* method of your
- * {@link com.mapbox.mapboxsdk.overlay.Overlay.Overlay}. This will set the adjustment needed to draw
+ * {@link com.mapbox.mapboxsdk.overlay.Overlay.Overlay}. This will set the adjustment needed to
+ * draw
* your Path safely on the canvas
* without any drawing distortion at high zoom levels. Methods of the {@link Path} class that use
* unsafe float types have been deprecated in favor of replacement methods that use doubles.
View
88 MapboxAndroidSDK/src/main/res/layout/tooltip.xml
@@ -1,52 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <LinearLayout
- android:background="@color/white"
- android:padding="5dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:orientation="vertical">
-
- <TextView
- android:id="@+id/tooltip_title"
- android:layout_width="wrap_content"
- android:layout_height="0dp"
- android:textColor="@color/black"
- android:textSize="18sp"
- android:maxEms="17"
- android:layout_gravity="left"
- android:layout_weight="1"
- android:text="@string/toolTipTitle"/>
-
- <TextView
- android:id="@+id/tooltip_description"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textColor="@color/black"
- android:textSize="14sp"
- android:maxEms="17"
- android:text="@string/toolTipDescription"/>
-
- <TextView
- android:id="@+id/tooltip_subdescription"
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textColor="@color/black"
- android:textSize="12sp"
- android:maxEms="17"
- android:text="@string/toolTipAddress"
- android:visibility="gone"/>
- </LinearLayout>
-
- <com.mapbox.mapboxsdk.views.TipView
- android:layout_width="fill_parent"
- android:layout_height="10dp"/>
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:background="@color/white"
+ android:padding="5dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/tooltip_title"
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:textColor="@color/black"
+ android:textSize="18sp"
+ android:maxEms="17"
+ android:layout_gravity="left"
+ android:layout_weight="1"
+ android:text="@string/toolTipTitle"/>
+
+ <TextView
+ android:id="@+id/tooltip_description"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/black"
+ android:textSize="14sp"
+ android:maxEms="17"
+ android:text="@string/toolTipDescription"/>
+
+ <TextView
+ android:id="@+id/tooltip_subdescription"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/black"
+ android:textSize="12sp"
+ android:maxEms="17"
+ android:text="@string/toolTipAddress"
+ android:visibility="gone"/>
+ </LinearLayout>
+
+ <com.mapbox.mapboxsdk.views.TipView
+ android:layout_width="fill_parent"
+ android:layout_height="10dp"/>
</LinearLayout>
View
4 MapboxAndroidSDK/src/main/res/values/colors.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <color name="black">#000000</color>
- <color name="white">#FFFFFF</color>
+ <color name="black">#000000</color>
+ <color name="white">#FFFFFF</color>
</resources>
View
6 MapboxAndroidSDK/src/main/res/values/strings.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="toolTipTitle">Title</string>
- <string name="toolTipDescription">Description</string>
- <string name="toolTipAddress">Address</string>
+ <string name="toolTipTitle">Title</string>
+ <string name="toolTipDescription">Description</string>
+ <string name="toolTipAddress">Address</string>
</resources>
View
87 MapboxAndroidSDKTestApp/build.gradle
@@ -1,11 +1,11 @@
buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.9.+'
- classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.9.+'
- }
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.9.+'
+ classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.9.+'
+ }
}
apply plugin: 'android-sdk-manager'
@@ -13,39 +13,56 @@ apply plugin: 'android'
apply plugin: 'checkstyle'
repositories {
- mavenCentral()
- mavenLocal()
- flatDir {
- dirs '../libs'
- }
+ mavenCentral()
+ mavenLocal()
+ flatDir {
+ dirs '../libs'
+ }
}
android {
- compileSdkVersion 19
- buildToolsVersion "19.0.3"
-
- defaultConfig {
- minSdkVersion 10
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- packageName "com.mapbox.mapboxsdk.android.testapp"
- }
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ compileSdkVersion 19
+ buildToolsVersion "19.0.3"
+
+ defaultConfig {
+ minSdkVersion 10
+ targetSdkVersion 19
+ versionCode 1
+ versionName "1.0"
+ packageName "com.mapbox.mapboxsdk.android.testapp"
+ }
+ buildTypes {
+ release {
+ runProguard false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
+ }
+ }
+ // This is important, it will run lint checks but won't abort build
+ lintOptions {
+ abortOnError false
}
- }
- // This is important, it will run lint checks but won't abort build
- lintOptions {
- abortOnError false
- }
}
dependencies {
- compile 'com.android.support:appcompat-v7:+'
- compile(project(':mapbox-android-sdk')) {
- transitive = true
- }
+ compile 'com.android.support:appcompat-v7:+'
+ compile(project(':mapbox-android-sdk')) {
+ transitive = true
+ }
+}
+
+
+checkstyle {
+ configFile project.file('../checks.xml')
+ showViolations true
}
+
+android.applicationVariants.all { variant ->
+ def name = variant.buildType.name
+ def checkstyle = project.tasks.create "checkstyle${name.capitalize()}", Checkstyle
+ checkstyle.dependsOn variant.javaCompile
+ checkstyle.source variant.javaCompile.source
+ checkstyle.classpath = project.fileTree(variant.javaCompile.destinationDir)
+ checkstyle.exclude('**/BuildConfig.java')
+ checkstyle.exclude('**/R.java')
+ project.tasks.getByName("check").dependsOn checkstyle
+}
View
149 ...p/src/instrumentTest/java/com/mapbox/mapboxsdk/android/testapp/test/MainActivityTest.java
@@ -15,78 +15,79 @@
import junit.framework.Assert;
public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
- public MainActivityTest() {
- super(MainActivity.class);
- }
-
- public void testSetMapCenter() throws Exception {
- LatLng center = new LatLng(43.07472, -89.38421);
- MainActivity activity = getActivity();
- activity.setMapCenter(center);
- }
-
- public void testLatLng() throws Exception {
- LatLng ll = new LatLng(10d, -20d);
- LatLng llb = new LatLng(10d, -20d);
- LatLng llc = new LatLng(10d, -21d, 100d);
-
- Assert.assertEquals(ll.getLatitude(), 10d);
- Assert.assertEquals(ll.getLongitude(), -20d);
- Assert.assertEquals(ll.getAltitude(), 0d);
-
- Assert.assertEquals(ll.toString(), "10.0,-20.0,0.0");
- Assert.assertEquals(llc.toString(), "10.0,-21.0,100.0");
-
- Assert.assertTrue(ll.equals(llb));
- Assert.assertFalse(ll.equals(llc));
- Assert.assertTrue(ll.equals(new LatLng(ll)));
- }
-
- public void testBoundingBox() throws Exception {
- BoundingBox bb = new BoundingBox(10d, 10d, 0d, 0d);
-
- Assert.assertEquals(bb.getLatNorth(), 10d);
- Assert.assertEquals(bb.getLatSouth(), 0d);
- Assert.assertEquals(bb.getLonEast(), 10d);
- Assert.assertEquals(bb.getLonWest(), 0d);
-
- Assert.assertEquals(bb.toString(), "N:10.0; E:10.0; S:0.0; W:0.0");
-
- Assert.assertEquals(bb.getCenter().getLongitude(), 5.0d);
- Assert.assertEquals(bb.getLongitudeSpan(), 10.0d);
- Assert.assertEquals(bb.getLatitudeSpan(), 10.0d);
- Assert.assertTrue(bb.contains(new LatLng(5f, 5f)));
- Assert.assertFalse(bb.contains(new LatLng(15f, 5f)));
-
- ArrayList pts = new ArrayList();
- pts.add(new LatLng(0f, 0f));
- pts.add(new LatLng(10f, 10f));
- Assert.assertTrue(bb.equals(BoundingBox.fromLatLngs(pts)));
-
- BoundingBox bb2 = new BoundingBox(0d, 0d, -10d, -10d);
-
- Assert.assertTrue(bb.union(bb2).equals(new BoundingBox(10d, 10d, -10d, -10d)));
-
- Assert.assertEquals(new BoundingBox(0d, 0d, 0d, 0d).toString(), bb.intersect(bb2).toString());
- }
-
- public void testMapTile() throws Exception {
- MapTile tile = new MapTile(1, 2, 3);
- MapTile tileB = new MapTile(1, 2, 3);
- MapTile tileC = new MapTile(1, 2, 4);
-
- Assert.assertEquals(tile.getZ(), 1);
- Assert.assertEquals(tile.getX(), 2);
- Assert.assertEquals(tile.getY(), 3);
- Assert.assertEquals(tile.toString(), "1/2/3");
-
- Assert.assertTrue(tile.equals(tileB));
- Assert.assertFalse(tile.equals(tileC));
- }
-
- public void testProjection() throws Exception {
- Assert.assertEquals(256, Projection.mapSize(0f));
- Assert.assertEquals(512, Projection.mapSize(1f));
- Assert.assertEquals(256, Projection.getTileSize());
- }
+ public MainActivityTest() {
+ super(MainActivity.class);
+ }
+
+ public void testSetMapCenter() throws Exception {
+ LatLng center = new LatLng(43.07472, -89.38421);
+ MainActivity activity = getActivity();
+ activity.setMapCenter(center);
+ }
+
+ public void testLatLng() throws Exception {
+ LatLng ll = new LatLng(10d, -20d);
+ LatLng llb = new LatLng(10d, -20d);
+ LatLng llc = new LatLng(10d, -21d, 100d);
+
+ Assert.assertEquals(ll.getLatitude(), 10d);
+ Assert.assertEquals(ll.getLongitude(), -20d);
+ Assert.assertEquals(ll.getAltitude(), 0d);
+
+ Assert.assertEquals(ll.toString(), "10.0,-20.0,0.0");
+ Assert.assertEquals(llc.toString(), "10.0,-21.0,100.0");
+
+ Assert.assertTrue(ll.equals(llb));
+ Assert.assertFalse(ll.equals(llc));
+ Assert.assertTrue(ll.equals(new LatLng(ll)));
+ }
+
+ public void testBoundingBox() throws Exception {
+ BoundingBox bb = new BoundingBox(10d, 10d, 0d, 0d);
+
+ Assert.assertEquals(bb.getLatNorth(), 10d);
+ Assert.assertEquals(bb.getLatSouth(), 0d);
+ Assert.assertEquals(bb.getLonEast(), 10d);
+ Assert.assertEquals(bb.getLonWest(), 0d);
+
+ Assert.assertEquals(bb.toString(), "N:10.0; E:10.0; S:0.0; W:0.0");
+
+ Assert.assertEquals(bb.getCenter().getLongitude(), 5.0d);
+ Assert.assertEquals(bb.getLongitudeSpan(), 10.0d);
+ Assert.assertEquals(bb.getLatitudeSpan(), 10.0d);
+ Assert.assertTrue(bb.contains(new LatLng(5f, 5f)));
+ Assert.assertFalse(bb.contains(new LatLng(15f, 5f)));
+
+ ArrayList pts = new ArrayList();
+ pts.add(new LatLng(0f, 0f));
+ pts.add(new LatLng(10f, 10f));
+ Assert.assertTrue(bb.equals(BoundingBox.fromLatLngs(pts)));
+
+ BoundingBox bb2 = new BoundingBox(0d, 0d, -10d, -10d);
+
+ Assert.assertTrue(bb.union(bb2).equals(new BoundingBox(10d, 10d, -10d, -10d)));
+
+ Assert.assertEquals(new BoundingBox(0d, 0d, 0d, 0d).toString(),
+ bb.intersect(bb2).toString());
+ }
+
+ public void testMapTile() throws Exception {
+ MapTile tile = new MapTile(1, 2, 3);
+ MapTile tileB = new MapTile(1, 2, 3);
+ MapTile tileC = new MapTile(1, 2, 4);
+
+ Assert.assertEquals(tile.getZ(), 1);
+ Assert.assertEquals(tile.getX(), 2);
+ Assert.assertEquals(tile.getY(), 3);
+ Assert.assertEquals(tile.toString(), "1/2/3");
+
+ Assert.assertTrue(tile.equals(tileB));
+ Assert.assertFalse(tile.equals(tileC));
+ }
+
+ public void testProjection() throws Exception {
+ Assert.assertEquals(256, Projection.mapSize(0f));
+ Assert.assertEquals(512, Projection.mapSize(1f));
+ Assert.assertEquals(256, Projection.getTileSize());
+ }
}
View
42 MapboxAndroidSDKTestApp/src/main/AndroidManifest.xml
@@ -1,34 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.mapbox.mapboxsdk.android.testapp">
+ package="com.mapbox.mapboxsdk.android.testapp">
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
- android:debuggable="true"
- android:allowBackup="true"
- android:hardwareAccelerated="false"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
+ android:debuggable="true"
+ android:allowBackup="true"
+ android:hardwareAccelerated="false"
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme">
<activity
- android:name="com.mapbox.mapboxsdk.android.testapp.MainActivity"
- android:configChanges="orientation|screenSize|uiMode"
- android:label="@string/app_name" >
+ android:name="com.mapbox.mapboxsdk.android.testapp.MainActivity"
+ android:configChanges="orientation|screenSize|uiMode"
+ android:label="@string/app_name">
<intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
- <activity android:name="com.mapbox.mapboxsdk.android.testapp.AlternateMapTestActivity"
- android:label="@string/alternateTestMapActivity">
- </activity>
+ <activity android:name="com.mapbox.mapboxsdk.android.testapp.AlternateMapTestActivity"
+ android:label="@string/alternateTestMapActivity">
+ </activity>
- </application>
+ </application>
</manifest>
View
16 ...KTestApp/src/main/java/com/mapbox/mapboxsdk/android/testapp/AlternateMapTestActivity.java
@@ -11,12 +11,12 @@
import com.mapbox.mapboxsdk.views.MapView;
public class AlternateMapTestActivity extends ActionBarActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_alternatemap);
- MapView mv = (MapView) findViewById(R.id.altMapView);
- mv.setCenter(new LatLng(43.07472, -89.38421));
- mv.setZoom(14);
- }
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_alternatemap);
+ MapView mv = (MapView) findViewById(R.id.altMapView);
+ mv.setCenter(new LatLng(43.07472, -89.38421));
+ mv.setZoom(14);
+ }
}
View
421 MapboxAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/android/testapp/MainActivity.java
@@ -45,23 +45,23 @@ protected void onCreate(Bundle savedInstanceState) {
replaceMapView("test.MBTiles");
addLocationOverlay();
- mv.loadFromGeoJSONURL(
- "https://gist.githubusercontent.com/tmcw/4a6f5fa40ab9a6b2f163/raw/b1ee1e445225fc0a397e2605feda7da74c36161b/map.geojson");
- setButtonListeners();
- Marker m = new Marker(mv, "Edinburgh", "Scotland", new LatLng(55.94629, -3.20777));
- m.setIcon(new Icon(this, Icon.Size.SMALL, "marker-stroked", "FF0000"));
- mv.addMarker(m);
+ mv.loadFromGeoJSONURL(
+ "https://gist.githubusercontent.com/tmcw/4a6f5fa40ab9a6b2f163/raw/b1ee1e445225fc0a397e2605feda7da74c36161b/map.geojson");
+ setButtonListeners();
+ Marker m = new Marker(mv, "Edinburgh", "Scotland", new LatLng(55.94629, -3.20777));
+ m.setIcon(new Icon(this, Icon.Size.SMALL, "marker-stroked", "FF0000"));
+ mv.addMarker(m);
- m = new Marker(mv, "Stockholm", "Sweden", new LatLng(59.32995, 18.06461));
- m.setIcon(new Icon(this, Icon.Size.MEDIUM, "city", "FFFF00"));
- mv.addMarker(m);
+ m = new Marker(mv, "Stockholm", "Sweden", new LatLng(59.32995, 18.06461));
+ m.setIcon(new Icon(this, Icon.Size.MEDIUM, "city", "FFFF00"));
+ mv.addMarker(m);
- m = new Marker(mv, "Prague", "Czech Republic", new LatLng(50.08734, 14.42112));
- m.setIcon(new Icon(this, Icon.Size.LARGE, "land-use", "00FFFF"));
- mv.addMarker(m);
+ m = new Marker(mv, "Prague", "Czech Republic", new LatLng(50.08734, 14.42112));
+ m.setIcon(new Icon(this, Icon.Size.LARGE, "land-use", "00FFFF"));
+ mv.addMarker(m);
- m = new Marker(mv, "Athens", "Greece", new LatLng(37.97885, 23.71399));
- mv.addMarker(m);
+ m = new Marker(mv, "Athens", "Greece", new LatLng(37.97885, 23.71399));
+ mv.addMarker(m);
/*
m = new Marker(mv, "Prague2", "Czech Republic", new LatLng(50.0875, 14.42112));
@@ -69,11 +69,11 @@ protected void onCreate(Bundle savedInstanceState) {
mv.addMarker(m);
*/
- mv.setOnTilesLoadedListener(new TilesLoadedListener() {
- @Override
- public boolean onTilesLoaded() {
- return false;
- }
+ mv.setOnTilesLoadedListener(new TilesLoadedListener() {
+ @Override
+ public boolean onTilesLoaded() {
+ return false;
+ }
@Override
public boolean onTilesLoadStarted() {
@@ -83,208 +83,213 @@ public boolean onTilesLoadStarted() {
});
mv.setVisibility(View.VISIBLE);
- PathOverlay equator = new PathOverlay();
+ PathOverlay equator = new PathOverlay();
equator.addPoint(0, -89);
equator.addPoint(0, 89);
mv.getOverlays().add(equator);
}
- private void setButtonListeners() {
- Button satBut = changeButtonTypeface((Button) findViewById(R.id.satbut));
- satBut.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (!currentLayer.equals("satellite")) {
- replaceMapView(satellite);
- currentLayer = "satellite";
- }
- }
- });
- Button terBut = changeButtonTypeface((Button) findViewById(R.id.terbut));
- terBut.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (!currentLayer.equals("terrain")) {
- replaceMapView(terrain);
- currentLayer = "terrain";
- }
- }
- });
- Button strBut = changeButtonTypeface((Button) findViewById(R.id.strbut));
- strBut.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (!currentLayer.equals("street")) {
- replaceMapView(street);
- currentLayer = "street";
- }
- }
- });
-
- Button altBut = changeButtonTypeface((Button) findViewById(R.id.strAltMap));
- altBut.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent altMapActivity = new Intent(MainActivity.this, AlternateMapTestActivity.class);
- startActivity(altMapActivity);
- }
- });
-
- Button spinButton = changeButtonTypeface((Button) findViewById(R.id.spinButton));
- spinButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- mv.setMapOrientation(mv.getMapOrientation() + 45f);
- }
- });
-
- Button selectBut = changeButtonTypeface((Button) findViewById(R.id.layerselect));
- selectBut.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- AlertDialog.Builder ab = new AlertDialog.Builder(MainActivity.this);
- ab.setTitle("Select Layer");
- ab.setItems(availableLayers, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface d, int choice) {
- replaceMapView(availableLayers[choice]);
- }
+ private void setButtonListeners() {
+ Button satBut = changeButtonTypeface((Button) findViewById(R.id.satbut));
+ satBut.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (!currentLayer.equals("satellite")) {
+ replaceMapView(satellite);
+ currentLayer = "satellite";
+ }
+ }
+ });
+ Button terBut = changeButtonTypeface((Button) findViewById(R.id.terbut));
+ terBut.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (!currentLayer.equals("terrain")) {
+ replaceMapView(terrain);
+ currentLayer = "terrain";
+ }
+ }
+ });
+ Button strBut = changeButtonTypeface((Button) findViewById(R.id.strbut));
+ strBut.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (!currentLayer.equals("street")) {
+ replaceMapView(street);
+ currentLayer = "street";
+ }
+ }
+ });
+
+ Button altBut = changeButtonTypeface((Button) findViewById(R.id.strAltMap));
+ altBut.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Intent altMapActivity =
+ new Intent(MainActivity.this, AlternateMapTestActivity.class);
+ startActivity(altMapActivity);
+ }
+ });
+
+ Button spinButton = changeButtonTypeface((Button) findViewById(R.id.spinButton));
+ spinButton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mv.setMapOrientation(mv.getMapOrientation() + 45f);
+ }
+ });
+
+ Button selectBut = changeButtonTypeface((Button) findViewById(R.id.layerselect));
+ selectBut.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ AlertDialog.Builder ab = new AlertDialog.Builder(MainActivity.this);
+ ab.setTitle("Select Layer");
+ ab.setItems(availableLayers, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface d, int choice) {
+ replaceMapView(availableLayers[choice]);
+ }
+ });
+ ab.show();
+ }
});
- ab.show();
- }
- });
- }
-
- final String[] availableLayers =
- { "OpenStreetMap", "OpenSeaMap", "mapquest", "open-streets-dc.mbtiles", "test.MBTiles" };
-
- protected void replaceMapView(String layer) {
- ITileLayer source;
- BoundingBox box;
- if (layer.toLowerCase().endsWith("mbtiles")) {
- TileLayer mbTileLayer = new MBTilesLayer(this, layer);
- // mv.setTileSource(mbTileLayer);
- mv.setTileSource(new ITileLayer[] {
- mbTileLayer, new WebSourceTileLayer("mapquest",
- "http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png").setName("MapQuest Open Aerial")
- .setAttribution("Tiles courtesy of MapQuest and OpenStreetMap contributors.")
- .setMinimumZoomLevel(1)
- .setMaximumZoomLevel(18)
- });
- box = mbTileLayer.getBoundingBox();
- } else {
- if (layer.equalsIgnoreCase("OpenStreetMap")) {
- source =
- new WebSourceTileLayer("openstreetmap", "http://tile.openstreetmap.org/{z}/{x}/{y}.png")
- .setName("OpenStreetMap")
- .setAttribution("© OpenStreetMap Contributors")
- .setMinimumZoomLevel(1)
- .setMaximumZoomLevel(18);
- } else if (layer.equalsIgnoreCase("OpenSeaMap")) {
- source = new WebSourceTileLayer("openstreetmap",
- "http://tile.openstreetmap.org/seamark/{z}/{x}/{y}.png").setName("OpenStreetMap")
- .setAttribution("© OpenStreetMap Contributors")
- .setMinimumZoomLevel(1)
- .setMaximumZoomLevel(18);
- } else if (layer.equalsIgnoreCase("mapquest")) {
- source = new WebSourceTileLayer("mapquest",
- "http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png").setName(
- "MapQuest Open Aerial")
- .setAttribution("Tiles courtesy of MapQuest and OpenStreetMap contributors.")
- .setMinimumZoomLevel(1)
- .setMaximumZoomLevel(18);
- } else {
- source = new MapboxTileLayer(layer);
- }
- mv.setTileSource(source);
- box = source.getBoundingBox();
}
- // mv.setScrollableAreaLimit(mv.getTileProvider().getBoundingBox());
- mv.setScrollableAreaLimit(box);
- mv.setMinZoomLevel(mv.getTileProvider().getMinimumZoomLevel());
- mv.setMaxZoomLevel(mv.getTileProvider().getMaximumZoomLevel());
- mv.setCenter(mv.getTileProvider().getCenterCoordinate());
- mv.setZoom(0);
- Log.d("MainActivity", "zoomToBoundingBox " + box.toString());
- // mv.zoomToBoundingBox(box);
- }
+
+ final String[] availableLayers = {
+ "OpenStreetMap", "OpenSeaMap", "mapquest", "open-streets-dc.mbtiles", "test.MBTiles"
+ };
+
+ protected void replaceMapView(String layer) {
+ ITileLayer source;
+ BoundingBox box;
+ if (layer.toLowerCase().endsWith("mbtiles")) {
+ TileLayer mbTileLayer = new MBTilesLayer(this, layer);
+ // mv.setTileSource(mbTileLayer);
+ mv.setTileSource(new ITileLayer[] {
+ mbTileLayer, new WebSourceTileLayer("mapquest",
+ "http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png").setName(
+ "MapQuest Open Aerial")
+ .setAttribution("Tiles courtesy of MapQuest and OpenStreetMap contributors.")
+ .setMinimumZoomLevel(1)
+ .setMaximumZoomLevel(18)
+ });
+ box = mbTileLayer.getBoundingBox();
+ } else {
+ if (layer.equalsIgnoreCase("OpenStreetMap")) {
+ source = new WebSourceTileLayer("openstreetmap",
+ "http://tile.openstreetmap.org/{z}/{x}/{y}.png").setName("OpenStreetMap")
+ .setAttribution("© OpenStreetMap Contributors")
+ .setMinimumZoomLevel(1)
+ .setMaximumZoomLevel(18);
+ } else if (layer.equalsIgnoreCase("OpenSeaMap")) {
+ source = new WebSourceTileLayer("openstreetmap",
+ "http://tile.openstreetmap.org/seamark/{z}/{x}/{y}.png").setName(
+ "OpenStreetMap")
+ .setAttribution("© OpenStreetMap Contributors")
+ .setMinimumZoomLevel(1)
+ .setMaximumZoomLevel(18);
+ } else if (layer.equalsIgnoreCase("mapquest")) {
+ source = new WebSourceTileLayer("mapquest",
+ "http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png").setName(
+ "MapQuest Open Aerial")
+ .setAttribution(
+ "Tiles courtesy of MapQuest and OpenStreetMap contributors.")
+ .setMinimumZoomLevel(1)
+ .setMaximumZoomLevel(18);
+ } else {
+ source = new MapboxTileLayer(layer);
+ }
+ mv.setTileSource(source);
+ box = source.getBoundingBox();
+ }
+ // mv.setScrollableAreaLimit(mv.getTileProvider().getBoundingBox());
+ mv.setScrollableAreaLimit(box);
+ mv.setMinZoomLevel(mv.getTileProvider().getMinimumZoomLevel());
+ mv.setMaxZoomLevel(mv.getTileProvider().getMaximumZoomLevel());
+ mv.setCenter(mv.getTileProvider().getCenterCoordinate());
+ mv.setZoom(0);
+ Log.d("MainActivity", "zoomToBoundingBox " + box.toString());
+ // mv.zoomToBoundingBox(box);
+ }
private void addLocationOverlay() {
// Adds an icon that shows location
- UserLocationOverlay myLocationOverlay = new UserLocationOverlay(new GpsLocationProvider(this), mv);
+ UserLocationOverlay myLocationOverlay =
+ new UserLocationOverlay(new GpsLocationProvider(this), mv);
myLocationOverlay.enableMyLocation();
myLocationOverlay.setDrawAccuracyEnabled(true);
mv.getOverlays().add(myLocationOverlay);
}
- private void addLine() {
- // Configures a line
- Paint linePaint = new Paint();
- linePaint.setStyle(Paint.Style.STROKE);
- linePaint.setColor(Color.BLUE);
- linePaint.setStrokeWidth(5);
-
- PathOverlay po = new PathOverlay().setPaint(linePaint);
-
- po.addPoint(startingPoint);
- po.addPoint(new LatLng(51.7, 0.3));
- po.addPoint(new LatLng(51.2, 0));
-
- // Adds line and marker to the overlay
- mv.getOverlays().add(po);
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.activity_main, menu);
-
- return true;
- }
-
- private Button changeButtonTypeface(Button button) {
- //Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/semibold.ttf");
- //button.setTypeface(tf);
- return button;
- }
-
- public LatLng getMapCenter() {
- return mv.getCenter();
- }
-
- public void setMapCenter(ILatLng center) {
- mv.setCenter(center);
- }
-
- /**
- * Method to show settings in alert dialog
- * On pressing Settings button will lauch Settings Options - GPS
- */
- public void showSettingsAlert() {
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(getBaseContext());
-
- // Setting Dialog Title
- alertDialog.setTitle("GPS settings");
-
- // Setting Dialog Message
- alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
-
- // On pressing Settings button
- alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- getBaseContext().startActivity(intent);
- }
- });
-
- // on pressing cancel button
- alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int which) {
- dialog.cancel();
- }
- });
-
- // Showing Alert Message
- alertDialog.show();
- }
+ private void addLine() {
+ // Configures a line
+ Paint linePaint = new Paint();
+ linePaint.setStyle(Paint.Style.STROKE);
+ linePaint.setColor(Color.BLUE);
+ linePaint.setStrokeWidth(5);
+
+ PathOverlay po = new PathOverlay().setPaint(linePaint);
+
+ po.addPoint(startingPoint);
+ po.addPoint(new LatLng(51.7, 0.3));
+ po.addPoint(new LatLng(51.2, 0));
+
+ // Adds line and marker to the overlay
+ mv.getOverlays().add(po);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.activity_main, menu);
+
+ return true;
+ }
+
+ private Button changeButtonTypeface(Button button) {
+ //Typeface tf = Typeface.createFromAsset(this.getAssets(), "fonts/semibold.ttf");
+ //button.setTypeface(tf);
+ return button;
+ }
+
+ public LatLng getMapCenter() {
+ return mv.getCenter();
+ }
+
+ public void setMapCenter(ILatLng center) {
+ mv.setCenter(center);
+ }
+
+ /**
+ * Method to show settings in alert dialog
+ * On pressing Settings button will lauch Settings Options - GPS
+ */
+ public void showSettingsAlert() {
+ AlertDialog.Builder alertDialog = new AlertDialog.Builder(getBaseContext());
+
+ // Setting Dialog Title
+ alertDialog.setTitle("GPS settings");
+
+ // Setting Dialog Message
+ alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
+
+ // On pressing Settings button
+ alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
+ getBaseContext().startActivity(intent);
+ }
+ });
+
+ // on pressing cancel button
+ alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.cancel();
+ }
+ });
+
+ // Showing Alert Message
+ alertDialog.show();
+ }
}
View
16 MapboxAndroidSDKTestApp/src/main/res/layout/activity_alternatemap.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:mapbox="http://schemas.android.com/apk/res-auto"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ xmlns:mapbox="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
- <com.mapbox.mapboxsdk.views.MapView
- android:id="@+id/altMapView"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- mapbox:mapid="@string/mapbox_id"/>
+ <com.mapbox.mapboxsdk.views.MapView
+ android:id="@+id/altMapView"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ mapbox:mapid="@string/mapbox_id"/>
</FrameLayout>
View
128 MapboxAndroidSDKTestApp/src/main/res/layout/activity_main.xml
@@ -1,73 +1,73 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ android:orientation="vertical"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
- <com.mapbox.mapboxsdk.views.MapView
- android:id="@+id/mapview"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
+ <com.mapbox.mapboxsdk.views.MapView
+ android:id="@+id/mapview"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent">
- </com.mapbox.mapboxsdk.views.MapView>
- <LinearLayout
- android:id="@+id/buttonsrow"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:orientation="horizontal"
- android:weightSum="1">
- <Button
- android:id="@+id/satbut"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Sat"
- android:layout_weight="0.25" android:layout_margin="-5dp"
- />
- <Button
- android:id="@+id/terbut"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Terr"
- android:layout_weight="0.25" android:layout_margin="-5dp"
- />
- <Button
- android:id="@+id/strbut"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Street"
- android:layout_weight="0.25"
- />
+ </com.mapbox.mapboxsdk.views.MapView>
+ <LinearLayout
+ android:id="@+id/buttonsrow"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:orientation="horizontal"
+ android:weightSum="1">
+ <Button
+ android:id="@+id/satbut"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Sat"
+ android:layout_weight="0.25" android:layout_margin="-5dp"
+ />
+ <Button
+ android:id="@+id/terbut"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Terr"
+ android:layout_weight="0.25" android:layout_margin="-5dp"
+ />
+ <Button
+ android:id="@+id/strbut"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Street"
+ android:layout_weight="0.25"
+ />
- <Button
- android:id="@+id/strAltMap"
- android:layout_width="fill_parent"