├── .github
└── workflows
│ ├── release_locus_api.yml
│ └── release_locus_api_android.yml
├── .gitignore
├── .idea
└── vcs.xml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── _data
├── README.txt
└── ic_launcher
│ ├── ic_launcher_512.png
│ └── res
│ ├── mipmap-anydpi-v26
│ └── ic_launcher_no1.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher_no1.png
│ ├── ic_launcher_no1_background.png
│ └── ic_launcher_no1_foreground.png
│ ├── mipmap-mdpi
│ ├── ic_launcher_no1.png
│ ├── ic_launcher_no1_background.png
│ └── ic_launcher_no1_foreground.png
│ ├── mipmap-xhdpi
│ ├── ic_launcher_no1.png
│ ├── ic_launcher_no1_background.png
│ └── ic_launcher_no1_foreground.png
│ ├── mipmap-xxhdpi
│ ├── ic_launcher_no1.png
│ ├── ic_launcher_no1_background.png
│ └── ic_launcher_no1_foreground.png
│ └── mipmap-xxxhdpi
│ ├── ic_launcher_no1_background.png
│ └── ic_launcher_no1_foreground.png
├── build.gradle
├── docs
├── _config.yml
└── index.html
├── gradle.properties
├── gradle
├── publish-mavencentral.gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── locus-api-android-sample
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── 512.png
│ └── map_tiles
│ │ ├── tile_0_0_0.jpg
│ │ ├── tile_0_0_1.jpg
│ │ ├── tile_0_0_2.jpg
│ │ ├── tile_0_1_1.jpg
│ │ ├── tile_0_1_2.jpg
│ │ ├── tile_0_2_2.jpg
│ │ ├── tile_0_3_2.jpg
│ │ ├── tile_1_0_1.jpg
│ │ ├── tile_1_0_2.jpg
│ │ ├── tile_1_1_1.jpg
│ │ ├── tile_1_1_2.jpg
│ │ ├── tile_1_2_2.jpg
│ │ ├── tile_1_3_2.jpg
│ │ ├── tile_2_0_2.jpg
│ │ ├── tile_2_1_2.jpg
│ │ ├── tile_2_2_2.jpg
│ │ ├── tile_2_3_2.jpg
│ │ ├── tile_3_0_2.jpg
│ │ ├── tile_3_1_2.jpg
│ │ ├── tile_3_2_2.jpg
│ │ └── tile_3_3_2.jpg
│ ├── java
│ └── com
│ │ └── asamm
│ │ └── locus
│ │ └── api
│ │ └── sample
│ │ ├── ActivityDashboard.kt
│ │ ├── ActivityGeocacheTools.kt
│ │ ├── MainActivity.kt
│ │ ├── MainApplication.kt
│ │ ├── MainIntentHandler.kt
│ │ ├── mapServer
│ │ └── MapProvider.kt
│ │ ├── pages
│ │ ├── ABasePageFragment.kt
│ │ ├── MapFragment.kt
│ │ ├── PageBroadcastApiSamples.kt
│ │ ├── PagePointsFragment.kt
│ │ ├── PageTracksFragment.kt
│ │ ├── PageUtilsFragment.kt
│ │ └── PageWelcomeFragment.kt
│ │ ├── receivers
│ │ ├── OnTrackExportedReceiver.kt
│ │ └── PointChangedReceiver.kt
│ │ └── utils
│ │ ├── BasicAdapter.kt
│ │ ├── BasicAdapterItem.kt
│ │ ├── SampleCalls.kt
│ │ └── Utils.kt
│ └── res
│ ├── drawable-hdpi
│ ├── ic_action_search.png
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ ├── ic_action_search.png
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ ├── drawer_shadow.9.png
│ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── layout
│ ├── activity_dashboard.xml
│ ├── activity_main.xml
│ ├── basic_list_item.xml
│ └── page_welcome.xml
│ ├── menu
│ └── activity_main.xml
│ ├── values-large
│ └── dimens.xml
│ ├── values
│ ├── config.xml
│ ├── dimens.xml
│ ├── ids.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── filepaths.xml
├── locus-api-android
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── aidl
│ └── locus
│ │ └── api
│ │ └── android
│ │ ├── features
│ │ ├── computeTrack
│ │ │ └── IComputeTrackService.aidl
│ │ └── mapProvider
│ │ │ ├── IMapTileService.aidl
│ │ │ └── MapDataContainer.aidl
│ │ └── objects
│ │ └── ParcelableContainer.aidl
│ └── java
│ └── locus
│ └── api
│ └── android
│ ├── ActionBasics.kt
│ ├── ActionDisplayPoints.kt
│ ├── ActionDisplayTracks.kt
│ ├── ActionDisplayVarious.kt
│ ├── ActionFiles.kt
│ ├── ActionMapTools.kt
│ ├── features
│ ├── augmentedReality
│ │ └── UtilsAddonAR.kt
│ ├── computeTrack
│ │ ├── ComputeTrackParameters.kt
│ │ └── ComputeTrackService.kt
│ ├── geocaching
│ │ └── fieldNotes
│ │ │ ├── FieldNote.kt
│ │ │ ├── FieldNoteImage.kt
│ │ │ ├── FieldNotesHelper.kt
│ │ │ └── TrackableLog.kt
│ ├── mapProvider
│ │ ├── MapDataContainer.kt
│ │ ├── MapTileService.kt
│ │ └── data
│ │ │ ├── MapConfigLayer.kt
│ │ │ ├── MapTileRequest.kt
│ │ │ └── MapTileResponse.kt
│ ├── periodicUpdates
│ │ ├── UpdateContainer.kt
│ │ ├── UpdateContainerGuidePoint.kt
│ │ └── UpdateContainerGuideTrack.kt
│ └── sendToApp
│ │ ├── SendMode.kt
│ │ ├── SendToAppBase.kt
│ │ ├── SendToAppHelper.kt
│ │ ├── points
│ │ └── SendPointBase.kt
│ │ └── tracks
│ │ ├── SendTrack.kt
│ │ ├── SendTrackBase.kt
│ │ └── SendTracks.kt
│ ├── objects
│ ├── LocusInfo.kt
│ ├── LocusVersion.kt
│ ├── PackPoints.kt
│ ├── ParcelableContainer.kt
│ ├── TrackRecordProfileSimple.kt
│ └── VersionCode.kt
│ └── utils
│ ├── IntentHelper.kt
│ ├── LocusConst.kt
│ ├── LocusUtils.kt
│ ├── MatrixCursor.java
│ ├── UtilsBitmap.kt
│ ├── UtilsFormat.kt
│ └── exceptions
│ └── RequiredVersionMissingException.kt
├── locus-api-core
├── build.gradle
└── src
│ └── main
│ └── java
│ └── locus
│ └── api
│ ├── objects
│ ├── Storable.kt
│ ├── extra
│ │ ├── GeoDataExtra.kt
│ │ ├── Location.kt
│ │ ├── PointRteAction.kt
│ │ └── TrackStats.kt
│ ├── geoData
│ │ ├── Circle.kt
│ │ ├── GeoData.kt
│ │ ├── GeoDataHelper.kt
│ │ ├── Point.kt
│ │ └── Track.kt
│ ├── geocaching
│ │ ├── GeocachingAttribute.kt
│ │ ├── GeocachingData.kt
│ │ ├── GeocachingImage.kt
│ │ ├── GeocachingLog.kt
│ │ ├── GeocachingTrackable.kt
│ │ └── GeocachingWaypoint.kt
│ └── styles
│ │ ├── GeoDataStyle.kt
│ │ ├── HotSpot.kt
│ │ ├── IconStyle.kt
│ │ ├── LabelStyle.kt
│ │ ├── LineStyle.kt
│ │ └── deprecated
│ │ ├── LineStyleOld.kt
│ │ ├── OldStyleHelper.kt
│ │ └── PolyStyleOld.kt
│ └── utils
│ ├── ByteValueMap.kt
│ ├── DataReaderBigEndian.java
│ ├── DataWriterBigEndian.java
│ ├── LocationCompute.kt
│ ├── SparseArrayCompat.java
│ └── Utils.kt
└── settings.gradle
/.github/workflows/release_locus_api.yml:
--------------------------------------------------------------------------------
1 | name: Publish Locus API
2 |
3 | on:
4 | push:
5 | tags:
6 | - 'Locus_API_[0-9]+.[0-9]+.[0-9]+'
7 |
8 | env:
9 | ANDROID_SIGN_DEBUG: ${{ secrets.ANDROID_SIGN_DEBUG }}
10 | ANDROID_SIGN_RELEASE: ${{ secrets.ANDROID_SIGN_RELEASE }}
11 |
12 | jobs:
13 | build:
14 | name: Release API
15 | runs-on: ubuntu-latest
16 |
17 | # job steps
18 | steps:
19 | - name: Set up JDK 17
20 | uses: actions/setup-java@v4
21 | with:
22 | distribution: 'temurin'
23 | java-version: '17'
24 |
25 | # Prepare source code
26 | # https://github.com/marketplace/actions/checkout
27 | - name: Clone repo
28 | uses: actions/checkout@v2
29 |
30 | # Base64 decodes and pipes the GPG key content into the secret file
31 | - name: Prepare environment
32 | env:
33 | SIGNING_SECRET_KEY_CONTENT: ${{ secrets.SIGNING_SECRET_KEY_CONTENT }}
34 | SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
35 | run: |
36 | git fetch --unshallow
37 | sudo bash -c "echo '$SIGNING_SECRET_KEY_CONTENT' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
38 |
39 | # Public Locus API - core
40 | - name: Publish `locus-api-core`
41 | run: ./gradlew :locus-api-core:clean :locus-api-core:publishReleasePublicationToMavencentralRepository
42 | env:
43 | OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
44 | OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
45 | SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
46 | SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
47 | SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
48 | SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
49 |
50 | # Runs upload, and then closes & releases the repository
51 | - name: Releaes repository
52 | run: ./gradlew closeAndReleaseRepository
53 | env:
54 | OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
55 | OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
56 | SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
57 | SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
58 | SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
59 | SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
--------------------------------------------------------------------------------
/.github/workflows/release_locus_api_android.yml:
--------------------------------------------------------------------------------
1 | name: Publish Locus API - Android
2 |
3 | on:
4 | push:
5 | tags:
6 | - 'Locus_API_Android_[0-9]+.[0-9]+.[0-9]+'
7 |
8 | env:
9 | ANDROID_SIGN_DEBUG: ${{ secrets.ANDROID_SIGN_DEBUG }}
10 | ANDROID_SIGN_RELEASE: ${{ secrets.ANDROID_SIGN_RELEASE }}
11 |
12 | jobs:
13 | build:
14 | name: Release API
15 | runs-on: ubuntu-latest
16 |
17 | # job steps
18 | steps:
19 | - name: Set up JDK 17
20 | uses: actions/setup-java@v4
21 | with:
22 | distribution: 'temurin'
23 | java-version: '17'
24 |
25 | # Prepare source code
26 | # https://github.com/marketplace/actions/checkout
27 | - name: Clone repo
28 | uses: actions/checkout@v2
29 |
30 | # Base64 decodes and pipes the GPG key content into the secret file
31 | - name: Prepare environment
32 | env:
33 | SIGNING_SECRET_KEY_CONTENT: ${{ secrets.SIGNING_SECRET_KEY_CONTENT }}
34 | SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
35 | run: |
36 | git fetch --unshallow
37 | sudo bash -c "echo '$SIGNING_SECRET_KEY_CONTENT' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
38 |
39 | # Publish Locus API - Android
40 | - name: Publish `locus-api-android`
41 | run: ./gradlew :locus-api-android:clean :locus-api-android:publishReleasePublicationToMavencentralRepository
42 | env:
43 | OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
44 | OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
45 | SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
46 | SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
47 | SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
48 | SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
49 |
50 | # Runs upload, and then closes & releases the repository
51 | - name: Releaes repository
52 | run: ./gradlew closeAndReleaseRepository
53 | env:
54 | OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
55 | OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
56 | SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
57 | SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
58 | SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
59 | SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # https://github.com/github/gitignore
2 |
3 | # Built application files
4 | *.apk
5 | *.ap_
6 |
7 | # Files for the Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 | out/
17 |
18 | # Local configuration file (sdk path, etc)
19 | local.properties
20 |
21 | # Log Files
22 | *.log
23 |
24 | # Android Studio (intellij IDEA)
25 | # https://intellij-support.jetbrains.com/entries/23393067
26 | *.iml
27 | .gradle/
28 | .navigation/
29 | build/
30 | captures/
31 |
32 | # Keystore files
33 | *.jks
34 |
35 | # custom directories
36 | .idea
37 | _native/obj/
38 | _native/libs/
39 | _native_spatialite/*
40 | _various/
41 | libraries/jts/
42 | workspace.xml
43 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Asamm Software, s. r. o.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://search.maven.org/artifact/com.asamm/locus-api-core)
2 | [](https://search.maven.org/artifact/com.asamm/locus-api-android)
3 | [](https://github.com/asamm/locus-api/actions/workflows/release_locus_api_android.yml)
4 |
5 |
6 | Current version |
7 | Structure |
8 | What does it do? |
9 | What it isn't |
10 | Quick start
11 |
12 |
13 | # Locus API
14 |
15 | Library for [Locus Map](https://www.locusmap.app) application for Android devices.
16 |
17 | ## Current version
18 |
19 | Latest stable LT version: **0.9.64**
20 | Available versions on the maven repository: [here](https://repo1.maven.org/maven2/com/asamm/).
21 |
22 | How to **update to new 0.9.x** version? More about it [here](https://github.com/asamm/locus-api/wiki/Update-to-version-0.9.0).
23 |
24 | ## Structure
25 |
26 | Whole API is divided into two separate parts:
27 |
28 | - library written in pure Java - **Locus API - Core**
29 | - its extension for Android devices - **Locus API - Android**
30 |
31 | In most cases, Android version is the only interesting one here.
32 |
33 | ## What does it do?
34 |
35 | - main purpose is a transport tool for various objects (points/tracks)
36 | - allows to check state of certain functions like periodic updates, units defined by user and more
37 | - allows to control track recording and partially also navigation features
38 | - allows to handle field notes completely
39 | - allows to generate map preview of a certain area & zoom level
40 |
41 | ## What it isn't
42 |
43 | - a replacement for Google Maps API or other map library that substitutes map core to your own application
44 | - a standalone library that may work without Locus Map application
45 |
46 | **For creating Locus Map add-ons it is needed to handle only Locus API - Android library. Locus API is automatically added as dependency.**
47 |
48 | ## Quick start
49 |
50 | Add [JitPack](https://jitpack.io) repository to your root `build.gradle` module config. This is currently necessary for the
51 | internal logger dependency.
52 |
53 | ```gradle.kts
54 | allprojects {
55 | repositories {
56 | maven(url = "https://jitpack.io")
57 | }
58 | }
59 | ```
60 |
61 | Add dependency to your `build.gradle` module config
62 |
63 | ```gradle.kts
64 | dependencies {
65 | // get Locus API (Java only)
66 | implementation('com.asamm:locus-api-core:[latest]')
67 |
68 | // or Locus Android API (for Android apps)
69 | implementation('com.asamm:locus-api-android:[latest]')
70 | }
71 | ```
72 |
73 | Check for sample use-cases in Locus API - Android sample project.
74 |
75 | ### Proguard
76 |
77 | When using Proguard/R8, test release build properly.
78 |
79 | It may be necessary to keep API internal object untouched. To do this, add following proguard config into your module "proguard-rules.pro" file.
80 |
81 | ```
82 | # Keep Locus API objects
83 | -keep class locus.api.objects.** { *; }
84 | ```
85 |
86 | ## New version release steps
87 |
88 | 1. Raise version in the `gradle.properties`
89 | * `API_CODE`
90 | * `API_VERSION`
91 | 2. update version also in this "README" file (line 19)
92 | 3. update "CHANGELOG" news file
93 | 4. commit changes to GitHub
94 | 5. tag commit with "Locus_API_X.X.X" pattern to trigger publishing of the "Core" module
95 | 6. wait approx 15 minutes till version will be available on the Maven, alternative check [here](https://repo1.maven.org/maven2/com/asamm/locus-api-core/)
96 | 7. tag commit with "Locus_API_Android_X.X.X" pattern to trigger publishing of the "Android" module
97 | 8. after another 15+ minutes, it should be available as well
98 |
--------------------------------------------------------------------------------
/_data/README.txt:
--------------------------------------------------------------------------------
1 | ## Add-on icon
2 |
3 | How to use it:
4 |
5 | - extract content of *ic_launcher.zip* file
6 | - copy content of the 'ic_launcher/res' directory into own application *res* folder
7 | - modify all icons to match your own needs (you may contact if help is needed)
8 | - set icon for you application in manifest.xml as *android:icon="@mipmap/ic_launcher_no1*
9 |
10 | Icon *ic_launcher_512.png* should be modified for the Google Play listing.
11 |
--------------------------------------------------------------------------------
/_data/ic_launcher/ic_launcher_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/ic_launcher_512.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-anydpi-v26/ic_launcher_no1.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
8 |
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-hdpi/ic_launcher_no1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-hdpi/ic_launcher_no1.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-hdpi/ic_launcher_no1_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-hdpi/ic_launcher_no1_background.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-hdpi/ic_launcher_no1_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-hdpi/ic_launcher_no1_foreground.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-mdpi/ic_launcher_no1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-mdpi/ic_launcher_no1.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-mdpi/ic_launcher_no1_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-mdpi/ic_launcher_no1_background.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-mdpi/ic_launcher_no1_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-mdpi/ic_launcher_no1_foreground.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-xhdpi/ic_launcher_no1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-xhdpi/ic_launcher_no1.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-xhdpi/ic_launcher_no1_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-xhdpi/ic_launcher_no1_background.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-xhdpi/ic_launcher_no1_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-xhdpi/ic_launcher_no1_foreground.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-xxhdpi/ic_launcher_no1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-xxhdpi/ic_launcher_no1.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-xxhdpi/ic_launcher_no1_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-xxhdpi/ic_launcher_no1_background.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-xxhdpi/ic_launcher_no1_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-xxhdpi/ic_launcher_no1_foreground.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-xxxhdpi/ic_launcher_no1_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-xxxhdpi/ic_launcher_no1_background.png
--------------------------------------------------------------------------------
/_data/ic_launcher/res/mipmap-xxxhdpi/ic_launcher_no1_foreground.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/_data/ic_launcher/res/mipmap-xxxhdpi/ic_launcher_no1_foreground.png
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'io.codearte.nexus-staging'
2 |
3 | buildscript {
4 | repositories {
5 | google()
6 | jcenter()
7 | mavenCentral()
8 | }
9 | dependencies {
10 | // Android build
11 | classpath 'com.android.tools.build:gradle:' + ANDROID_PLUGIN_GRADLE
12 |
13 | // Kotlin
14 | classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:' + KOTLIN_VERSION
15 |
16 | // Dokka
17 | classpath 'org.jetbrains.dokka:dokka-gradle-plugin:' + KOTLIN_DOKKA
18 |
19 | // Nexus staging
20 | classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:' + GRADLE_NEXUS_STAGING
21 | }
22 | }
23 |
24 | // define global parameters
25 | allprojects {
26 | repositories {
27 | // local maven
28 | mavenLocal()
29 |
30 | // basic repositories
31 | google()
32 | mavenCentral()
33 | gradlePluginPortal()
34 |
35 | // Logger
36 | maven { url 'https://jitpack.io' }
37 | }
38 | }
39 |
40 | // Support for GitHub packages
41 | // currently disabled as GP does not allow auth-less access to public packages (for now 05/2020)
42 | // https://github.community/t5/GitHub-API-Development-and/Download-from-Github-Package-Registry-without-authentication/td-p/35255
43 | //subprojects {
44 | // apply plugin: "maven-publish"
45 | // publishing {
46 | // repositories {
47 | // maven {
48 | // name = "GitHubPackages"
49 | // url = uri("https://maven.pkg.github.com/asamm/locus-api")
50 | // credentials {
51 | // username = System.getenv("GH_USER")
52 | // password = System.getenv("GH_PERSONAL_ACCESS_TOKEN")
53 | // }
54 | // }
55 | // maven {
56 | // name = 'CustomMavenRepo'
57 | // url = "file://${buildDir}/repo"
58 | // }
59 | // }
60 | // }
61 | //}
62 |
63 | configure([
64 | project(":locus-api-android-sample")]) {
65 |
66 | apply plugin: 'com.android.application'
67 | apply plugin: "kotlin-android"
68 |
69 | android {
70 | // setup SDK
71 | compileSdkVersion Integer.valueOf(PARAM_COMPILE_SDK_VERSION)
72 | buildToolsVersion ANDROID_BUILD_TOOLS
73 |
74 | defaultConfig {
75 | minSdkVersion Integer.valueOf(PARAM_MIN_SDK_VERSION)
76 | targetSdkVersion Integer.valueOf(PARAM_TARGET_SDK_VERSION)
77 | }
78 |
79 | dexOptions {
80 | jumboMode true
81 | }
82 |
83 | packagingOptions {
84 | exclude 'META-INF/LICENSE.txt'
85 | exclude 'META-INF/NOTICE.txt'
86 | }
87 |
88 | compileOptions {
89 | sourceCompatibility JavaVersion.VERSION_1_8
90 | targetCompatibility JavaVersion.VERSION_1_8
91 | }
92 |
93 | // enable lint in project
94 | lintOptions {
95 | checkReleaseBuilds true
96 | abortOnError true
97 | absolutePaths false
98 | lintConfig file("../lint-global.xml")
99 | }
100 |
101 | // signing of versions
102 | signingConfigs {
103 | debug {
104 | storeFile file(System.getenv('ANDROID_SIGN_DEBUG').split("\\|")[0])
105 | storePassword System.getenv('ANDROID_SIGN_DEBUG').split("\\|")[1]
106 | keyAlias System.getenv('ANDROID_SIGN_DEBUG').split("\\|")[2]
107 | keyPassword System.getenv('ANDROID_SIGN_DEBUG').split("\\|")[3]
108 | }
109 | release {
110 | storeFile file(System.getenv('ANDROID_SIGN_RELEASE').split("\\|")[0])
111 | storePassword System.getenv('ANDROID_SIGN_RELEASE').split("\\|")[1]
112 | keyAlias System.getenv('ANDROID_SIGN_RELEASE').split("\\|")[2]
113 | keyPassword System.getenv('ANDROID_SIGN_RELEASE').split("\\|")[3]
114 | }
115 | }
116 |
117 | // building task
118 | buildTypes {
119 | debug {
120 | signingConfig signingConfigs.debug
121 | }
122 | release {
123 | signingConfig signingConfigs.release
124 | }
125 | }
126 | }
127 |
128 | // iterate over all versions
129 | android.applicationVariants.all { variant ->
130 |
131 | // define base parameters
132 | println "Config for: " + build
133 |
134 | // rename result file
135 | variant.outputs.all {
136 | // generate base name
137 | def newName = variant.name.capitalize()
138 | // remove from 'LocusFreeSamsungDebug', last work 'Debug'
139 | newName = newName.substring(0, newName.length() - variant.buildType.name.length())
140 | // create full name like 'LocusFreeSamsung_342_3.5.2_debug.apk'
141 | def baseFileName = "${newName}_${variant.versionCode}_${variant.versionName}_${variant.buildType.name}"
142 | // set new output file name
143 | outputFileName = "${baseFileName}.apk"
144 | }
145 |
146 | // create also release task for "release builds"
147 | variant.productFlavors.each { flavor ->
148 | // do not handle certain flavors at all
149 | def flavorName = flavor.name.capitalize()
150 | if (flavor.name == '') {
151 | return;
152 | }
153 |
154 | // skip invalid build types (so generate only releases versions)
155 | if (variant.buildType.name != 'release') {
156 | return;
157 | }
158 |
159 | // create task for release
160 | tasks.create(name: variant.buildType.name + flavorName,
161 | dependsOn: variant.assemble) {
162 | group 'Publish'
163 | description "Assembles and archives $flavorName and its proguard mapping for the $build build"
164 | }
165 | }
166 | }
167 | }
168 |
--------------------------------------------------------------------------------
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-architect
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 | Locus API pages
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 |
2 | # BASE
3 |
4 | # https://developer.android.com/studio/releases/build-tools.html
5 | PARAM_COMPILE_SDK_VERSION = 35
6 | PARAM_MIN_SDK_VERSION = 23
7 | PARAM_TARGET_SDK_VERSION = 34
8 |
9 | # LIBRARIES
10 |
11 | # https://developer.android.com/studio/releases/gradle-plugin.html
12 | ANDROID_PLUGIN_GRADLE = 8.6.0
13 | # https://blog.jetbrains.com/kotlin/category/releases/
14 | KOTLIN_VERSION = 2.0.20
15 | # https://developer.android.com/studio/releases/build-tools.html
16 | ANDROID_BUILD_TOOLS = 34.0.0
17 | # https://github.com/Kotlin/dokka
18 | KOTLIN_DOKKA = 1.8.10
19 | # Nexus staging plugin, automatic Maven release
20 | # https://github.com/Codearte/gradle-nexus-staging-plugin/
21 | GRADLE_NEXUS_STAGING = 0.30.0
22 | # Locus Logger
23 | LOCUS_LOGGER = 2.2
24 |
25 | # Version
26 | API_CODE = 111
27 | API_VERSION = 0.9.64
28 |
29 | # ANDROID SUPPORT LIBS
30 | # https://developer.android.com/topic/libraries/support-library/revisions.html
31 |
32 | # AndroidX support
33 | android.useAndroidX=true
--------------------------------------------------------------------------------
/gradle/publish-mavencentral.gradle:
--------------------------------------------------------------------------------
1 | // Deploy system to the MavenCentral
2 | // https://central.sonatype.org/publish/publish-guide/#deployment
3 |
4 | apply plugin: 'maven-publish'
5 | apply plugin: 'signing'
6 | apply plugin: 'org.jetbrains.dokka'
7 |
8 | task createSourceJar(type: Jar) {
9 | archiveClassifier.set('sources')
10 | if (project.plugins.findPlugin("com.android.library")) {
11 | from android.sourceSets.main.java.srcDirs
12 | from android.sourceSets.main.kotlin.srcDirs
13 | } else {
14 | from sourceSets.main.java.srcDirs
15 | from sourceSets.main.kotlin.srcDirs
16 | }
17 | }
18 |
19 | tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
20 | pluginsMapConfiguration.set(
21 | ["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
22 | )
23 | }
24 |
25 | task createJavadocJar(type: Jar, dependsOn: dokkaJavadoc) {
26 | archiveClassifier.set('javadoc')
27 | from dokkaJavadoc.outputDirectory
28 | }
29 |
30 | // secrets
31 | ext["signing.keyId"] = ''
32 | ext["signing.password"] = ''
33 | ext["signing.secretKeyRingFile"] = ''
34 | ext["ossrhUsername"] = ''
35 | ext["ossrhPassword"] = ''
36 | ext["sonatypeStagingProfileId"] = ''
37 |
38 | File secretPropsFile = project.rootProject.file('local.properties')
39 | if (secretPropsFile.exists()) {
40 | Properties p = new Properties()
41 | p.load(new FileInputStream(secretPropsFile))
42 | p.each { name, value ->
43 | ext[name] = value
44 | }
45 | } else {
46 | ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
47 | ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
48 | ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE')
49 | ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
50 | ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
51 | ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
52 | }
53 |
54 | // publishing
55 | afterEvaluate {
56 | publishing {
57 | publications {
58 | Release(MavenPublication) {
59 | groupId PUBLISH_GROUP_ID
60 | artifactId PUBLISH_ARTIFACT_ID
61 | version PUBLISH_VERSION
62 |
63 | if (project.plugins.findPlugin("com.android.library")) {
64 | artifact bundleReleaseAar
65 | } else {
66 | from components.java
67 | }
68 |
69 | // add sources & javadoc
70 | artifact createSourceJar
71 | artifact createJavadocJar
72 |
73 | // project metadata
74 | pom {
75 | name = 'Locus API'
76 | description = 'Core library for Android "Locus Map/Locus GIS" applications'
77 | url = 'https://github.com/asamm/locus-api'
78 | licenses {
79 | license {
80 | name = 'MIT License'
81 | url = 'https://github.com/asamm/locus-api/blob/master/LICENSE'
82 | }
83 | }
84 | developers {
85 | developer {
86 | id = 'menion'
87 | name = 'Jiří M. aka Menion'
88 | email = 'jiri.mlavec@asamm.com'
89 | }
90 | }
91 | scm {
92 | connection = 'scm:git://github.com/asamm/locus-api.git'
93 | developerConnection = 'scm:git:ssh://github.com/asamm/locus-api.git'
94 | url = 'https://github.com/asamm/locus-api'
95 | }
96 |
97 | // iterate over the implementation dependencies (we don't want the test ones), adding
98 | // a node for each
99 | if (project.plugins.findPlugin("com.android.library")) {
100 | withXml {
101 | def dependencies = asNode().appendNode('dependencies')
102 | project.configurations.releaseApi.allDependencies.each {
103 | // project.configurations.implementation.allDependencies.each {
104 | // Ensure dependencies such as fileTree are not included.
105 | if (it.name != 'unspecified') {
106 | def dependencyNode = dependencies.appendNode('dependency')
107 | dependencyNode.appendNode('groupId', it.group)
108 | dependencyNode.appendNode('artifactId', it.name)
109 | dependencyNode.appendNode('version', it.version)
110 | }
111 | }
112 | }
113 | }
114 | }
115 | }
116 | }
117 | repositories {
118 | maven {
119 | name = "mavencentral"
120 |
121 | def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
122 | def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
123 | url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
124 |
125 | credentials {
126 | username ossrhUsername
127 | password ossrhPassword
128 | }
129 | }
130 | }
131 | }
132 | }
133 |
134 | signing {
135 | sign publishing.publications
136 | }
137 |
138 | nexusStaging {
139 | serverUrl = "https://s01.oss.sonatype.org/service/local"
140 | packageGroup = PUBLISH_GROUP_ID
141 | stagingProfileId = sonatypeStagingProfileId
142 | username = ossrhUsername
143 | password = ossrhPassword
144 | }
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Oct 27 14:18:43 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/locus-api-android-sample/build.gradle:
--------------------------------------------------------------------------------
1 | android {
2 | namespace = "com.asamm.locus.api.sample"
3 |
4 | defaultConfig {
5 | versionCode 2
6 | versionName '0.2'
7 | }
8 |
9 | // specifies flavor dimension
10 | flavorDimensions "base"
11 |
12 | // set compile target
13 | compileOptions {
14 | sourceCompatibility = JavaVersion.VERSION_17
15 | targetCompatibility = JavaVersion.VERSION_17
16 | }
17 | kotlinOptions {
18 | jvmTarget = JavaVersion.VERSION_17.toString()
19 | }
20 |
21 | // product flavors
22 | productFlavors {
23 | locusApiSample {
24 | applicationId "com.asamm.locus.api.sample"
25 | dimension "base"
26 | }
27 | }
28 | }
29 |
30 | dependencies {
31 | // Kotlin
32 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:' + KOTLIN_VERSION
33 |
34 | // locus API
35 | implementation project(':locus-api-android')
36 | // implementation 'com.asamm:locus-api-android:' + API_VERSION
37 |
38 | // lib with some design utils
39 | implementation 'com.google.android.material:material:1.12.0'
40 | // base core
41 | implementation 'androidx.appcompat:appcompat:1.7.0'
42 | }
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/512.png
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_0_0_0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_0_0_0.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_0_0_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_0_0_1.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_0_0_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_0_0_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_0_1_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_0_1_1.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_0_1_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_0_1_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_0_2_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_0_2_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_0_3_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_0_3_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_1_0_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_1_0_1.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_1_0_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_1_0_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_1_1_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_1_1_1.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_1_1_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_1_1_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_1_2_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_1_2_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_1_3_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_1_3_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_2_0_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_2_0_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_2_1_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_2_1_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_2_2_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_2_2_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_2_3_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_2_3_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_3_0_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_3_0_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_3_1_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_3_1_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_3_2_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_3_2_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/assets/map_tiles/tile_3_3_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/assets/map_tiles/tile_3_3_2.jpg
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/ActivityGeocacheTools.kt:
--------------------------------------------------------------------------------
1 | package com.asamm.locus.api.sample
2 |
3 | import android.annotation.SuppressLint
4 | import android.app.AlertDialog
5 | import android.os.Bundle
6 | import android.widget.TextView
7 | import android.widget.Toast
8 | import androidx.fragment.app.FragmentActivity
9 | import com.asamm.loggerV2.logD
10 | import com.asamm.loggerV2.logE
11 | import locus.api.android.ActionBasics
12 | import locus.api.android.utils.IntentHelper
13 | import locus.api.android.utils.LocusUtils
14 | import locus.api.objects.extra.GeoDataExtra
15 |
16 | class ActivityGeocacheTools : FragmentActivity() {
17 |
18 | @SuppressLint("SetTextI18n")
19 | public override fun onCreate(savedInstanceState: Bundle?) {
20 | super.onCreate(savedInstanceState)
21 |
22 | val tv = TextView(this)
23 | tv.text = "ActivityGeocacheTools - only for receiving Tools actions from cache"
24 | setContentView(tv)
25 |
26 | // finally check intent that started this sample
27 | checkStartIntent()
28 | }
29 |
30 | private fun checkStartIntent() {
31 | val intent = intent
32 | logD(tag = TAG) { "received intent: $intent" }
33 | if (intent == null) {
34 | return
35 | }
36 |
37 | // get Locus from intent
38 | val lv = LocusUtils.createLocusVersion(this, intent)
39 | if (lv == null) {
40 | logD(tag = TAG) { "checkStartIntent(), cannot obtain LocusVersion" }
41 | return
42 | }
43 |
44 | if (IntentHelper.isIntentPointTools(intent)) {
45 | try {
46 | val pt = IntentHelper.getPointFromIntent(this, intent)
47 | if (pt == null) {
48 | Toast.makeText(
49 | this@ActivityGeocacheTools,
50 | "Wrong INTENT - no point!",
51 | Toast.LENGTH_SHORT
52 | ).show()
53 | } else {
54 | AlertDialog.Builder(this)
55 | .setTitle("Intent - On Point action")
56 | .setMessage(
57 | "Received intent with point:\n\n" + pt.name + "\n\n" +
58 | "loc:" + pt.location + "\n\n" +
59 | "gcData:" + if (pt.gcData == null) "sorry, but no..." else pt.gcData!!.cacheID
60 | )
61 | .setNegativeButton("Close") { _, _ ->
62 | // just do some action on required coordinates
63 | }
64 | .setPositiveButton("Send updated back") { _, _ ->
65 | // because current test version is registered on geocache data,
66 | // I'll send as result updated geocache
67 | try {
68 | pt.addParameter(GeoDataExtra.PAR_DESCRIPTION, "UPDATED!")
69 | pt.location.latitude = pt.location.latitude + 0.001
70 | pt.location.longitude = pt.location.longitude + 0.001
71 | ActionBasics.updatePoint(this@ActivityGeocacheTools, lv, pt, false)
72 | finish()
73 | } catch (e: Exception) {
74 | logE(tag = TAG, ex = e) {
75 | "isIntentPointTools(), problem with sending new waypoint back"
76 | }
77 | }
78 | }
79 | .show()
80 | }
81 | } catch (e: Exception) {
82 | logE(tag = TAG, ex = e) { "handle point tools" }
83 | }
84 |
85 | }
86 | }
87 |
88 | companion object {
89 |
90 | private const val TAG = "ActivityGeocacheTools"
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/MainApplication.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by menion on 29/08/2016.
3 | * This code is part of Locus project from Asamm Software, s. r. o.
4 | */
5 | package com.asamm.locus.api.sample
6 |
7 | import android.app.Application
8 | import android.util.Log
9 | import com.asamm.logger.Logger
10 |
11 | class MainApplication : Application() {
12 |
13 | override fun onCreate() {
14 | super.onCreate()
15 |
16 | // setup logger system
17 | Logger.registerLogger(object : Logger.ILogger {
18 |
19 | override fun logD(ex: Throwable?, tag: String, msg: String, vararg args: Any) {
20 | Log.d(tag, msg.format(args), ex)
21 | }
22 |
23 | override fun logE(ex: Throwable?, tag: String, msg: String, vararg args: Any) {
24 | Log.e(tag, msg.format(args), ex)
25 | }
26 |
27 | override fun logI(tag: String, msg: String, vararg args: Any) {
28 | Log.i(tag, msg.format(args))
29 | }
30 |
31 | override fun logV(tag: String, msg: String, vararg args: Any) {
32 | Log.v(tag, msg.format(args))
33 | }
34 |
35 | override fun logW(ex: Throwable?, tag: String, msg: String, vararg args: Any) {
36 | Log.w(tag, msg.format(args), ex)
37 | }
38 | })
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/mapServer/MapProvider.kt:
--------------------------------------------------------------------------------
1 | package com.asamm.locus.api.sample.mapServer
2 |
3 | import android.graphics.BitmapFactory
4 | import com.asamm.loggerV2.logE
5 | import locus.api.android.features.mapProvider.MapTileService
6 | import locus.api.android.features.mapProvider.data.MapConfigLayer
7 | import locus.api.android.features.mapProvider.data.MapTileRequest
8 | import locus.api.android.features.mapProvider.data.MapTileResponse
9 | import locus.api.utils.Utils
10 | import java.io.ByteArrayOutputStream
11 | import java.io.InputStream
12 |
13 | /**
14 | * Service that provide map data to Locus Map application.
15 | *
16 | * Service is not yet fully working, so consider this as "work in progress".
17 | */
18 | class MapProvider : MapTileService() {
19 |
20 | override val mapConfigs: List
21 | get() = generateMapConfig()
22 |
23 | override fun getMapTile(request: MapTileRequest): MapTileResponse {
24 | return loadMapTile(request)
25 | }
26 |
27 | private fun generateMapConfig(): List {
28 | val maps = ArrayList()
29 | maps.add(generateMapConfiguration(0))
30 | maps.add(generateMapConfiguration(1))
31 | maps.add(generateMapConfiguration(2))
32 | return maps
33 | }
34 |
35 | private fun generateMapConfiguration(zoom: Int): MapConfigLayer {
36 | val mapSize = 1 shl zoom + 8
37 |
38 | // create empty object and set projection (Spherical Mercator)
39 | val mapConfig = MapConfigLayer()
40 | mapConfig.projEpsg = 3857
41 |
42 | // set name and description
43 | mapConfig.name = "OSM MapQuest"
44 | mapConfig.description = "Testing map"
45 |
46 | // define size of tiles
47 | mapConfig.tileSizeX = 256
48 | mapConfig.tileSizeY = 256
49 |
50 | // define size of map
51 | mapConfig.xmax = mapSize.toLong()
52 | mapConfig.ymax = mapSize.toLong()
53 |
54 | // specify zoom level
55 | mapConfig.zoom = zoom
56 |
57 | // add at least two calibration points
58 | val maxX = 20037508.343
59 | val maxY = 20037508.343
60 | mapConfig.addCalibrationPoint(0.0, 0.0, maxY, -maxX)
61 | mapConfig.addCalibrationPoint(mapSize.toDouble(), 0.0, maxY, maxX)
62 | mapConfig.addCalibrationPoint(0.0, mapSize.toDouble(), -maxY, -maxX)
63 | mapConfig.addCalibrationPoint(mapSize.toDouble(), mapSize.toDouble(), -maxY, maxX)
64 |
65 | // return generated map
66 | return mapConfig
67 | }
68 |
69 | private fun loadMapTile(request: MapTileRequest): MapTileResponse {
70 | val resp = MapTileResponse()
71 |
72 | // load images
73 | val fileName = "tile_" + request.tileX + "_" +
74 | request.tileY + "_" + request.tileZoom + ".jpg"
75 | val tileData = loadMapTile(fileName)
76 | if (tileData == null || tileData.isEmpty()) {
77 | resp.resultCode = MapTileResponse.CODE_NOT_EXISTS
78 | return resp
79 | }
80 |
81 | // convert to bitmap
82 | val img = BitmapFactory.decodeByteArray(tileData, 0, tileData.size)
83 | return if (img == null) {
84 | resp.resultCode = MapTileResponse.CODE_INTERNAL_ERROR
85 | resp
86 | } else {
87 | resp.resultCode = MapTileResponse.CODE_VALID
88 | resp.image = img
89 | resp
90 | }
91 | }
92 |
93 | private fun loadMapTile(name: String): ByteArray? {
94 | var input: InputStream? = null
95 | return try {
96 | input = assets.open("map_tiles/$name")
97 | ByteArrayOutputStream()
98 | .apply { input.copyTo(this) }
99 | .toByteArray()
100 | } catch (e: Exception) {
101 | logE(tag = TAG, ex = e) { "loadMapTile($name), not exists" }
102 | null
103 | } finally {
104 | Utils.closeStream(input)
105 | }
106 | }
107 |
108 | companion object {
109 |
110 | // tag for logger
111 | private const val TAG = "MapProvider"
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/pages/ABasePageFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by menion on 29/08/2016.
3 | * This code is part of Locus project from Asamm Software, s. r. o.
4 | */
5 | package com.asamm.locus.api.sample.pages
6 |
7 | import android.content.Context
8 | import android.os.Bundle
9 | import android.view.LayoutInflater
10 | import android.view.View
11 | import android.view.ViewGroup
12 | import android.widget.ListView
13 | import android.widget.Toast
14 | import androidx.fragment.app.Fragment
15 | import com.asamm.locus.api.sample.MainActivity
16 | import com.asamm.locus.api.sample.utils.BasicAdapter
17 | import com.asamm.locus.api.sample.utils.BasicAdapterItem
18 | import com.asamm.loggerV2.logE
19 | import locus.api.android.objects.LocusVersion
20 | import locus.api.android.utils.LocusUtils
21 |
22 | abstract class ABasePageFragment : Fragment() {
23 |
24 | /**
25 | * Reference to main parent activity.
26 | */
27 | lateinit var act: MainActivity
28 |
29 | /**
30 | * Get available features.
31 | * @return list of features
32 | */
33 | protected abstract val items: List
34 |
35 | override fun onAttach(context: Context) {
36 | super.onAttach(context)
37 | this.act = context as MainActivity
38 | }
39 |
40 | override fun onCreateView(
41 | inflater: LayoutInflater,
42 | container: ViewGroup?,
43 | savedInstanceState: Bundle?
44 | ): View? {
45 |
46 | // prepare adapter and ListView
47 | val lv = ListView(act)
48 | val items = items
49 | val adapter = BasicAdapter(act, items)
50 | lv.adapter = adapter
51 | lv.setOnItemClickListener { _, _, position, _ ->
52 | // check valid Locus version
53 | val activeLocus = LocusUtils.getActiveVersion(act)
54 | if (activeLocus == null) {
55 | Toast.makeText(
56 | act,
57 | "Locus is not installed", Toast.LENGTH_LONG
58 | ).show()
59 | return@setOnItemClickListener
60 | }
61 |
62 | // handle event
63 | val item = items[position]
64 | try {
65 | onItemClicked(item.id, activeLocus)
66 | } catch (e: Exception) {
67 | Toast.makeText(
68 | act,
69 | "Problem with action:" + item.id, Toast.LENGTH_LONG
70 | ).show()
71 | logE(tag = TAG, ex = e) {
72 | "onItemClick(), item:" + item.id + " failed"
73 | }
74 | }
75 | }
76 |
77 | // return layout
78 | return lv
79 | }
80 |
81 | /**
82 | * Handle click event.
83 | * @param itemId ID of item
84 | * @param activeLocus active Locus Map application
85 | * @throws Exception various exceptions
86 | */
87 | @Throws(Exception::class)
88 | protected abstract fun onItemClicked(itemId: Int, activeLocus: LocusVersion)
89 |
90 | companion object {
91 |
92 | // tag for logger
93 | private const val TAG = "ABasePageFragment"
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/pages/PageBroadcastApiSamples.kt:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | *
3 | * Created by menion on 18/12/2018.
4 | * Copyright (c) 2018. All rights reserved.
5 | *
6 | * This file is part of the Asamm team software.
7 | *
8 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 | *
11 | ***************************************************************************/
12 |
13 | package com.asamm.locus.api.sample.pages
14 |
15 | import android.app.Dialog
16 | import android.content.Intent
17 | import android.os.Bundle
18 | import android.widget.ListView
19 | import android.widget.Toast
20 | import androidx.appcompat.app.AlertDialog
21 | import androidx.fragment.app.DialogFragment
22 | import com.asamm.locus.api.sample.utils.BasicAdapter
23 | import com.asamm.locus.api.sample.utils.BasicAdapterItem
24 | import com.asamm.loggerV2.logE
25 | import locus.api.android.objects.LocusVersion
26 | import locus.api.android.utils.LocusUtils
27 |
28 | class PageBroadcastApiSamples : DialogFragment() {
29 |
30 | override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
31 | return AlertDialog.Builder(requireContext())
32 | .setView(createContent())
33 | .setPositiveButton("Close") { _, _ -> }
34 | .create()
35 | }
36 |
37 | private fun createContent(): ListView {
38 | // prepare adapter and ListView
39 | val lv = ListView(activity)
40 | val items = getItems()
41 | val adapter = BasicAdapter(requireContext(), items)
42 | lv.adapter = adapter
43 | lv.setOnItemClickListener { _, _, position, _ ->
44 | // check valid Locus version
45 | val activeLocus = LocusUtils.getActiveVersion(requireContext())
46 | if (activeLocus == null) {
47 | Toast.makeText(
48 | activity,
49 | "Locus is not installed", Toast.LENGTH_LONG
50 | ).show()
51 | return@setOnItemClickListener
52 | }
53 |
54 | // handle event
55 | val item = items[position]
56 | try {
57 | onItemClicked(item.id, activeLocus)
58 | } catch (e: Exception) {
59 | Toast.makeText(
60 | activity,
61 | "Problem with action:" + item.id, Toast.LENGTH_LONG
62 | ).show()
63 | logE { "onItemClick(), item:" + item.id + " failed" }
64 | }
65 | }
66 |
67 | // return layout
68 | return lv
69 | }
70 |
71 | private fun getItems(): MutableList {
72 | val items = ArrayList()
73 | items.add(BasicAdapterItem(1, "Toggle centering"))
74 | items.add(BasicAdapterItem(12, "Toggle rotation"))
75 | items.add(BasicAdapterItem(2, "Move map top-left"))
76 | items.add(BasicAdapterItem(3, "Move map bottom-right"))
77 | items.add(BasicAdapterItem(4, "Zoom map in"))
78 | items.add(BasicAdapterItem(5, "Zoom map out"))
79 | items.add(BasicAdapterItem(10, "Open map manager"))
80 | items.add(BasicAdapterItem(11, "Open quick action menu"))
81 | return items
82 | }
83 |
84 | private fun onItemClicked(itemId: Int, activeLocus: LocusVersion) {
85 | when (itemId) {
86 | 1 -> activity?.sendBroadcast(Intent("com.asamm.locus.ACTION_TASK").apply {
87 | setPackage(activeLocus.packageName)
88 | putExtra("tasks", "{ map_center: { action: \"toggle\" } }")
89 | })
90 | 2 -> activity?.sendBroadcast(Intent("com.asamm.locus.ACTION_TASK").apply {
91 | setPackage(activeLocus.packageName)
92 | putExtra(
93 | "tasks",
94 | "{ map_move_x: { value: -25, unit: \"%\" }, map_move_y: { value: -25, unit: \"%\" } }"
95 | )
96 | })
97 | 3 -> activity?.sendBroadcast(Intent("com.asamm.locus.ACTION_TASK").apply {
98 | setPackage(activeLocus.packageName)
99 | putExtra(
100 | "tasks",
101 | "{ map_move_x: { value: 25, unit: \"%\" }, map_move_y: { value: 25, unit: \"%\" } }"
102 | )
103 | })
104 | 4 -> activity?.sendBroadcast(Intent("com.asamm.locus.ACTION_TASK").apply {
105 | setPackage(activeLocus.packageName)
106 | putExtra("tasks", "{ map_zoom: { action: \"+\" } }")
107 | })
108 | 5 -> activity?.sendBroadcast(Intent("com.asamm.locus.ACTION_TASK").apply {
109 | setPackage(activeLocus.packageName)
110 | putExtra("tasks", "{ map_zoom: { action: \"-\" } }")
111 | })
112 | 10 -> activity?.sendBroadcast(Intent("com.asamm.locus.ACTION_TASK").apply {
113 | setPackage(activeLocus.packageName)
114 | putExtra("tasks", "{ function: { value: \"screen_maps\" } }")
115 | })
116 | 11 -> activity?.sendBroadcast(Intent("com.asamm.locus.ACTION_TASK").apply {
117 | setPackage(activeLocus.packageName)
118 | putExtra("tasks", "{ function: { value: \"quick_action_menu\" } }")
119 | })
120 | 12 -> activity?.sendBroadcast(Intent("com.asamm.locus.ACTION_TASK").apply {
121 | setPackage(activeLocus.packageName)
122 | putExtra("tasks", "{ map_rotate: { action: \"toggle\" } }")
123 | })
124 | }
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/pages/PagePointsFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by menion on 29/08/2016.
3 | * This code is part of Locus project from Asamm Software, s. r. o.
4 | */
5 | package com.asamm.locus.api.sample.pages
6 |
7 | import com.asamm.locus.api.sample.utils.BasicAdapterItem
8 | import com.asamm.locus.api.sample.utils.SampleCalls
9 | import locus.api.android.objects.LocusVersion
10 | import java.util.*
11 |
12 | class PagePointsFragment : ABasePageFragment() {
13 |
14 | override val items: List
15 | get() {
16 | val items = ArrayList()
17 | items.add(BasicAdapterItem(1,
18 | "Import one point",
19 | "Send one simple point to Locus and execute 'import' request. If Locus does not run, this intent starts it."))
20 | items.add(BasicAdapterItem(2,
21 | "Import more points at once",
22 | "One of possibilities how to send data to Locus and execute 'import'. Number of points is limited by capacity of Intent. On 2.X devices - 1 MB, on 4.X+ devices - 2 MB."))
23 | items.add(BasicAdapterItem(3,
24 | "Display one point with icon",
25 | "Send one simple point to Locus together with icon defined as bitmap."))
26 | items.add(BasicAdapterItem(4,
27 | "Display more points with icons",
28 | "Send more points with various attached icons (all as bitmaps)."))
29 | items.add(BasicAdapterItem(5,
30 | "Display Geocaching point",
31 | "Geocache points behave a little bit different in Locus. This sample shows how to create it and how to display it on a map."))
32 | items.add(BasicAdapterItem(6,
33 | "Display more Geocaches over intent",
34 | "Improved version where we send more geocache points at once."))
35 | items.add(BasicAdapterItem(7,
36 | "Display more Geocaches over local File",
37 | "Second way how to send data (not just geocaches) to Locus is over a file. It is limited only by the device memory space for every app because Locus loads all data at once. Method is slower than \"intent\" only method but limits on number of points are not so strict."))
38 | items.add(BasicAdapterItem(8,
39 | "Display point with `onDisplay callback`",
40 | "Display simple point on the map. When user tap on your point, you will be notified about it. You may then supply additional information and send it back to Locus before 'Point screen' appears."))
41 | items.add(BasicAdapterItem(9,
42 | "Display point with custom button",
43 | "Display simple point on the map. After user display point detail, in bottom menu will be custom define action button."))
44 | items.add(BasicAdapterItem(10,
45 | "Request ID of a point by its name",
46 | "Allows to search in Locus internal point database for point by its name. Results in a list of points (its IDs) that match requested name."))
47 | items.add(BasicAdapterItem(11,
48 | "Display 'Point screen' of a certain point",
49 | "Allows to display main 'Point screen' of a certain point defined by its ID."))
50 | return items
51 | }
52 |
53 | @Throws(Exception::class)
54 | override fun onItemClicked(itemId: Int, activeLocus: LocusVersion) {
55 | when (itemId) {
56 | 1 -> SampleCalls.callSendOnePoint(act)
57 | 2 -> SampleCalls.callSendMorePoints(act)
58 | 3 -> SampleCalls.callSendOnePointWithIcon(act)
59 | 4 -> SampleCalls.callSendMorePointsWithIcons(act)
60 | 5 -> SampleCalls.callSendOnePointGeocache(act)
61 | 6 -> SampleCalls.callSendMorePointsGeocacheIntentMethod(act)
62 | 7 -> SampleCalls.callSendMorePointsGeocacheFileMethod(act)
63 | 8 -> SampleCalls.callSendOnePointWithCallbackOnDisplay(act)
64 | 9 -> SampleCalls.callSendOnePointWithExtraCallback(act)
65 | 10 -> SampleCalls.callRequestPointIdByName(act, activeLocus)
66 | 11 -> SampleCalls.callRequestDisplayPointScreen(act, activeLocus, 3)
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/pages/PageTracksFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by menion on 29/08/2016.
3 | * This code is part of Locus project from Asamm Software, s. r. o.
4 | */
5 | package com.asamm.locus.api.sample.pages
6 |
7 | import com.asamm.locus.api.sample.utils.BasicAdapterItem
8 | import com.asamm.locus.api.sample.utils.SampleCalls
9 | import locus.api.android.ActionBasics
10 | import locus.api.android.objects.LocusVersion
11 | import java.util.*
12 |
13 | class PageTracksFragment : ABasePageFragment() {
14 |
15 | override val items: List
16 | get() {
17 | // create list of items
18 | val items = ArrayList()
19 | items.add(BasicAdapterItem(1,
20 | "Display one track",
21 | "Display single huge track, send over fileUri."))
22 | items.add(BasicAdapterItem(2,
23 | "Display multiple tracks",
24 | "Quickly display multiple small tracks at once."))
25 |
26 | items.add(BasicAdapterItem(8,
27 | "Start Navigation (to a point)",
28 | "Allows to start Navigation to a certain point. This function is a direct intent so it starts Locus if it's not running. You may also use 'actionStartGuiding' to start Guiding instead of Navigation."))
29 | items.add(BasicAdapterItem(9,
30 | "Start Navigation (to an Address)",
31 | "Allows to start Navigation to a certain point defined by an address."))
32 |
33 | items.add(BasicAdapterItem(20,
34 | "Start Track recording",
35 | "Allows to start track recording. This call is sent as Broadcast event so it requires to know LocusVersion that should start track recording."))
36 | items.add(BasicAdapterItem(21,
37 | "Stop Track recording",
38 | "The same as previous sample, just used to stop the track recording."))
39 | return items
40 | }
41 |
42 | @Throws(Exception::class)
43 | override fun onItemClicked(itemId: Int, activeLocus: LocusVersion) {
44 | when (itemId) {
45 | 1 -> SampleCalls.callSendOneTrack(requireActivity())
46 | 2 -> SampleCalls.callSendMultipleTracks(requireActivity())
47 | 8 -> ActionBasics.actionStartNavigation(requireActivity(),
48 | SampleCalls.generateWaypoint(1))
49 | 9 -> ActionBasics.actionStartNavigation(requireActivity(),
50 | "Řipská 20, Praha 2, ČR")
51 | 20 -> // start track recording. Recording profile "Cycle" is optional parameter. If
52 | // this parameter is not used, last used profile is used for recording.
53 | ActionBasics.actionTrackRecordStart(requireActivity(), activeLocus)
54 | 21 -> ActionBasics.actionTrackRecordStop(requireActivity(), activeLocus, true)
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/pages/PageWelcomeFragment.kt:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by menion on 29/08/2016.
3 | * This code is part of Locus project from Asamm Software, s. r. o.
4 | */
5 | package com.asamm.locus.api.sample.pages
6 |
7 | import android.os.Bundle
8 | import android.view.LayoutInflater
9 | import android.view.View
10 | import android.view.ViewGroup
11 | import androidx.fragment.app.Fragment
12 | import com.asamm.locus.api.sample.R
13 |
14 | class PageWelcomeFragment : Fragment() {
15 |
16 | override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
17 | return inflater.inflate(R.layout.page_welcome, container, false)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/receivers/OnTrackExportedReceiver.kt:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | *
3 | * Created by menion on 15/03/2019.
4 | * Copyright (c) 2019. All rights reserved.
5 | *
6 | * This file is part of the Asamm team software.
7 | *
8 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 | *
11 | ***************************************************************************/
12 |
13 | package com.asamm.locus.api.sample.receivers
14 |
15 | import android.content.BroadcastReceiver
16 | import android.content.Context
17 | import android.content.Intent
18 | import android.widget.Toast
19 | import com.asamm.locus.api.sample.utils.Utils
20 | import com.asamm.loggerV2.logD
21 | import com.asamm.loggerV2.logE
22 | import com.asamm.loggerV2.logW
23 | import locus.api.android.utils.LocusConst
24 |
25 | class OnTrackExportedReceiver : BroadcastReceiver() {
26 |
27 | override fun onReceive(context: Context, intent: Intent) {
28 | logD(tag = TAG) { "onReceive($context, $intent)" }
29 | try {
30 | // check if defined (optional) extra match
31 | val resultExtra = intent.getStringExtra("resultExtra")
32 | if (resultExtra == "test") {
33 | logW(tag = TAG) {
34 | "received resultExtra `" + resultExtra + "` " +
35 | "does not match expected `xxx`. Export incorrect."
36 | }
37 | return
38 | }
39 |
40 | // check if result is valid
41 | intent.data?.let {
42 | val targetFile = createTempFile(System.currentTimeMillis().toString(), "gpx")
43 | Utils.copy(context, it, targetFile)
44 | Toast.makeText(
45 | context, "Process successful\n\nDir:" + targetFile.name +
46 | ", exists:" + targetFile.exists(),
47 | Toast.LENGTH_LONG
48 | ).show()
49 | } ?: {
50 | val errorMessage = intent.getStringExtra(LocusConst.INTENT_EXTRA_ERROR)
51 | Toast.makeText(
52 | context, "Process failed\n\nError: $errorMessage",
53 | Toast.LENGTH_LONG
54 | ).show()
55 | }()
56 |
57 | } catch (e: Exception) {
58 | logE(tag = TAG, ex = e) { "onReceive($context, $intent)" }
59 | }
60 | }
61 |
62 | companion object {
63 |
64 | // tag for logger
65 | private const val TAG = "OnTrackExportedReceiver"
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/receivers/PointChangedReceiver.kt:
--------------------------------------------------------------------------------
1 | package com.asamm.locus.api.sample.receivers
2 |
3 | import android.content.BroadcastReceiver
4 | import android.content.Context
5 | import android.content.Intent
6 | import android.widget.Toast
7 | import com.asamm.loggerV2.logE
8 | import com.asamm.loggerV2.logW
9 | import locus.api.android.ActionBasics
10 | import locus.api.android.objects.LocusVersion
11 | import locus.api.android.utils.LocusConst
12 | import locus.api.android.utils.LocusUtils
13 | import locus.api.android.utils.exceptions.RequiredVersionMissingException
14 |
15 | class PointChangedReceiver : BroadcastReceiver() {
16 |
17 | override fun onReceive(ctx: Context, intent: Intent?) {
18 | // check intent
19 | if (intent?.action == null) {
20 | logW(tag = TAG) {
21 | "onReceive(" + ctx + ", " + intent + "), " +
22 | "intent is invalid"
23 | }
24 | return
25 | }
26 |
27 | // get data from intent. Code of geocache is optional parameter, that is
28 | // available only in case, edited point was geocache. This is useful for cases,
29 | // you want handle just caches, nothing more
30 | val pointId = intent.getLongExtra(
31 | LocusConst.INTENT_EXTRA_ITEM_ID, -1L
32 | )
33 | val name = intent.getStringExtra(
34 | LocusConst.INTENT_EXTRA_NAME
35 | ) ?: ""
36 | var gcCode: String? = null
37 | if (intent.hasExtra(LocusConst.INTENT_EXTRA_GEOCACHE_CODE)) {
38 | gcCode = intent.getStringExtra(
39 | LocusConst.INTENT_EXTRA_GEOCACHE_CODE
40 | )
41 | }
42 |
43 | // handle received data
44 | LocusUtils.createLocusVersion(ctx, intent)?.let {
45 | handleReceivedPoint(ctx, it, pointId, name, gcCode)
46 | } ?: run {
47 | logW(tag = TAG) {
48 | "onReceive($ctx, $intent), " +
49 | "unable to obtain valid Locus version"
50 | }
51 | }
52 | }
53 |
54 | private fun handleReceivedPoint(
55 | ctx: Context, lv: LocusVersion,
56 | pointId: Long, pointName: String, cacheCode: String?
57 | ): Boolean {
58 |
59 | // get full point from Locus
60 | try {
61 | val wpt = ActionBasics.getPoint(ctx, lv, pointId)
62 | if (wpt == null) {
63 | logE(tag = TAG) {
64 | "handleReceivedPoint(" + ctx + ", " +
65 | pointId + ", " + pointName + ", " + cacheCode + "), " +
66 | "problem with loading of waypoint"
67 | }
68 | return false
69 | }
70 |
71 | // notify about loaded point by Toast. We can't display dialog, because there
72 | // is no guarantee, application is running
73 | Toast.makeText(ctx, "Point changed:$wpt", Toast.LENGTH_LONG).show()
74 |
75 | // now handle waypoint
76 | // TODO
77 | return true
78 | } catch (e: RequiredVersionMissingException) {
79 | // error if required Locus version is not available
80 | logE(tag = TAG, ex = e) {
81 | "handleReceivedPoint(" + ctx + ", " +
82 | pointId + ", " + pointName + ", " + cacheCode + ")"
83 | }
84 | return false
85 | }
86 | }
87 |
88 | companion object {
89 |
90 | private const val TAG = "PointChangedReceiver"
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/utils/BasicAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.asamm.locus.api.sample.utils
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import android.widget.ArrayAdapter
8 | import android.widget.TextView
9 |
10 | import com.asamm.locus.api.sample.R
11 |
12 | class BasicAdapter(ctx: Context, items: List)
13 | : ArrayAdapter(ctx, 0, items) {
14 |
15 | // main inflater
16 | private val inflater: LayoutInflater = ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
17 |
18 | override fun getItemId(pos: Int): Long {
19 | return getItem(pos)!!.id.toLong()
20 | }
21 |
22 | override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
23 | return prepareView(position, convertView, parent)
24 | }
25 |
26 | private fun prepareView(position: Int, convertView: View?, parent: ViewGroup): View {
27 | // prepare item
28 | val finalView = convertView
29 | ?: inflater.inflate(R.layout.basic_list_item, parent, false)
30 |
31 | // get current item
32 | val item = getItem(position)
33 |
34 | // set new item
35 | val tvTitle = finalView!!.findViewById(R.id.text_view_title) as TextView
36 | tvTitle.text = item!!.name
37 |
38 | val tvDesc = finalView.findViewById(R.id.text_view_desc) as TextView
39 | if (item.desc.isNotEmpty()) {
40 | tvDesc.visibility = View.VISIBLE
41 | tvDesc.text = item.desc
42 | } else {
43 | tvDesc.visibility = View.GONE
44 | }
45 |
46 | // return filled view
47 | return finalView
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/utils/BasicAdapterItem.kt:
--------------------------------------------------------------------------------
1 | package com.asamm.locus.api.sample.utils
2 |
3 | data class BasicAdapterItem @JvmOverloads constructor(
4 | val id: Int,
5 | val name: CharSequence,
6 | val desc: CharSequence = "")
7 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/java/com/asamm/locus/api/sample/utils/Utils.kt:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | *
3 | * Created by menion on 15/03/2019.
4 | * Copyright (c) 2019. All rights reserved.
5 | *
6 | * This file is part of the Asamm team software.
7 | *
8 | * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
9 | * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
10 | *
11 | ***************************************************************************/
12 |
13 | package com.asamm.locus.api.sample.utils
14 |
15 | import android.content.Context
16 | import android.net.Uri
17 | import java.io.DataInputStream
18 | import java.io.File
19 | import java.io.FileOutputStream
20 | import java.io.IOException
21 |
22 | /**
23 | * Class with small helping utils.
24 | */
25 | object Utils {
26 |
27 | /**
28 | * Copy content from defined Uri into file object.
29 | *
30 | * @param ctx current context
31 | * @param source source received Uri
32 | * @param dst destination file
33 | */
34 | @Throws(IOException::class)
35 | fun copy(ctx: Context, source: Uri, dst: File) {
36 | DataInputStream(ctx.contentResolver.openInputStream(source)).use { inStream ->
37 | FileOutputStream(dst).use { out ->
38 | val buf = ByteArray(10240)
39 | while (true) {
40 | val len = inStream.read(buf)
41 | if (len > 0) {
42 | out.write(buf, 0, len)
43 | } else {
44 | break
45 | }
46 | }
47 | }
48 | }
49 | }
50 |
51 | }
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/drawable-hdpi/ic_action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/res/drawable-hdpi/ic_action_search.png
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/drawable-mdpi/ic_action_search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/res/drawable-mdpi/ic_action_search.png
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/drawable-xhdpi/drawer_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/res/drawable-xhdpi/drawer_shadow.9.png
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asamm/locus-api/830cd149bf9944ef947022014d64fd58a9bfb58f/locus-api-android-sample/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/layout/activity_dashboard.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
14 |
15 |
19 |
20 |
28 |
29 |
37 |
38 |
39 |
43 |
44 |
52 |
53 |
61 |
62 |
63 |
67 |
68 |
76 |
77 |
85 |
86 |
87 |
91 |
92 |
100 |
101 |
109 |
110 |
111 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
10 |
11 |
15 |
16 |
18 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/layout/basic_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
21 |
22 |
29 |
30 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/layout/page_welcome.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
23 |
24 |
30 |
31 |
37 |
38 |
45 |
46 |
54 |
55 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/menu/activity_main.xml:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/values-large/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 8dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.asamm.locus.api.sample.provider
4 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 8dp
4 | 8dp
5 | 16dp
6 | 16dp
7 | 200dp
8 | 200dp
9 | 16dp
10 |
11 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Locus API - sample
4 | Settings
5 |
6 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
25 |
26 |
30 |
31 |
37 |
38 |
39 |
40 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/locus-api-android-sample/src/main/res/xml/filepaths.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
9 |
10 |
13 |
16 |
19 |
22 |
--------------------------------------------------------------------------------
/locus-api-android/build.gradle:
--------------------------------------------------------------------------------
1 | // apply plugins
2 | apply plugin: 'com.android.library'
3 | apply plugin: "kotlin-android"
4 |
5 | // Android basics
6 | android {
7 | namespace = "locus.api.android"
8 |
9 | compileSdkVersion Integer.valueOf(PARAM_COMPILE_SDK_VERSION)
10 | buildToolsVersion ANDROID_BUILD_TOOLS
11 |
12 | // define default parameters
13 | defaultConfig {
14 | minSdkVersion Integer.valueOf(PARAM_MIN_SDK_VERSION)
15 | targetSdkVersion Integer.valueOf(PARAM_TARGET_SDK_VERSION)
16 |
17 | versionCode Integer.valueOf(API_CODE)
18 | versionName API_VERSION
19 | }
20 |
21 | // set compile target
22 | compileOptions {
23 | sourceCompatibility = JavaVersion.VERSION_17
24 | targetCompatibility = JavaVersion.VERSION_17
25 | }
26 | kotlinOptions {
27 | jvmTarget = JavaVersion.VERSION_17.toString()
28 | }
29 |
30 | buildTypes {
31 | release {
32 | minifyEnabled false
33 | }
34 | }
35 |
36 | buildFeatures {
37 | aidl = true
38 | }
39 | }
40 |
41 | dependencies {
42 | // Kotlin
43 | api 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:' + KOTLIN_VERSION
44 | api 'androidx.annotation:annotation:1.9.1'
45 |
46 | // use in case of direct handling over Locus Core project
47 | debugApi project(':locus-api-core')
48 | // use in case of publishing to Maven. 'api' needs to be set in artifact as well
49 | releaseApi 'com.asamm:locus-api-core:' + API_VERSION
50 | }
51 |
52 | // Maven publisher
53 | ext {
54 | PUBLISH_GROUP_ID = 'com.asamm'
55 | PUBLISH_ARTIFACT_ID = 'locus-api-android'
56 | PUBLISH_VERSION = API_VERSION
57 | }
58 | apply from: "${rootProject.projectDir}/gradle/publish-mavencentral.gradle"
--------------------------------------------------------------------------------
/locus-api-android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/locus-api-android/src/main/aidl/locus/api/android/features/computeTrack/IComputeTrackService.aidl:
--------------------------------------------------------------------------------
1 | // IComputeTrackService.aidl
2 | package locus.api.android.features.computeTrack;
3 |
4 | import locus.api.android.objects.ParcelableContainer;
5 | import android.content.Intent;
6 |
7 | interface IComputeTrackService {
8 |
9 | String getAttribution();
10 |
11 | int[] getTrackTypes();
12 |
13 | Intent getIntentForSettings();
14 |
15 | ParcelableContainer computeTrack(in ParcelableContainer trackParams);
16 |
17 | int getNumOfTransitPoints();
18 | }
19 |
--------------------------------------------------------------------------------
/locus-api-android/src/main/aidl/locus/api/android/features/mapProvider/IMapTileService.aidl:
--------------------------------------------------------------------------------
1 | // IMapTileService.aidl
2 | package locus.api.android.features.mapProvider;
3 |
4 | import locus.api.android.features.mapProvider.MapDataContainer;
5 |
6 | interface IMapTileService {
7 |
8 | MapDataContainer getMapConfigs();
9 |
10 | MapDataContainer getMapTile(in MapDataContainer request);
11 | }
12 |
--------------------------------------------------------------------------------
/locus-api-android/src/main/aidl/locus/api/android/features/mapProvider/MapDataContainer.aidl:
--------------------------------------------------------------------------------
1 | // MapDataContainer.aidl
2 | package locus.api.android.features.mapProvider;
3 |
4 | parcelable MapDataContainer;
--------------------------------------------------------------------------------
/locus-api-android/src/main/aidl/locus/api/android/objects/ParcelableContainer.aidl:
--------------------------------------------------------------------------------
1 | // ParcelableContainer.aidl
2 | package locus.api.android.objects;
3 |
4 | parcelable ParcelableContainer;
--------------------------------------------------------------------------------
/locus-api-android/src/main/java/locus/api/android/ActionDisplayTracks.kt:
--------------------------------------------------------------------------------
1 | package locus.api.android
2 |
3 | import android.content.Context
4 | import locus.api.android.features.sendToApp.SendMode
5 | import locus.api.android.features.sendToApp.tracks.SendTrack
6 | import locus.api.android.features.sendToApp.tracks.SendTracks
7 | import locus.api.android.utils.LocusConst
8 | import locus.api.android.utils.exceptions.RequiredVersionMissingException
9 | import locus.api.objects.geoData.Track
10 |
11 | @Deprecated(message = "Use `SendTrack` or `SendTracks` objects.")
12 | object ActionDisplayTracks {
13 |
14 | // tag for logger
15 | private const val TAG = "ActionDisplayTracks"
16 |
17 | // SEND ONE SINGLE TRACK
18 |
19 | @Throws(RequiredVersionMissingException::class)
20 | fun sendTrack(ctx: Context, track: Track,
21 | extraAction: ActionDisplayVarious.ExtraAction,
22 | startNavigation: Boolean = false): Boolean {
23 | return sendTrack(LocusConst.ACTION_DISPLAY_DATA,
24 | ctx, track, extraAction == ActionDisplayVarious.ExtraAction.IMPORT,
25 | extraAction == ActionDisplayVarious.ExtraAction.CENTER, startNavigation)
26 | }
27 |
28 | @Throws(RequiredVersionMissingException::class)
29 | fun sendTrackSilent(ctx: Context, track: Track, centerOnData: Boolean): Boolean {
30 | return sendTrack(LocusConst.ACTION_DISPLAY_DATA_SILENTLY,
31 | ctx, track, false, centerOnData, false)
32 | }
33 |
34 | @Throws(RequiredVersionMissingException::class)
35 | private fun sendTrack(action: String, ctx: Context, track: Track,
36 | callImport: Boolean, centerOnData: Boolean, startNavigation: Boolean): Boolean {
37 | // prepare mode
38 | val sendMode = when {
39 | callImport -> {
40 | SendMode.Import()
41 | }
42 | action == LocusConst.ACTION_DISPLAY_DATA -> {
43 | SendMode.Basic(centerOnData)
44 | }
45 | action == LocusConst.ACTION_DISPLAY_DATA_SILENTLY -> {
46 | SendMode.Silent()
47 | }
48 | else -> {
49 | return false
50 | }
51 | }
52 |
53 | // send request
54 | return SendTrack(sendMode, track) {
55 | this.startNavigation = startNavigation
56 | }.send(ctx)
57 | }
58 |
59 | // SEND TRACK PACK (MORE THEN ONE)
60 |
61 | @Throws(RequiredVersionMissingException::class)
62 | fun sendTracks(ctx: Context, tracks: List