├── toolkit-test-app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_launcher_round.png
│ │ │ │ └── ic_launcher_foreground.png
│ │ │ ├── drawable
│ │ │ │ ├── floor_filter_rounded_background.xml
│ │ │ │ ├── ic_x_24.xml
│ │ │ │ ├── ic_x_circle_24.xml
│ │ │ │ ├── ic_save_24.xml
│ │ │ │ ├── ic_pencil_24.xml
│ │ │ │ ├── ic_trash_24.xml
│ │ │ │ ├── ic_home_black_24dp.xml
│ │ │ │ ├── ic_dashboard_black_24dp.xml
│ │ │ │ ├── ic_build.xml
│ │ │ │ └── ic_notifications_black_24dp.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_arcgissceneview.xml
│ │ │ │ ├── number_dialog.xml
│ │ │ │ ├── toolkit_main.xml
│ │ │ │ ├── activity_arcgisarview.xml
│ │ │ │ ├── scalebar_layout_controls.xml
│ │ │ │ ├── compass_regular_sceneview.xml
│ │ │ │ ├── activity_floorfilter.xml
│ │ │ │ ├── activity_popup.xml
│ │ │ │ ├── compass_custom1_mapview.xml
│ │ │ │ ├── layout_controls.xml
│ │ │ │ ├── compass_custom1_sceneview.xml
│ │ │ │ ├── activity_bookmark.xml
│ │ │ │ ├── compass_custom2_mapview.xml
│ │ │ │ ├── compass_custom2_sceneview.xml
│ │ │ │ ├── scalebar_custom1.xml
│ │ │ │ └── scalebar_custom2.xml
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── styles.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── arrays.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── menu
│ │ │ │ ├── arcgisarview_menu.xml
│ │ │ │ ├── compass_options.xml
│ │ │ │ └── scalebar_options.xml
│ │ │ └── layout-land
│ │ │ │ ├── scalebar_layout_controls.xml
│ │ │ │ ├── layout_controls.xml
│ │ │ │ ├── compass_regular_sceneview.xml
│ │ │ │ ├── compass_custom1_mapview.xml
│ │ │ │ ├── compass_custom1_sceneview.xml
│ │ │ │ ├── compass_custom2_mapview.xml
│ │ │ │ ├── compass_custom2_sceneview.xml
│ │ │ │ └── scalebar_custom1.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── esri
│ │ │ │ └── arcgisruntime
│ │ │ │ └── toolkit
│ │ │ │ └── test
│ │ │ │ ├── bookmark
│ │ │ │ ├── map
│ │ │ │ │ └── MapViewModel.kt
│ │ │ │ └── BookmarkActivity.kt
│ │ │ │ ├── popup
│ │ │ │ └── adapters
│ │ │ │ │ └── BindingAdapters.kt
│ │ │ │ ├── MapOrSceneDialogFragment.java
│ │ │ │ ├── compass
│ │ │ │ └── CompassAutoHideDialogFragment.java
│ │ │ │ └── scalebar
│ │ │ │ ├── ScalebarUnitSystemDialogFragment.java
│ │ │ │ └── ScalebarAlignmentDialogFragment.java
│ │ └── AndroidManifest.xml
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── esri
│ │ └── arcgisruntime
│ │ └── toolkit
│ │ └── test
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── arcgis-android-toolkit
├── .gitignore
└── src
│ ├── main
│ ├── res
│ │ ├── drawable-hdpi
│ │ │ └── ic_compass.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_compass.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_compass.png
│ │ ├── drawable-xxhdpi
│ │ │ └── ic_compass.png
│ │ ├── drawable
│ │ │ ├── floor_filter_rounded_background.xml
│ │ │ ├── ic_site_facility_24.xml
│ │ │ ├── ic_chevron_left_32.xml
│ │ │ ├── ic_chevron_right_32.xml
│ │ │ ├── ic_search_32.xml
│ │ │ ├── ic_x_24.xml
│ │ │ ├── ic_x_32.xml
│ │ │ └── instructions_label_bg.xml
│ │ ├── layout
│ │ │ ├── layout_arcgisarview.xml
│ │ │ ├── layout_popupview.xml
│ │ │ ├── item_level_row.xml
│ │ │ ├── layout_bookmarkview.xml
│ │ │ ├── item_bookmark_row.xml
│ │ │ ├── item_site_facility_row.xml
│ │ │ └── layout_floorfilterview.xml
│ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── public.xml
│ │ │ ├── integers.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ ├── styles.xml
│ │ │ └── attrs.xml
│ ├── java
│ │ └── com
│ │ │ └── esri
│ │ │ └── arcgisruntime
│ │ │ └── toolkit
│ │ │ ├── extension
│ │ │ ├── ClassExtensions.kt
│ │ │ ├── ArcGISExtensions.kt
│ │ │ └── NumberExtensions.kt
│ │ │ ├── scalebar
│ │ │ ├── Multiplier.kt
│ │ │ ├── Constants.kt
│ │ │ └── style
│ │ │ │ └── renderer
│ │ │ │ ├── LineRenderer.kt
│ │ │ │ └── BarRenderer.kt
│ │ │ ├── floorfilter
│ │ │ └── Constants.kt
│ │ │ └── util
│ │ │ └── Event.kt
│ └── AndroidManifest.xml
│ └── androidTest
│ ├── res
│ ├── values
│ │ ├── colors.xml
│ │ ├── styles.xml
│ │ └── dimens.xml
│ └── layout
│ │ ├── activity_arcgisarview_test.xml
│ │ ├── unit_test_scalebar_no_attrs.xml
│ │ ├── unit_test_compass_no_attrs.xml
│ │ ├── unit_test_compass_fully_populated.xml
│ │ └── unit_test_scalebar_fully_populated.xml
│ ├── java
│ └── com
│ │ └── esri
│ │ └── arcgisruntime
│ │ └── toolkit
│ │ ├── TestConstants.kt
│ │ ├── TestActivity.kt
│ │ ├── ar
│ │ └── ArcGISArViewTestActivity.kt
│ │ ├── TestExtensions.kt
│ │ └── extension
│ │ └── ArcGISExtensionsTest.kt
│ └── AndroidManifest.xml
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── script
│ ├── versions.gradle
│ └── artifact.gradle
├── CONTRIBUTING.md
├── .github
└── CONTRIBUTING.md
├── Documentation
├── Compass
│ ├── Images
│ │ ├── CompassTestLandscape.png
│ │ ├── CompassTestPortrait.png
│ │ └── CompassTestMenuOptions.png
│ ├── testing.md
│ └── readme.md
├── Scalebar
│ ├── Images
│ │ ├── ScalebarTestLandscape.png
│ │ ├── ScalebarTestPortrait.png
│ │ ├── ScalebarTestMenuOptions.png
│ │ └── ScalebarTestSelectBasemap.png
│ └── testing.md
├── AugmentedReality
│ └── Images
│ │ └── display-scene-in-tabletop-ar.png
├── readme.md
├── testing.md
├── Bookmarks
│ └── README.md
└── setup.md
├── proguard-multidex-rules.pro
├── .gitignore
├── settings.gradle
├── gradle.properties
└── gradlew.bat
/toolkit-test-app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /.settings
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing).
2 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing).
--------------------------------------------------------------------------------
/Documentation/Compass/Images/CompassTestLandscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/Documentation/Compass/Images/CompassTestLandscape.png
--------------------------------------------------------------------------------
/Documentation/Compass/Images/CompassTestPortrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/Documentation/Compass/Images/CompassTestPortrait.png
--------------------------------------------------------------------------------
/Documentation/Compass/Images/CompassTestMenuOptions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/Documentation/Compass/Images/CompassTestMenuOptions.png
--------------------------------------------------------------------------------
/Documentation/Scalebar/Images/ScalebarTestLandscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/Documentation/Scalebar/Images/ScalebarTestLandscape.png
--------------------------------------------------------------------------------
/Documentation/Scalebar/Images/ScalebarTestPortrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/Documentation/Scalebar/Images/ScalebarTestPortrait.png
--------------------------------------------------------------------------------
/Documentation/Scalebar/Images/ScalebarTestMenuOptions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/Documentation/Scalebar/Images/ScalebarTestMenuOptions.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Documentation/Scalebar/Images/ScalebarTestSelectBasemap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/Documentation/Scalebar/Images/ScalebarTestSelectBasemap.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable-hdpi/ic_compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/arcgis-android-toolkit/src/main/res/drawable-hdpi/ic_compass.png
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable-mdpi/ic_compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/arcgis-android-toolkit/src/main/res/drawable-mdpi/ic_compass.png
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable-xhdpi/ic_compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/arcgis-android-toolkit/src/main/res/drawable-xhdpi/ic_compass.png
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable-xxhdpi/ic_compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/arcgis-android-toolkit/src/main/res/drawable-xxhdpi/ic_compass.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/Documentation/AugmentedReality/Images/display-scene-in-tabletop-ar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/Documentation/AugmentedReality/Images/display-scene-in-tabletop-ar.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Esri/arcgis-runtime-toolkit-android/HEAD/toolkit-test-app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/floor_filter_rounded_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/res/layout/activity_arcgisarview_test.xml:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable/floor_filter_rounded_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/proguard-multidex-rules.pro:
--------------------------------------------------------------------------------
1 | # We need to make sure these classes are available in the main DEX file for API 19
2 | -keep @org.junit.runner.RunWith public class *
3 | -keep class android.support.test.internal** { *; }
4 | -keep class org.junit.** { *; }
5 | -keep public class com.esri.arcgisruntime.toolkit.** { *; }
6 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/activity_arcgissceneview.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_x_24.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #Android specifics
2 |
3 | # build artifacts
4 | /build
5 | /captures
6 | .externalNativeBuild
7 |
8 | # Local configuration file (sdk path, etc)
9 | /local.properties
10 | .gradle
11 |
12 | # Proguard folder generated by Eclipse
13 | proguard/
14 |
15 | # IDE project files
16 | *.iml
17 | .idea/
18 | .project
19 | .classpath
20 | bin/
21 | gen/
22 | /.settings
23 | .vscode/
24 |
25 | # OS generated files #
26 | ######################
27 | .DS_Store
28 | .DS_Store?
29 | ._*
30 | .Spotlight-V100
31 | .Trashes
32 | Icon?
33 | ehthumbs.db
34 | Thumbs.db
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/res/layout/unit_test_scalebar_no_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_x_circle_24.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/layout/layout_arcgisarview.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_save_24.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | include ':arcgis-android-toolkit', ':toolkit-test-app'
18 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable/ic_site_facility_24.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_pencil_24.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_trash_24.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019 Esri
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | #Tue Aug 27 09:42:42 BST 2019
18 | distributionBase=GRADLE_USER_HOME
19 | distributionPath=wrapper/dists
20 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
21 | zipStoreBase=GRADLE_USER_HOME
22 | zipStorePath=wrapper/dists
23 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | 20sp
19 | 80dp
20 | 0dp
21 |
22 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | #3F51B5
20 | #303F9F
21 | #FF4081
22 |
23 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 16dp
20 | 16dp
21 |
22 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | #EEFF00
20 |
21 |
22 | #30ffffff
23 |
24 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/java/com/esri/arcgisruntime/toolkit/TestConstants.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit
18 |
19 | internal const val MISSING_ILLEGAL_ARGUMENT_EXCEPTION = "IllegalArgumentException should have been thrown"
20 |
21 | internal const val MISSING_ILLEGAL_STATE_EXCEPTION = "IllegalStateException should have been thrown"
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/java/com/esri/arcgisruntime/toolkit/TestActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit
18 |
19 | import androidx.appcompat.app.AppCompatActivity
20 |
21 | /**
22 | * An Activity that can be used to obtain a Context that is an Activity.
23 | *
24 | * @since 100.6.0
25 | */
26 | class TestActivity : AppCompatActivity()
27 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/toolkit-test-app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Applications/AndroidSDK/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable/ic_chevron_left_32.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable/ic_chevron_right_32.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/layout/layout_popupview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
23 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_home_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/layout/item_level_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Documentation/readme.md:
--------------------------------------------------------------------------------
1 | # Documentation
2 |
3 | This folder contains guides for using toolkit components. These components assist in the development of apps using [ArcGIS Runtime SDK for Android](https://developers.arcgis.com/android/).
4 |
5 | To prepare your app to use Toolkit, see the **[setup instructions](./setup.md)**.
6 |
7 | ## Components
8 |
9 | * **[Augmented reality (ArcGISArView)](AugmentedReality)** - Integrates SceneView with ARCore to enable augmented reality (AR)
10 | * **[Bookmarks](Bookmarks)** - Displays the bookmarks present in a map
11 | * **[Compass](Compass)** - Shows the current orientation of a map or scene by displaying a compass icon that points towards North
12 | * **[Scalebar](Scalebar)** - Displays the representation of an accurate linear measurement on a map
13 | * **[FloorFilterView](FloorFilterView)** - Displays a control to filter floor aware maps by site, facility, and level
14 |
15 | ## Testing
16 |
17 | Most Toolkit components have a test activity in the [Toolkit test app](./testing.md):
18 |
19 | * [Compass](Compass/testing.md)
20 | * [Scalebar](Scalebar/testing.md)
21 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/layout/layout_bookmarkview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
23 |
24 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/extension/ClassExtensions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.extension
18 |
19 | /**
20 | * Extension property that provides a String representing a class name. To be used for Android Logs.
21 | *
22 | * @since 100.6.0
23 | */
24 | val Any.logTag: String
25 | get() {
26 | (this::class.simpleName)?.let {
27 | return it
28 | }
29 | return "Unknown class"
30 | }
31 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_dashboard_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable/ic_search_32.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
9 |
10 |
11 |
15 |
18 |
19 |
23 |
24 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/values/public.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable/ic_x_24.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable/ic_x_32.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/values/integers.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | -20.0
20 | 20.0
21 | -10.0
22 | 10.0
23 |
24 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_build.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/res/layout/unit_test_compass_no_attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
23 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/drawable/ic_notifications_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/number_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
23 |
29 |
30 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/drawable/instructions_label_bg.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
20 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 16sp
20 |
21 |
22 | 8dp
23 | 12dp
24 | 8dp
25 | 8dp
26 |
27 |
28 | 5dp
29 | 2dp
30 |
31 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/res/layout/unit_test_compass_fully_populated.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/scalebar/Multiplier.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.scalebar
18 |
19 | /**
20 | * Container for a "multiplier" and the array of segment options appropriate for that multiplier. The multiplier is
21 | * used when calculating the length of a scalebar or the number of segments in the scalebar.
22 | *
23 | * @property multiplier used when calculating the length of a scalebar or the number of segments in the scalebar
24 | * @property segmentOptions the array of segment options appropriate for the multiplier
25 | * @since 100.5.0
26 | */
27 | internal class Multiplier(val multiplier: Double, val segmentOptions: IntArray)
28 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/menu/arcgisarview_menu.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
30 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/extension/ArcGISExtensions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.extension
18 |
19 | import com.esri.arcgisruntime.UnitSystem
20 |
21 | /**
22 | * Return an instance of [UnitSystem] mapped by an int. Must be 0 for [UnitSystem.IMPERIAL] or 1 for [UnitSystem.METRIC].
23 | *
24 | * @throws IllegalArgumentException if an int that is neither 0 or 1 is supplied.
25 | * @since 100.5.0
26 | */
27 | internal fun unitSystemFromInt(value: Int): UnitSystem {
28 | return when (value) {
29 | 0 -> UnitSystem.IMPERIAL
30 | 1 -> UnitSystem.METRIC
31 | else -> throw IllegalArgumentException("No valid Integer supplied to return a UnitSystem.")
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
26 |
27 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/layout/item_bookmark_row.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
25 |
26 |
31 |
32 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Documentation/testing.md:
--------------------------------------------------------------------------------
1 | # Toolkit test app
2 |
3 | ## Instructions
4 |
5 | This app displays a list of activities that are used to test the toolkit components. To test a component, select the corresponding test activity from the list.
6 |
7 | ## Add a new test activity
8 |
9 | 1. Create a subdirectory of `com.esri.arcgisruntime.toolkit.test` to hold the new activity, for example
10 | `com.esri.arcgisruntime.toolkit.test.foo`.
11 | 2. Put all the source code for the new activity in the new subdirectory.
12 | 3. Add the new activity to the `Android.Manifest.xml` file, for example:
13 |
14 | ```xml
15 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | ```
26 |
27 | 4. Add an item containing the fully-qualified class name of the new activity to `activityClassNames` in
28 | **res/values/arrays.xml**, for example:
29 |
30 | ```xml
31 | com.esri.arcgisruntime.toolkit.test.foo.FooTestActivity
32 | ```
33 |
34 | 5. When you create resource files for the new activity, give them all a prefix that identifies the activity that uses them, for example **foo_layout1.xml**.
35 | 6. Add documentation in the [Documentation directory](./readme.md) for the test.
36 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/toolkit_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
22 |
23 |
28 |
29 |
36 |
37 |
--------------------------------------------------------------------------------
/gradle/script/versions.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ext {
18 | droid = ext {
19 | minSdk = 23
20 | targetSdk = 31
21 | androidGradlePlugin = "7.0.2"
22 | androidMavenGradlePlugin = "2.1"
23 | dokka = "0.9.18"
24 | constraintLayout = "2.1.3"
25 | multiDex = "2.0.1"
26 | testRunner = "1.4.0"
27 | arCore = "1.30.0"
28 | arCoreSceneForm = "1.17.1"
29 | lifecycle = "2.4.1"
30 | appcompat = "1.4.1"
31 | material = "1.5.0"
32 | vectordrawable = "1.1.0"
33 | annotation = "1.2.0"
34 | recyclerview = "1.2.1"
35 | nav_version = "2.4.2"
36 | }
37 | test = ext {
38 | espresso = "3.1.0"
39 | jUnit = "1.1.3"
40 | rules = "1.4.0"
41 | }
42 | kotlin_version = "1.6.10"
43 | kotlin_reflect = "1.6.10"
44 | kotlin_coroutines = "1.6.1"
45 | arcgis = "100.15.0"
46 | }
47 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 | ARCore is unsupported: %s
22 | %s permission has been permanently denied
23 |
24 |
25 | Elevation
26 | Heading
27 |
28 |
29 | Search…
30 | Select a site
31 | Select a facility
32 | No results found.
33 |
34 |
--------------------------------------------------------------------------------
/gradle/script/artifact.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | ext {
18 | _versionCode = 117
19 | _versionName = "100.15.0"
20 | _fullVersion = getFullVersion() // e.g. 100.9.0-1234
21 | _groupId = "com.esri.arcgisruntime"
22 | _artifactId = 'arcgis-android-toolkit'
23 | }
24 |
25 | // Returns the full version number, including the build number, for example 100.9.0-1234 by looking
26 | // for the build number defined by one of the following options:
27 | // - BUILDNUM property passed through command line
28 | // - BUILDNUM property read from GRADLE_HOME/gradle.properties or local gradle.properties
29 | // - BUILDNUM set as system environment variable
30 | String getFullVersion() {
31 | def buildNumber = "1"
32 | if (project.hasProperty("BUILDNUM")) {
33 | buildNumber = project.findProperty("BUILDNUM") ?: "1"
34 | } else {
35 | buildNumber = System.getenv("BUILDNUM") ?: "1"
36 | }
37 | return _versionName + "-" + buildNumber
38 | }
39 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/activity_arcgisarview.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
21 |
22 |
26 |
27 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/menu/compass_options.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
41 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/java/com/esri/arcgisruntime/toolkit/ar/ArcGISArViewTestActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.ar
18 |
19 | import android.os.Bundle
20 | import androidx.annotation.VisibleForTesting
21 | import androidx.appcompat.app.AppCompatActivity
22 | import com.esri.arcgisruntime.toolkit.ar.ArcGISArView
23 | import com.esri.arcgisruntime.toolkit.test.R
24 |
25 | /**
26 | * Activity used by tests to test [ArcGISArView]. An instance of ArcGISArView is inflated from an XML layout and attached
27 | * to the Activity.
28 | *
29 | * @since 100.6.0
30 | */
31 | class ArcGISArViewTestActivity : AppCompatActivity() {
32 |
33 | @VisibleForTesting
34 | var arcGISArView: ArcGISArView? = null
35 |
36 | override fun onCreate(savedInstanceState: Bundle?) {
37 | super.onCreate(savedInstanceState)
38 | setContentView(R.layout.activity_arcgisarview_test)
39 | arcGISArView = findViewById(R.id.arcGISArView)
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/androidTest/java/com/esri/arcgisruntime/toolkit/test/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.test;
18 |
19 | import android.content.Context;
20 | import androidx.test.platform.app.InstrumentationRegistry;
21 | import androidx.test.ext.junit.runners.AndroidJUnit4;
22 |
23 | import org.junit.Test;
24 | import org.junit.runner.RunWith;
25 |
26 | import static org.junit.Assert.*;
27 |
28 | /**
29 | * Instrumented test, which will execute on an Android device.
30 | *
31 | * @see Testing documentation
32 | */
33 | @RunWith(AndroidJUnit4.class)
34 | public class ExampleInstrumentedTest {
35 | @Test
36 | public void useAppContext() throws Exception {
37 | // Context of the app under test.
38 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
39 |
40 | assertEquals("com.esri.arcgisruntime.toolkit", appContext.getPackageName());
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/java/com/esri/arcgisruntime/toolkit/TestExtensions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit
18 |
19 | import android.app.Activity
20 | import androidx.test.rule.ActivityTestRule
21 |
22 | /**
23 | * Extension method to invoke finish on the Activity belonging to the ActivityTestRule.
24 | *
25 | * @since 100.6.0
26 | */
27 | fun ActivityTestRule.finish() {
28 | this.activity?.finish()
29 | }
30 |
31 | /**
32 | * Extension method to launch the Activity belonging to the ActivityTestRule using the Intent that will be used to start
33 | * the Activity under test.
34 | *
35 | * @since 100.6.0
36 | */
37 | fun ActivityTestRule.launchActivity() {
38 | this.launchActivity(activity?.intent)
39 | }
40 |
41 | /**
42 | * Extension method to relaunch the Activity belonging to the ActivityTestRule by finishing it and launching it again.
43 | *
44 | * @since 100.6.0
45 | */
46 | fun ActivityTestRule.relaunchActivity() {
47 | this.finish()
48 | this.launchActivity()
49 | }
50 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/java/com/esri/arcgisruntime/toolkit/test/bookmark/map/MapViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.test.bookmark.map
18 |
19 | import androidx.lifecycle.LiveData
20 | import androidx.lifecycle.MutableLiveData
21 | import androidx.lifecycle.ViewModel
22 | import com.esri.arcgisruntime.mapping.ArcGISMap
23 | import com.esri.arcgisruntime.mapping.BookmarkList
24 | import com.esri.arcgisruntime.portal.Portal
25 | import com.esri.arcgisruntime.portal.PortalItem
26 |
27 | class MapViewModel : ViewModel() {
28 |
29 | val map: ArcGISMap by lazy {
30 | val portal = Portal("https://arcgisruntime.maps.arcgis.com/")
31 | val portalItem = PortalItem(portal, "16f1b8ba37b44dc3884afc8d5f454dd2")
32 | val map = ArcGISMap(portalItem)
33 | map.addDoneLoadingListener{
34 | _bookmarks.postValue(map.bookmarks)
35 | }
36 | map
37 | }
38 |
39 | private val _bookmarks: MutableLiveData = MutableLiveData()
40 | val bookmarks: LiveData
41 | get() {
42 | return _bookmarks
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/res/layout/unit_test_scalebar_fully_populated.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout-land/scalebar_layout_controls.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
23 |
24 |
31 |
32 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/java/com/esri/arcgisruntime/toolkit/test/popup/adapters/BindingAdapters.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.test.popup.adapters
18 |
19 | import android.util.Log
20 | import android.widget.ImageView
21 | import androidx.databinding.BindingAdapter
22 | import androidx.lifecycle.LiveData
23 | import com.esri.arcgisruntime.mapping.popup.Popup
24 |
25 | /**
26 | * Sets the popup symbol of the identified feature popup in the bottom sheet when in the collapsed
27 | * state.
28 | */
29 | @BindingAdapter("app:imageBitmap")
30 | fun setImageBitmap(imageView: ImageView, identifiedPopup: LiveData) {
31 |
32 | identifiedPopup.value?.let {
33 | val symbolFuture =
34 | it.symbol.createSwatchAsync(
35 | 14, 14,
36 | imageView.context.resources.displayMetrics.density,
37 | 0x00000000
38 | )
39 | symbolFuture.addDoneListener {
40 | try {
41 | val symbol = symbolFuture.get()
42 | imageView.setImageBitmap(symbol)
43 | } catch (e: Exception) {
44 | Log.i("PopupView", "Error creating swatch for the popup symbol ${e.message}")
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/androidTest/java/com/esri/arcgisruntime/toolkit/extension/ArcGISExtensionsTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.extension
18 |
19 | import androidx.test.ext.junit.runners.AndroidJUnit4
20 | import com.esri.arcgisruntime.UnitSystem
21 | import junit.framework.Assert.assertSame
22 | import org.junit.Test
23 | import org.junit.runner.RunWith
24 |
25 | /**
26 | * Instrumented unit tests for ArcGISExtensions
27 | *
28 | * @since 100.5.0
29 | */
30 | @RunWith(AndroidJUnit4::class)
31 | class ArcGISExtensionsTest {
32 |
33 | /**
34 | * Tests that the supplied ints map to the correct [UnitSystem].
35 | *
36 | * @since 100.5.0
37 | */
38 | @Test
39 | fun unitSystemFromIntMappingCorrect() {
40 | assertSame(unitSystemFromInt(0), UnitSystem.IMPERIAL)
41 | assertSame(unitSystemFromInt(1), UnitSystem.METRIC)
42 | }
43 |
44 | /**
45 | * Tests that an [IllegalArgumentException] is thrown when [unitSystemFromInt] is provided with an int that is neither
46 | * 0 or 1.
47 | *
48 | * @since 100.5.0
49 | */
50 | @Test(expected = IllegalArgumentException::class)
51 | fun unitSystemFromIntInvalidArgumentThrowsException() {
52 | unitSystemFromInt(-1)
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/scalebar_layout_controls.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
21 |
22 |
25 |
26 |
31 |
32 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/floorfilter/Constants.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.floorfilter
18 |
19 | import android.graphics.Typeface
20 |
21 | internal const val DEFAULT_MAX_DISPLAY_LEVELS = -1
22 | internal const val DEFAULT_BUTTON_HEIGHT_DP = 40
23 | internal const val DEFAULT_BUTTON_WIDTH_DP = 48
24 |
25 | internal val DEFAULT_TYPEFACE = Typeface.DEFAULT
26 | internal const val DEFAULT_TEXT_SIZE_SP = 16
27 |
28 | internal const val DEFAULT_HIDE_SITE_FACILITY_BUTTON = false
29 | internal const val DEFAULT_HIDE_SITE_SEARCH = false
30 | internal const val DEFAULT_HIDE_FACILITY_SEARCH = false
31 | internal const val DEFAULT_HIDE_CLOSE_BUTTON = false
32 | internal val DEFAULT_CLOSE_BUTTON_POSITION = FloorFilterView.ButtonPosition.TOP
33 |
34 | internal const val DEFAULT_TEXT_COLOR = 0xFF6A6A6A.toInt() // dark gray
35 | internal const val DEFAULT_SELECTED_TEXT_COLOR = 0xFF005E95.toInt() // dark blue
36 | internal const val DEFAULT_BUTTON_BACKGROUND_COLOR = 0xFFFFFFFF.toInt() // white
37 | internal const val DEFAULT_SELECTED_BUTTON_BACKGROUND_COLOR = 0xFFE2F1FB.toInt() // light blue
38 | internal const val DEFAULT_CLOSE_BUTTON_BACKGROUND_COLOR = 0xFFE7E7E7.toInt() // light gray
39 | internal const val DEFAULT_SEARCH_BACKGROUND_COLOR = 0xFFF3F3F3.toInt() // very light gray
40 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
21 |
22 |
26 |
27 |
34 |
35 |
44 |
45 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/java/com/esri/arcgisruntime/toolkit/test/bookmark/BookmarkActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.test.bookmark
18 |
19 | import android.os.Bundle
20 | import androidx.activity.viewModels
21 | import androidx.appcompat.app.AppCompatActivity
22 | import androidx.databinding.DataBindingUtil
23 | import com.esri.arcgisruntime.mapping.Bookmark
24 | import com.esri.arcgisruntime.toolkit.bookmark.BookmarkView
25 | import com.esri.arcgisruntime.toolkit.test.R
26 | import com.esri.arcgisruntime.toolkit.test.bookmark.map.MapViewModel
27 | import com.esri.arcgisruntime.toolkit.test.databinding.ActivityBookmarkBinding
28 |
29 | class BookmarkActivity : AppCompatActivity(), BookmarkView.OnItemClickListener {
30 | private lateinit var binding: ActivityBookmarkBinding
31 |
32 | override fun onCreate(savedInstanceState: Bundle?) {
33 | super.onCreate(savedInstanceState)
34 |
35 | binding = DataBindingUtil.setContentView(this, R.layout.activity_bookmark)
36 | val mapViewModel: MapViewModel by viewModels()
37 |
38 | binding.mapViewModel = mapViewModel
39 | binding.lifecycleOwner = this
40 |
41 | binding.bookmarkView.onItemClickListener = this
42 | }
43 |
44 | override fun onItemClick(item: Bookmark) {
45 | binding.mapView.setViewpointAsync(item.viewpoint)
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019 Esri
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # you may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # http://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and
14 | # limitations under the License.
15 | #
16 |
17 | # Project-wide Gradle settings.
18 |
19 | # IDE (e.g. Android Studio) users:
20 | # Settings specified in this file will override any Gradle settings
21 | # configured through the IDE.
22 |
23 | # For more details on how to configure your build environment visit
24 | # http://www.gradle.org/docs/current/userguide/build_environment.html
25 |
26 | # Specifies the JVM arguments used for the daemon process.
27 | # The setting is particularly useful for tweaking memory settings.
28 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
29 | org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
30 |
31 | # When configured, Gradle will run in incubating parallel mode.
32 | # This option should only be used with decoupled projects. More details, visit
33 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
34 | # org.gradle.parallel=true
35 |
36 | # AndroidX package structure to make it clearer which packages are bundled with the
37 | # Android operating system, and which are packaged with your app's APK
38 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
39 | android.useAndroidX=true
40 | # Automatically convert third-party libraries to use AndroidX
41 | android.enableJetifier=true
42 | # Kotlin code style for this project: "official" or "obsolete":
43 | kotlin.code.style=official
44 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
25 |
28 |
29 |
31 |
34 |
35 |
36 |
40 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/layout/item_site_facility_row.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
25 |
26 |
33 |
34 |
41 |
42 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/scalebar/Constants.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.scalebar
18 |
19 | import android.graphics.Color
20 | import android.graphics.Typeface
21 | import com.esri.arcgisruntime.UnitSystem
22 | import com.esri.arcgisruntime.geometry.LinearUnit
23 | import com.esri.arcgisruntime.geometry.LinearUnitId
24 | import com.esri.arcgisruntime.toolkit.scalebar.style.Style
25 |
26 | internal const val SHADOW_OFFSET_PIXELS = 2f
27 | internal const val LABEL_X_PAD_DP = 6
28 | internal const val SCALEBAR_X_PAD_DP = 10
29 | internal val LINEAR_UNIT_METERS = LinearUnit(LinearUnitId.METERS)
30 | internal val LINEAR_UNIT_FEET = LinearUnit(LinearUnitId.FEET)
31 | private const val ALPHA_50_PC = -0x80000000
32 | internal val DEFAULT_STYLE = Style.ALTERNATING_BAR
33 | internal val DEFAULT_ALIGNMENT = Scalebar.Alignment.LEFT
34 | internal const val DEFAULT_FILL_COLOR = Color.LTGRAY or ALPHA_50_PC
35 | internal const val DEFAULT_ALTERNATE_FILL_COLOR = Color.BLACK
36 | internal const val DEFAULT_LINE_COLOR = Color.WHITE
37 | internal const val DEFAULT_SHADOW_COLOR = Color.BLACK or ALPHA_50_PC
38 | internal const val DEFAULT_TEXT_COLOR = Color.BLACK
39 | internal const val DEFAULT_TEXT_SHADOW_COLOR = Color.WHITE
40 | internal val DEFAULT_TYPEFACE = Typeface.DEFAULT_BOLD
41 | internal val DEFAULT_UNIT_SYSTEM = UnitSystem.METRIC
42 | internal const val DEFAULT_BAR_HEIGHT_DP = 10
43 | internal const val SCALEBAR_Y_PAD_DP = 10
44 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/layout/layout_floorfilterview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
23 |
24 |
32 |
33 |
43 |
44 |
49 |
50 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/compass_regular_sceneview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
35 |
36 |
44 |
45 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/Documentation/Bookmarks/README.md:
--------------------------------------------------------------------------------
1 | # Bookmarks
2 |
3 | The Bookmarks component shows the list of a map's bookmarks in a RecyclerView and allows the user to select
4 | a bookmark and perform some action.
5 |
6 | ## Workflow
7 |
8 | The app can define the `BookmarkView` in its view hierarchy, as `BookmarkView` extends FrameLayout. The app
9 | has to set the `bookmarks` property on the `BookmarkView` with the map's bookmarks. To handle the event when the
10 | user taps on an item in the list, the app has to implement `BookmarkView.onItemClickListener` interface.
11 |
12 | Here is an example XML code that shows the BookMarkView and the BookmarkView's bookmarks attribute
13 | being bound to `map.bookmarks` via mapViewModel's bookmarks property:
14 |
15 | ```xml
16 |
17 |
20 |
21 |
22 |
23 | .....
24 |
25 |
34 |
35 | .....
36 | ```
37 |
38 | Here is example Kotlin code to set the activity that implements the BookmarkView's onItemClickListener interface as the
39 | onItemClickListener and implementing the `onItemClick()`
40 |
41 | ```kotlin
42 | class BookmarkActivity : AppCompatActivity(), BookmarkView.OnItemClickListener {
43 |
44 | override fun onCreate(savedInstanceState: Bundle?) {
45 | super.onCreate(savedInstanceState)
46 | ...
47 | ...
48 |
49 | bookmarkView.onItemClickListener = this
50 | }
51 |
52 | override fun onItemClick(item: Bookmark) {
53 | mapView.setViewpointAsync(item.viewpoint)
54 | }
55 |
56 | ```
57 |
58 | To see it in action, try out the bookmark test in the [toolkit-test-app](https://github.com/Esri/arcgis-runtime-toolkit-android/tree/master/toolkit-test-app/src/main/java/com/esri/arcgisruntime/toolkit/test)
59 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/activity_floorfilter.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
19 |
20 |
24 |
25 |
33 |
34 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/activity_popup.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
20 |
23 |
24 |
28 |
29 |
44 |
45 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/scalebar/style/renderer/LineRenderer.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.scalebar.style.renderer
18 |
19 | import android.graphics.Canvas
20 | import android.graphics.Paint
21 | import com.esri.arcgisruntime.UnitSystem
22 | import com.esri.arcgisruntime.geometry.LinearUnit
23 | import com.esri.arcgisruntime.toolkit.extension.asDistanceString
24 | import com.esri.arcgisruntime.toolkit.scalebar.style.Style
25 | import com.esri.arcgisruntime.toolkit.scalebar.style.Style.LINE
26 |
27 | /**
28 | * Renders a [LINE] style scalebar.
29 | *
30 | * @see Style.LINE
31 | *
32 | * @since 100.5.0
33 | */
34 | class LineRenderer : ScalebarRenderer() {
35 |
36 | override val isSegmented: Boolean = false
37 |
38 | override fun drawScalebar(
39 | canvas: Canvas,
40 | left: Float,
41 | top: Float,
42 | right: Float,
43 | bottom: Float,
44 | distance: Double,
45 | displayUnits: LinearUnit,
46 | unitSystem: UnitSystem,
47 | lineWidthPx: Int,
48 | cornerRadiusPx: Int,
49 | textSizePx: Int,
50 | fillColor: Int,
51 | alternateFillColor: Int,
52 | shadowColor: Int,
53 | lineColor: Int,
54 | textPaint: Paint,
55 | displayDensity: Float
56 | ) {
57 |
58 | // Draw the line and its shadow, including the ticks at each end
59 | drawLineAndShadow(canvas, left, top, right, bottom, lineWidthPx, lineColor, shadowColor)
60 |
61 | // Draw the label, centered on the center of the line
62 | textPaint.textAlign = Paint.Align.CENTER
63 | canvas.drawText(
64 | "${distance.asDistanceString()} ${displayUnits.abbreviation}",
65 | left + (right - left) / 2,
66 | bottom + textSizePx,
67 | textPaint
68 | )
69 | }
70 |
71 | override fun calculateExtraSpaceForUnits(displayUnits: LinearUnit?, textPaint: Paint): Float = 0f
72 | }
73 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout-land/layout_controls.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
21 |
22 |
31 |
32 |
41 |
42 |
51 |
52 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout-land/compass_regular_sceneview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
36 |
37 |
43 |
44 |
52 |
53 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/extension/NumberExtensions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.extension
18 |
19 | import java.util.Locale
20 | import kotlin.math.roundToInt
21 |
22 | /**
23 | * Calculate an [Int] DP value as an [Int] of pixels using the supplied [displayDensity] value.
24 | *
25 | * @since 100.5.0
26 | */
27 | fun Int.dpToPixels(displayDensity: Float): Int = (this * displayDensity).roundToInt()
28 |
29 | /**
30 | * Calculate a [Double] DP value as an [Int] of pixels using the supplied [displayDensity] value.
31 | *
32 | * @since 100.5.0
33 | */
34 | fun Double.dpToPixels(displayDensity: Float): Int = (this * displayDensity).roundToInt()
35 |
36 | /**
37 | * Calculate an [Int] of pixels as a DP value using the supplied [displayDensity] value.
38 | *
39 | * @since 100.5.0
40 | */
41 | fun Int.pixelsToDp(displayDensity: Float): Int = (this / displayDensity).roundToInt()
42 |
43 | /**
44 | * Calculate an [Int] of pixels as an SP value using the supplied [scaledDensity] value.
45 | *
46 | * @since 100.13.0
47 | */
48 | fun Int.pixelsToSp(scaledDensity: Float): Int = (this / scaledDensity).roundToInt()
49 |
50 | /**
51 | * Throw a [IllegalArgumentException] when the [Int] is not positive
52 | *
53 | * @since 100.5.0
54 | */
55 | fun Int.throwIfNotPositive(parameterName: String) {
56 | if (this <= 0) throw IllegalArgumentException("Parameter $parameterName must be > 0")
57 | }
58 |
59 | /**
60 | * Formats a Double as a String to display as a distance.
61 | *
62 | * @since 100.5.0
63 | */
64 | fun Double.asDistanceString(): String {
65 | // Format with 2 decimal places
66 | return String.format(Locale.ROOT, "%.2f", this).let {
67 | // Strip off both decimal places if they're 0s
68 | if (it.endsWith(".00") || it.endsWith(",00")) {
69 | it.substring(0, it.length - 3)
70 | // Otherwise, strip off last decimal place if it's 0
71 | } else if (it != "0" && it.endsWith("0")) {
72 | it.substring(0, it.length - 1)
73 | } else {
74 | it
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/compass_custom1_mapview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
35 |
36 |
44 |
45 |
53 |
54 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | Toolkit Test App
19 |
20 |
21 | Regular Layout\nScalebar added to MapView
22 | Custom Layout 1\nScalebar overlaid on MapView
23 | Custom Layout 2\nScalebar outside MapView
24 | All Styles Layout\nAll Scalebar styles overlaid on MapView
25 |
26 |
27 | Regular Layout\nCompass added to GeoView
28 | Custom Layout 1\nCompass overlayed on GeoView
29 | Custom Layout 2\nCompass outside GeoView
30 |
31 |
32 | ArcGISArView
33 | Streets - Full Scale
34 | Point Cloud - Tabletop
35 | Yosemite - Tabletop
36 | US - Mexico Border - Tabletop
37 | Empty - Full Scale
38 | Toggle Calibration Controls
39 |
40 |
41 | BookmarkView
42 |
43 |
44 | PopupView
45 | @android:string/ok
46 | @android:string/cancel
47 | Edit
48 | Saving Record
49 |
50 |
51 | FloorFilterView
52 |
53 |
54 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/layout_controls.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
21 |
22 |
31 |
32 |
41 |
42 |
51 |
52 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/compass_custom1_sceneview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
35 |
36 |
44 |
45 |
53 |
54 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/activity_bookmark.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
19 |
20 |
21 |
22 |
25 |
26 |
27 |
30 |
31 |
40 |
41 |
42 |
51 |
52 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/menu/scalebar_options.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/compass_custom2_mapview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
36 |
37 |
46 |
47 |
56 |
57 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/compass_custom2_sceneview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
36 |
37 |
46 |
47 |
56 |
57 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/util/Event.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.util
18 |
19 | import androidx.lifecycle.LifecycleOwner
20 | import androidx.lifecycle.LiveData
21 | import androidx.lifecycle.MutableLiveData
22 | import androidx.lifecycle.Observer
23 |
24 | /**
25 | * Used as a wrapper for data that is exposed via a LiveData that represents an event.
26 | *
27 | * This avoids a common problem with events: on configuration change (like rotation) an update
28 | * can be emitted if the observer is active. This LiveData only calls the observable if there's an
29 | * explicit call to postValue().
30 | *
31 | * https://medium.com/androiddevelopers/livedata-with-snackbar-navigation-and-other-events-the-singleliveevent-case-ac2622673150
32 | */
33 | open class Event(private val content: T) {
34 | private var hasBeenHandled = false
35 | /**
36 | * Returns the content and prevents its use again.
37 | */
38 | fun getContentIfNotHandled(): T? {
39 | return if (hasBeenHandled) {
40 | null
41 | } else {
42 | hasBeenHandled = true
43 | content
44 | }
45 | }
46 | }
47 |
48 | /**
49 | * Adds the given event function to observer being added to the observers list within the lifespan
50 | * of the given owner. The events are dispatched on the main thread.
51 | *
52 | * @param owner The LifecycleOwner which controls the observer
53 | * @param onEventRaised The observer function that will receive the events from the observer
54 | */
55 | fun LiveData>.observeEvent(owner: LifecycleOwner, onEventRaised: (T) -> Unit) {
56 | observe(owner, Observer> { event ->
57 | event?.getContentIfNotHandled()?.let { onEventRaised(it) }
58 | })
59 | }
60 |
61 | /**
62 | * Raises an event with given argument by calling postValue() on the MutableLiveData object.
63 | *
64 | * @param arg The argument to pass to the observers
65 | */
66 | fun MutableLiveData>.raiseEvent(arg: T) {
67 | postValue(Event(arg))
68 | }
69 |
70 | /**
71 | * Raises an event by calling postValue() on the MutableLiveData object.
72 | */
73 | fun MutableLiveData>.raiseEvent() {
74 | postValue(Event(Unit))
75 | }
76 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/scalebar_custom1.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
35 |
36 |
44 |
45 |
56 |
57 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/Documentation/Compass/testing.md:
--------------------------------------------------------------------------------
1 | # CompassTestActivity
2 |
3 | ## Introduction
4 |
5 | CompassTestActivity is a test activity for the [`Compass`](./readme.md) toolkit component. It displays a GeoView and allows a Compass for that GeoView to be displayed using a number of different layouts. It also offers a set of menu options to change the attributes of the Compass and modify the GeoView.
6 |
7 | ## Select MapView or SceneView
8 |
9 | On startup the app displays a dialog asking the user to select MapView or SceneView, allowing both types of GeoView to be tested.
10 |
11 | ## Layout Selection
12 |
13 | Once MapView or SceneView has been selected, the app displays 3 buttons that allow different layouts to be selected. Different sets of layouts are used in portrait and landscape orientations, so 6 different layouts are available. The default is termed the Regular Layout.
14 |
15 | The layout selection buttons are displayed at the bottom of the screen in portrait orientation and at the right-hand side of the screen in landscape orientation. The buttons are labelled:
16 |
17 | * **REGULAR** - This is the default layout and uses Workflow 1 to add a Compass to the GeoView. Initially the Compass uses the default settings, so it is displayed near the top-right corner of the GeoView.
18 | * **CUSTOM1** - This uses Workflow 2 and a layout that defines a Compass that overlays the top-left corner of the GeoView.
19 | * **CUSTOM2** - This uses Workflow 2 and a layout that defines a Compass that's completely outside the GeoView.
20 |
21 | Part of the screen is devoted to information display. In portrait orientation it is a strip at the top of the screen, above the GeoView. In landscape orientation it is an area at the left-hand side of the screen. The information consists of a simple message describing which layout is currently displayed and, in CUSTOM2 layout only, the Compass itself.
22 |
23 | Here's how the default display looks in portrait orientation when using a MapView:
24 |
25 | 
26 |
27 | and in landscape orientation when using a SceneView:
28 |
29 | 
30 |
31 | ## Change Compass Attributes
32 |
33 | To change the attributes of the current Compass, click on the Action Bar overflow to see a menu of options:
34 |
35 | 
36 |
37 | The top 3 options correspond with the Compass setter methods. They each invoke a dialog asking the user to specify an attribute value to be set.
38 |
39 | ## Add and Remove MapView Insets
40 |
41 | The bottom 2 options in the Action Bar overflow menu are *Add insets* and *Remove insets*. These have an effect only when MapView was selected on startup and the Regular layout is displayed. Adding insets on the Regular layout causes yellow inset views to be displayed on all 4 sides of the MapView. These cause the Compass to be moved to ensure it's always in the visible part of the MapView. Removing the insets causes the Compass to move back again.
42 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout-land/compass_custom1_mapview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
36 |
37 |
43 |
44 |
52 |
53 |
61 |
62 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout-land/compass_custom1_sceneview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
36 |
37 |
43 |
44 |
52 |
53 |
61 |
62 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/toolkit-test-app/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | plugins {
18 | id 'com.android.application'
19 | id 'kotlin-android'
20 | id 'kotlin-kapt'
21 | id 'org.jetbrains.dokka-android'
22 | }
23 |
24 | apply from: "$rootProject.projectDir/gradle/script/artifact.gradle"
25 |
26 | android {
27 | compileSdkVersion droid.targetSdk
28 |
29 | defaultConfig {
30 | applicationId "com.esri.arcgisruntime.toolkit"
31 | minSdkVersion droid.minSdk
32 | targetSdkVersion droid.targetSdk
33 | versionCode _versionCode
34 | versionName _versionName
35 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
36 | vectorDrawables.useSupportLibrary = true
37 | multiDexEnabled true
38 | }
39 | buildTypes {
40 | release {
41 | minifyEnabled true
42 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
43 | }
44 | debug {
45 | multiDexKeepProguard file("$rootProject.projectDir/proguard-multidex-rules.pro")
46 | }
47 | }
48 | compileOptions {
49 | sourceCompatibility 1.8
50 | targetCompatibility 1.8
51 | }
52 | buildFeatures {
53 | dataBinding = true
54 | }
55 | kotlinOptions {
56 | jvmTarget = '1.8'
57 | }
58 | packagingOptions {
59 | exclude 'META-INF/DEPENDENCIES'
60 | exclude 'META-INF/NOTICE'
61 | exclude 'META-INF/LICENSE'
62 | exclude 'LICENSE.txt'
63 | }
64 | }
65 |
66 | dokka {
67 | outputFormat = 'html'
68 | outputDirectory = "$buildDir/javadoc"
69 | }
70 |
71 | dependencies {
72 | api project(':arcgis-android-toolkit')
73 |
74 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
75 | implementation "androidx.appcompat:appcompat:$droid.appcompat"
76 | implementation "com.google.android.material:material:$droid.material"
77 | implementation "androidx.vectordrawable:vectordrawable:$droid.vectordrawable"
78 | implementation "androidx.constraintlayout:constraintlayout:$droid.constraintLayout"
79 | implementation "androidx.multidex:multidex:$droid.multiDex"
80 | implementation "androidx.navigation:navigation-fragment-ktx:$droid.nav_version"
81 | implementation "androidx.navigation:navigation-ui-ktx:$droid.nav_version"
82 | androidTestImplementation "androidx.annotation:annotation:$droid.annotation"
83 | androidTestImplementation "androidx.test:runner:$droid.testRunner"
84 | androidTestImplementation "androidx.test.ext:junit:$test.jUnit"
85 | }
86 |
--------------------------------------------------------------------------------
/Documentation/Scalebar/testing.md:
--------------------------------------------------------------------------------
1 | # ScalebarTestActivity
2 |
3 | ## Introduction
4 |
5 | **ScalebarTestActivity** is a test activity for the [`Scalebar`](./readme.md) toolkit component. It displays a `MapView` and allows a `Scalebar` for that `MapView` to be displayed using a number of different layouts. It also offers a set of menu options to change the attributes of the Scalebar and modify the `MapView`.
6 |
7 | ## Layout Selection
8 |
9 | The app displays 3 buttons that allow different layouts to be selected. Different sets of layouts are used in portrait and landscape orientations, so 6 different layouts are available. The default is termed the Regular Layout.
10 |
11 | The layout selection buttons are displayed at the bottom of the screen in portrait orientation and at the right-hand side of the screen in landscape orientation. The buttons are labelled:
12 |
13 | * **REGULAR** - This is the default layout and uses Workflow 1 to add a Scalebar to the MapView. Initially the Scalebar uses the default settings, so it is displayed near the bottom-left corner of the MapView.
14 | * **CUSTOM1** - This uses Workflow 2 and a layout that defines a Scalebar that overlays the top-left corner of the MapView.
15 | * **CUSTOM2** - This uses Workflow 2 and a layout that defines a Scalebar that's completely outside the MapView.
16 | * **ALL STYLES** - This uses Workflow 2 and a layout that defines all 5 styles of Scalebar on top of the MapView.
17 |
18 | Part of the screen is devoted to information display. In portrait orientation it is a strip at the top of the screen, above the MapView. In landscape orientation it is an area at the left-hand side of the screen. The information consists of a simple message describing which layout is currently displayed and, in CUSTOM2 layout only, the Scalebar itself.
19 |
20 | Here's how the default display looks in portrait orientation:
21 |
22 | 
23 |
24 | and in landscape orientation:
25 |
26 | 
27 |
28 | ## Changing Scalebar Attributes
29 |
30 | To change the attributes of the current Scalebar, click on the Action Bar overflow (not present in the ALL STYLES layout) to see a menu of options:
31 |
32 | 
33 |
34 | The top 12 options correspond with the Scalebar setter methods. They each invoke a dialog asking the user to specify an attribute value to be set.
35 |
36 | ## Adding and Removing MapView Insets
37 |
38 | The next 2 options in the Action Bar overflow menu are "Add insets" and "Remove insets". These have an effect only when the Regular layout is displayed. Adding insets on the Regular layout causes yellow inset views to be displayed on all 4 sides of the MapView. These cause the Scalebar to be moved to ensure it's always in the visible part of the MapView. Removing the insets causes the Scalebar to move back again.
39 |
40 | ## Changing Basemap
41 |
42 | The last option in the Action Bar overflow menu is "Change basemap". This offers a choice of 5 basemaps as follows, each with a different spatial reference, so they can be used to show the Scalebar can handle different projections:
43 |
44 | 
45 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout-land/compass_custom2_mapview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
36 |
37 |
48 |
49 |
55 |
56 |
64 |
65 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/Documentation/Compass/readme.md:
--------------------------------------------------------------------------------
1 | # Compass
2 |
3 | A compass shows the current orientation of a map or scene by displaying a compass icon that points towards North. The icon can be tapped to reset the map/scene to 0 degrees orientation. By default the icon is hidden any time the map/scene is orientated to 0 degrees. The auto hide behavior can be disabled using `Compass.isAutoHide = false`.
4 |
5 | ## Workflow 1
6 |
7 | The simplest workflow is to instantiate a `Compass` and call `Compass.addToGeoView(GeoView)` to display it within the GeoView. Optionally, setter methods may be called to override some of the default settings. This workflow gives the app no control over the position of the compass - it's always placed at the top-right corner of the GeoView.
8 |
9 | For example in Kotlin:
10 |
11 | ```kotlin
12 | val compass = Compass(geoView.context)
13 | with (compass) {
14 | isAutoHide = false
15 | addToGeoView(geoView)
16 | }
17 | ```
18 |
19 | and the same thing in Java:
20 |
21 | ```java
22 | mCompass = new Compass(mGeoView.getContext());
23 | mCompass.setAutoHide(false); // optionally override default settings
24 | mCompass.addToGeoView(mGeoView);
25 | ```
26 |
27 | ## Workflow 2
28 |
29 | Alternatively, the app could define a `Compass` anywhere it likes in its view hierarchy, because `Compass` extends the Android `View` class. The app then calls `Compass.bindTo(GeoView)` to make it come to life as a compass for the given GeoView. This workflow gives the app complete control over where the compass is displayed - it could be positioned on top of any part of the GeoView, or placed somewhere outside the bounds of the GeoView.
30 |
31 | Here's example XML code that puts a compass on top of the top-left corner of a MapView and overrides the default
32 | value of `autoHide`:
33 |
34 | ```xml
35 |
36 |
42 |
43 |
51 |
52 |
60 |
61 |
62 | ```
63 |
64 | Here's example Kotlin code to bind the `Compass` to a GeoView:
65 |
66 | ```kotlin
67 | compass.bindTo(geoView)
68 | ```
69 |
70 | and the same thing in Java:
71 |
72 | ```java
73 | mCompass = (Compass) findViewById(R.id.compass);
74 | mCompass.bindTo(mGeoView);
75 | ```
76 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout-land/compass_custom2_sceneview.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
36 |
37 |
48 |
49 |
55 |
56 |
64 |
65 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/java/com/esri/arcgisruntime/toolkit/test/MapOrSceneDialogFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.esri.arcgisruntime.toolkit.test;
17 |
18 | import android.app.Dialog;
19 | import android.content.Context;
20 | import android.content.DialogInterface;
21 | import android.os.Bundle;
22 | import androidx.fragment.app.DialogFragment;
23 | import androidx.appcompat.app.AlertDialog;
24 | import android.util.Log;
25 | import android.widget.Toast;
26 |
27 | /**
28 | * Displays a dialog asking the user to select whether to use a map or a scene.
29 | */
30 | public final class MapOrSceneDialogFragment extends DialogFragment {
31 |
32 | /**
33 | * The host activity must implement this interface to receive the callback.
34 | */
35 | public interface Listener {
36 | /**
37 | * Called when user selects map or scene.
38 | *
39 | * @param useMap true to use a map, false to use a scene
40 | */
41 | void onMapOrSceneSpecified(boolean useMap);
42 | }
43 |
44 | private Listener mListener;
45 |
46 | @Override
47 | public void onAttach(Context context) {
48 | super.onAttach(context);
49 |
50 | // Verify that the host activity implements the callback interface
51 | try {
52 | // Instantiate the Listener so we can send events to the host
53 | mListener = (Listener) context;
54 | } catch (ClassCastException e) {
55 | // The activity doesn't implement the interface: display message, log the exception and dismiss the dialog
56 | String msg = "ERROR: the calling activity must implement MapOrSceneDialogFragment.Listener";
57 | Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
58 | Log.e("MapOrSceneDialog", msg);
59 | e.printStackTrace();
60 | dismiss();
61 | }
62 | }
63 |
64 | @Override
65 | public Dialog onCreateDialog(Bundle savedInstanceState) {
66 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
67 | builder.setTitle("Use Map or Scene?")
68 | .setItems(R.array.map_or_scene, new DialogInterface.OnClickListener() {
69 | public void onClick(DialogInterface dialog, int which) {
70 | // Make callback with the selected item
71 | switch (which) {
72 | case 0:
73 | mListener.onMapOrSceneSpecified(true);
74 | break;
75 | case 1:
76 | mListener.onMapOrSceneSpecified(false);
77 | break;
78 | default:
79 | // shouldn't happen - do nothing
80 | }
81 | }
82 | });
83 | // Create the AlertDialog object and return it
84 | return builder.create();
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout/scalebar_custom2.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
38 |
39 |
54 |
55 |
63 |
64 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/java/com/esri/arcgisruntime/toolkit/test/compass/CompassAutoHideDialogFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.esri.arcgisruntime.toolkit.test.compass;
17 |
18 | import android.app.Dialog;
19 | import android.content.Context;
20 | import android.content.DialogInterface;
21 | import android.os.Bundle;
22 | import androidx.fragment.app.DialogFragment;
23 | import androidx.appcompat.app.AlertDialog;
24 | import com.esri.arcgisruntime.toolkit.test.R;
25 |
26 | /**
27 | * Displays a dialog asking the user to select an auto-hide option.
28 | */
29 | public final class CompassAutoHideDialogFragment extends DialogFragment {
30 |
31 | /**
32 | * The host activity must implement this interface to receive the callback.
33 | */
34 | public interface Listener {
35 | /**
36 | * Called when user selects an auto-hide option.
37 | *
38 | * @param autoHide true to auto hide the Compass, false to have it always show
39 | */
40 | void onCompassAutoHideSpecified(boolean autoHide);
41 | }
42 |
43 | private Listener mListener;
44 |
45 | @Override
46 | public void onAttach(Context context) {
47 | super.onAttach(context);
48 |
49 | // Verify that the host activity implements the callback interface
50 | try {
51 | // Instantiate the Listener so we can send events to the host
52 | mListener = (Listener) context;
53 | } catch (ClassCastException e) {
54 | // The activity doesn't implement the interface, throw an exception
55 | throw new ClassCastException(context.toString() + " must implement CompassAutoHideDialogFragment.Listener");
56 | }
57 | }
58 |
59 | @Override
60 | public Dialog onCreateDialog(Bundle savedInstanceState) {
61 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
62 | builder.setTitle("Auto hide feature:")
63 | .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
64 | public void onClick(DialogInterface dialog, int id) {
65 | // User cancelled the dialog - do nothing
66 | }
67 | })
68 | .setItems(R.array.compass_auto_hide, new DialogInterface.OnClickListener() {
69 | public void onClick(DialogInterface dialog, int which) {
70 | // Make callback with the selected item
71 | switch (which) {
72 | case 0:
73 | mListener.onCompassAutoHideSpecified(true);
74 | break;
75 | case 1:
76 | mListener.onCompassAutoHideSpecified(false);
77 | break;
78 | }
79 | }
80 | });
81 | // Create the AlertDialog object and return it
82 | return builder.create();
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
20 |
21 |
22 |
25 |
26 |
33 |
34 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
51 |
52 |
56 |
57 |
61 |
62 |
66 |
67 |
71 |
72 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/layout-land/scalebar_custom1.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
25 |
26 |
37 |
38 |
44 |
45 |
53 |
54 |
65 |
66 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/java/com/esri/arcgisruntime/toolkit/test/scalebar/ScalebarUnitSystemDialogFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.esri.arcgisruntime.toolkit.test.scalebar;
17 |
18 | import android.app.Dialog;
19 | import android.content.Context;
20 | import android.content.DialogInterface;
21 | import android.os.Bundle;
22 | import androidx.fragment.app.DialogFragment;
23 | import androidx.appcompat.app.AlertDialog;
24 | import com.esri.arcgisruntime.UnitSystem;
25 | import com.esri.arcgisruntime.toolkit.test.R;
26 |
27 | /**
28 | * Displays a dialog asking the user to select a scalebar unit system option.
29 | */
30 | public final class ScalebarUnitSystemDialogFragment extends DialogFragment {
31 |
32 | /**
33 | * The host activity must implement this interface to receive the callback.
34 | */
35 | public interface Listener {
36 | /**
37 | * Called when user selects a scalebar unit system option.
38 | *
39 | * @param unitSystem the selected unit system
40 | */
41 | void onScalebarUnitSystemSpecified(UnitSystem unitSystem);
42 | }
43 |
44 | private Listener mListener;
45 |
46 | @Override
47 | public void onAttach(Context context) {
48 | super.onAttach(context);
49 |
50 | // Verify that the host activity implements the callback interface
51 | try {
52 | // Instantiate the Listener so we can send events to the host
53 | mListener = (Listener) context;
54 | } catch (ClassCastException e) {
55 | // The activity doesn't implement the interface, throw an exception
56 | throw new ClassCastException(context.toString() + " must implement ScalebarUnitSystemDialogFragment.Listener");
57 | }
58 | }
59 |
60 | @Override
61 | public Dialog onCreateDialog(Bundle savedInstanceState) {
62 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
63 | builder.setTitle("Scalebar unit system:")
64 | .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
65 | public void onClick(DialogInterface dialog, int id) {
66 | // User cancelled the dialog - do nothing
67 | }
68 | })
69 | .setItems(R.array.scalebar_units, new DialogInterface.OnClickListener() {
70 | public void onClick(DialogInterface dialog, int which) {
71 | // Make callback with the selected item
72 | switch (which) {
73 | case 0:
74 | mListener.onScalebarUnitSystemSpecified(UnitSystem.METRIC);
75 | break;
76 | case 1:
77 | mListener.onScalebarUnitSystemSpecified(UnitSystem.IMPERIAL);
78 | break;
79 | }
80 | }
81 | });
82 | // Create the AlertDialog object and return it
83 | return builder.create();
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/Documentation/setup.md:
--------------------------------------------------------------------------------
1 | # Toolkit setup instructions
2 |
3 | ## Prerequisites
4 |
5 | To use the ArcGIS Runtime Toolkit for Android, first you need an app that uses the ArcGIS Runtime SDK for Android:
6 |
7 | 1. Install the ArcGIS Runtime SDK for Android by following the instructions to [Install the SDK](https://developers.arcgis.com/android/install-and-set-up/).
8 | 2. Create an app that uses the ArcGIS Runtime SDK. For example you could follow the instructions to [Display a map](https://developers.arcgis.com/android/maps-2d/tutorials/display-a-map/).
9 |
10 | ## Use the toolkit library
11 |
12 | You can add toolkit components which complement the functionality of the ArcGIS Runtime SDK for Android into your own applications. For example the toolkit allows you to add components such as scale bars, north arrows, or augmented reality controls.
13 |
14 | The toolkit components are available as a library (.aar) in Jfrog, or you can use the source code for the toolkit directly from this repository. Read the [read me](https://github.com/Esri/arcgis-runtime-toolkit-android/blob/master/README.md) instructions for using the compiled library.
15 |
16 | ## Use the toolkit from source code
17 |
18 | To download the Toolkit, you should fork the repo and then create a local copy, or clone, of it:
19 |
20 | 1. To fork this Github repo, [click here and follow the instructions](https://github.com/ArcGIS/arcgis-runtime-toolkit-android/fork).
21 | 2. There are various ways to clone the fork you've created, but here's how it can be done using command line git:
22 |
23 | ```sh
24 | cd /
25 | git clone https://github.com/YOUR-USERNAME/arcgis-runtime-toolkit-android.git
26 | ```
27 |
28 | For more information about forking and cloning GitHub repos, see [GitHub Help](https://help.github.com/articles/fork-a-repo/).
29 |
30 | ## Build the toolkit
31 |
32 | You'll need to build the toolkit before you can add it to your apps:
33 |
34 | 1. Run Android Studio
35 | 2. Select **Open an existing Android Studio project** from the Welcome to Android Studio dialog.
36 | 3. Navigate to the `arcgis-runtime-toolkit-android` folder what was created when you cloned the repo above, and click **Open**.
37 | 4. Pull down the **Build** menu and select **Rebuild Project**. This builds the aar file that you'll add to your project below.
38 | 5. If you wish you can run the `toolkit-test-app` to see toolkit components in action. This app displays a list of activities that are used to test the toolkit components. To test a component, just select the corresponding test activity from the list that's displayed. See [CompassTestActivity](./Compass/testing.md) and [ScalebarTestActivity](./Scalebar/testing.md) for more information.
39 |
40 | ## Add toolkit components to an app
41 |
42 | To add the toolkit to an app:
43 |
44 | 1. Open the app in Android Studio.
45 | 2. Pull down the **File** menu and select **Project Structure...**.
46 | 3. Click on your app module and then the **Dependencies** tab.
47 | 4. Click the **+** button and select **Jar Dependency**.
48 | 5. Navigate to the aar file that was created when you built the toolkit above, and click **Open**. The path to the aar file is:
49 |
50 | ```txt
51 | arcgis-runtime-toolkit-android/arcgis-android-toolkit/build/outputs/aar/arcgis-android-toolkit.aar
52 | ```
53 |
54 | 6. You can now add toolkit components to the app. See [Compass](Compass/) and [Scalebar](Scalebar/) for more information.
55 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/java/com/esri/arcgisruntime/toolkit/scalebar/style/renderer/BarRenderer.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.esri.arcgisruntime.toolkit.scalebar.style.renderer
18 |
19 | import android.graphics.Canvas
20 | import android.graphics.Paint
21 | import com.esri.arcgisruntime.UnitSystem
22 | import com.esri.arcgisruntime.geometry.LinearUnit
23 | import com.esri.arcgisruntime.toolkit.extension.asDistanceString
24 | import com.esri.arcgisruntime.toolkit.scalebar.style.Style
25 | import com.esri.arcgisruntime.toolkit.scalebar.style.Style.BAR
26 |
27 | /**
28 | * Renders a [BAR] style scalebar.
29 | *
30 | * @see Style.BAR
31 | *
32 | * @since 100.5.0
33 | */
34 | class BarRenderer : ScalebarRenderer() {
35 |
36 | override val isSegmented: Boolean = false
37 |
38 | override fun calculateExtraSpaceForUnits(displayUnits: LinearUnit?, textPaint: Paint): Float = 0f
39 |
40 | override fun drawScalebar(
41 | canvas: Canvas,
42 | left: Float,
43 | top: Float,
44 | right: Float,
45 | bottom: Float,
46 | distance: Double,
47 | displayUnits: LinearUnit,
48 | unitSystem: UnitSystem,
49 | lineWidthPx: Int,
50 | cornerRadiusPx: Int,
51 | textSizePx: Int,
52 | fillColor: Int,
53 | alternateFillColor: Int,
54 | shadowColor: Int,
55 | lineColor: Int,
56 | textPaint: Paint,
57 | displayDensity: Float
58 | ) {
59 | // Draw a solid bar and its shadow
60 | drawBarAndShadow(
61 | canvas,
62 | left,
63 | top,
64 | right,
65 | bottom,
66 | lineWidthPx,
67 | cornerRadiusPx,
68 | fillColor,
69 | shadowColor
70 | )
71 |
72 | // Draw a rectangle round the outside
73 | with(rectF) {
74 | set(left, top, right, bottom)
75 | paint.let { paint ->
76 | paint.reset()
77 | paint.color = lineColor
78 | paint.style = Paint.Style.STROKE
79 | paint.strokeWidth = lineWidthPx.toFloat()
80 |
81 | canvas.drawRoundRect(
82 | this,
83 | cornerRadiusPx.toFloat(),
84 | cornerRadiusPx.toFloat(),
85 | paint
86 | )
87 | }
88 | }
89 |
90 | // Draw the label, centered on the center of the bar
91 | textPaint.textAlign = Paint.Align.CENTER
92 | canvas.drawText(
93 | "${distance.asDistanceString()} ${displayUnits.abbreviation}",
94 | left + (right - left) / 2,
95 | bottom + textSizePx,
96 | textPaint
97 | )
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
22 |
23 |
24 | com.esri.arcgisruntime.toolkit.test.compass.CompassTestActivity
25 | com.esri.arcgisruntime.toolkit.test.scalebar.ScalebarTestActivity
26 | com.esri.arcgisruntime.toolkit.test.ar.ArcGISArViewActivity
27 | com.esri.arcgisruntime.toolkit.test.bookmark.BookmarkActivity
28 | com.esri.arcgisruntime.toolkit.test.popup.PopupViewTestActivity
29 | com.esri.arcgisruntime.toolkit.test.floorfilter.FloorFilterTestActivity
30 |
31 |
32 |
33 |
34 |
35 | Map
36 | Scene
37 |
38 |
39 |
40 | On
41 | Off
42 |
43 |
44 |
45 |
46 |
47 | Bar
48 | Alternating Bar
49 | Line
50 | Graduated Line
51 | Dual Unit Line
52 |
53 |
54 |
55 | Left
56 | Center
57 | Right
58 |
59 |
60 |
61 | Metric
62 | Imperial
63 |
64 |
65 |
66 | Black
67 | Blue
68 | Cyan
69 | Dary Gray
70 | Gray
71 | Green
72 | Light Gray
73 | Magenta
74 | Red
75 | White
76 | Yellow
77 |
78 |
79 |
80 | Monospace
81 | Sans Serif
82 | Serif
83 | Default Bold
84 | Default Bold Italic
85 |
86 |
87 |
88 | Streets (102100)
89 | Imagery with Labels (102100)
90 | OS Open Carto (27700)
91 | Arctic Ocean Base (5936)
92 | Robinson Coordinate System (54030)
93 |
94 |
95 |
--------------------------------------------------------------------------------
/arcgis-android-toolkit/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/toolkit-test-app/src/main/java/com/esri/arcgisruntime/toolkit/test/scalebar/ScalebarAlignmentDialogFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019 Esri
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.esri.arcgisruntime.toolkit.test.scalebar;
17 |
18 | import android.app.Dialog;
19 | import android.content.Context;
20 | import android.content.DialogInterface;
21 | import android.os.Bundle;
22 | import androidx.fragment.app.DialogFragment;
23 | import androidx.appcompat.app.AlertDialog;
24 | import com.esri.arcgisruntime.toolkit.scalebar.Scalebar;
25 | import com.esri.arcgisruntime.toolkit.test.R;
26 |
27 | /**
28 | * Displays a dialog asking the user to select a scalebar alignment option.
29 | */
30 | public final class ScalebarAlignmentDialogFragment extends DialogFragment {
31 |
32 | /**
33 | * The host activity must implement this interface to receive the callback.
34 | */
35 | public interface Listener {
36 | /**
37 | * Called when user selects a scalebar alignment option.
38 | *
39 | * @param alignment the selected alignment
40 | */
41 | void onScalebarAlignmentSpecified(Scalebar.Alignment alignment);
42 | }
43 |
44 | private Listener mListener;
45 |
46 | @Override
47 | public void onAttach(Context context) {
48 | super.onAttach(context);
49 |
50 | // Verify that the host activity implements the callback interface
51 | try {
52 | // Instantiate the Listener so we can send events to the host
53 | mListener = (Listener) context;
54 | } catch (ClassCastException e) {
55 | // The activity doesn't implement the interface, throw an exception
56 | throw new ClassCastException(context.toString() + " must implement ScalebarAlignmentDialogFragment.Listener");
57 | }
58 | }
59 |
60 | @Override
61 | public Dialog onCreateDialog(Bundle savedInstanceState) {
62 | AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
63 | builder.setTitle("Scalebar alignment:")
64 | .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
65 | public void onClick(DialogInterface dialog, int id) {
66 | // User cancelled the dialog - do nothing
67 | }
68 | })
69 | .setItems(R.array.scalebar_alignments, new DialogInterface.OnClickListener() {
70 | public void onClick(DialogInterface dialog, int which) {
71 | // Make callback with the selected item
72 | switch (which) {
73 | case 0:
74 | mListener.onScalebarAlignmentSpecified(Scalebar.Alignment.LEFT);
75 | break;
76 | case 1:
77 | mListener.onScalebarAlignmentSpecified(Scalebar.Alignment.CENTER);
78 | break;
79 | case 2:
80 | mListener.onScalebarAlignmentSpecified(Scalebar.Alignment.RIGHT);
81 | break;
82 | }
83 | }
84 | });
85 | // Create the AlertDialog object and return it
86 | return builder.create();
87 | }
88 | }
89 |
--------------------------------------------------------------------------------