Compare commits
180 Commits
generate-2
...
pastk-ios-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aea784ddd7 | ||
|
|
52e9ddc038 | ||
|
|
bfffa1fff4 | ||
|
|
9f0290c0ec | ||
|
|
8a8a3c5a08 | ||
|
|
518747d503 | ||
|
|
5063b511ae | ||
|
|
fbe3f72fb1 | ||
|
|
872c0d3e15 | ||
|
|
9833918aac | ||
|
|
0000ec149c | ||
|
|
da3053f5fc | ||
|
|
5a0ff536a7 | ||
|
|
36f123ef25 | ||
|
|
01c2f02c86 | ||
|
|
4d702ec541 | ||
|
|
344cf6d709 | ||
|
|
14b3e8fc8f | ||
|
|
6d0daf6fe7 | ||
|
|
9b3507211f | ||
|
|
a406462549 | ||
|
|
897d7a253d | ||
|
|
b23c2ba3e3 | ||
|
|
705c715356 | ||
|
|
826ddba26f | ||
|
|
2492e8bda4 | ||
|
|
9e494ed8a5 | ||
|
|
1c8ac1f32a | ||
|
|
d0bb8c1c49 | ||
|
|
6c4503b0db | ||
|
|
a39b3a9921 | ||
|
|
8493ed369a | ||
|
|
2ded7e5e2b | ||
|
|
d9335c0b6c | ||
|
|
ebc5370052 | ||
|
|
0a96a23ca0 | ||
|
|
5b05a7ac71 | ||
|
|
31104eed4d | ||
|
|
0f2353aae6 | ||
|
|
d01b8aaab4 | ||
|
|
33f8e20f1b | ||
|
|
76d8396cb1 | ||
|
|
0f744e7cf2 | ||
|
|
5d990bdc19 | ||
|
|
1f2d70c720 | ||
|
|
76ffc99abd | ||
|
|
c9cbb64f12 | ||
|
|
c4722f7025 | ||
|
|
211e3fb4f0 | ||
|
|
ab0c2e70d5 | ||
|
|
3133b88346 | ||
|
|
b1479127e7 | ||
|
|
18c3b8cda5 | ||
|
|
38037c1174 | ||
|
|
593f2fd828 | ||
|
|
066afe4aa8 | ||
|
|
2df3e3557b | ||
|
|
f79e86dff6 | ||
|
|
244af5ea34 | ||
|
|
185ae66101 | ||
|
|
f09b372590 | ||
|
|
de4ec645b6 | ||
|
|
b1710c0fd6 | ||
|
|
be0784e4ad | ||
|
|
78baadfe95 | ||
|
|
2dade5039a | ||
|
|
36ec212671 | ||
|
|
bdbbed6265 | ||
|
|
007aa818ff | ||
|
|
001246fd10 | ||
|
|
76d7ef146c | ||
|
|
ae349462c6 | ||
|
|
972cefb074 | ||
|
|
30718e106e | ||
|
|
82133c5743 | ||
|
|
8fe788c98d | ||
|
|
684784c2b2 | ||
|
|
492eab91fc | ||
|
|
86ebbf6006 | ||
|
|
45e15e2edb | ||
|
|
1e358375c6 | ||
|
|
c3d0689d8a | ||
|
|
607191503c | ||
|
|
7ec05f16e5 | ||
|
|
b41bad5ea4 | ||
|
|
1e22b678e2 | ||
|
|
f88b0afa58 | ||
|
|
d7ece38279 | ||
|
|
722fc5e333 | ||
|
|
f05a9c9eb4 | ||
|
|
07c26a5ab8 | ||
|
|
8f5c8a5bd7 | ||
|
|
04246a55f2 | ||
|
|
b096199695 | ||
|
|
5de22c6de8 | ||
|
|
d7f73f4b9b | ||
|
|
d5ce81b20b | ||
|
|
905a823490 | ||
|
|
b195059fb6 | ||
|
|
460a7fa480 | ||
|
|
e65ab6e458 | ||
|
|
effc8ba5d1 | ||
|
|
014b54b1f7 | ||
|
|
a25ae124d7 | ||
|
|
372a7a90c5 | ||
|
|
9bd6e2cdf2 | ||
|
|
c2cc61e4d9 | ||
|
|
e3fa656f4f | ||
|
|
d7216b7ccc | ||
|
|
aaa61f7f75 | ||
|
|
ccfd2107f3 | ||
|
|
45ec96dd3c | ||
|
|
dd7739a8b2 | ||
|
|
ae0ef4d3f8 | ||
|
|
68d1ead44c | ||
|
|
09de87fd29 | ||
|
|
1a241121c4 | ||
|
|
fdeeb1ae34 | ||
|
|
c2bd2b897a | ||
|
|
e39b5eb507 | ||
|
|
96ef33a401 | ||
|
|
c6dcfc71bf | ||
|
|
053fe3c143 | ||
|
|
c6439aaa82 | ||
|
|
e50a668feb | ||
|
|
5ce753bd5c | ||
|
|
8058183f72 | ||
|
|
07f745411f | ||
|
|
2004c9bfc1 | ||
|
|
1e7715d10f | ||
|
|
e884e32bb6 | ||
|
|
660694aee0 | ||
|
|
99fa3ec551 | ||
|
|
f26db1a79b | ||
|
|
1151f0fb75 | ||
|
|
bbb28107b8 | ||
|
|
9c7b39fd5b | ||
|
|
0d9514bee9 | ||
|
|
a036edc9c5 | ||
|
|
90492e95e6 | ||
|
|
fc199252eb | ||
|
|
327d302aae | ||
|
|
0b8bd42cb0 | ||
|
|
962ee67833 | ||
|
|
69e3fdca90 | ||
|
|
ac8f945455 | ||
|
|
c8a4726500 | ||
|
|
40adb0f860 | ||
|
|
c600a4fd5d | ||
|
|
07420a3f19 | ||
|
|
3920988ef4 | ||
|
|
6136abb33a | ||
|
|
a0e40c98d7 | ||
|
|
3bdaa44c3a | ||
|
|
945c6205a0 | ||
|
|
ef4fd85883 | ||
|
|
83db427c40 | ||
|
|
946fea1e07 | ||
|
|
bd80e9160d | ||
|
|
5333ad3597 | ||
|
|
65b5234396 | ||
|
|
969c805182 | ||
|
|
8b03e99035 | ||
|
|
3aabde338a | ||
|
|
d5d86ffd36 | ||
|
|
d4cef9385b | ||
|
|
9c495ca616 | ||
|
|
a08f3df3e6 | ||
|
|
bb5da20fec | ||
|
|
e112dc2ac4 | ||
|
|
3e2e6cb487 | ||
|
|
21020429cb | ||
|
|
07025ff696 | ||
|
|
c13da0f0a2 | ||
|
|
dd023b65c7 | ||
|
|
0c8648d1e3 | ||
|
|
760e050110 | ||
|
|
db4b46f8ad | ||
|
|
29ebd8b725 | ||
|
|
6b53d1fb91 |
@@ -1,48 +1,61 @@
|
||||
# Configuration file for clang-format, based on docs/CPP_STYLE.md.
|
||||
|
||||
---
|
||||
BasedOnStyle: Google
|
||||
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
|
||||
AlignEscapedNewlines: LeftWithLastLine
|
||||
AlignOperands: AlignAfterOperator
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterExternBlock: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: true
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: true
|
||||
BeforeWhile: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
SplitEmptyRecord: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
BreakBeforeBraces: Custom
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakInheritanceList: BeforeComma
|
||||
ColumnLimit: 120
|
||||
ConstructorInitializerIndentWidth: 2
|
||||
ContinuationIndentWidth: 2
|
||||
ContinuationIndentWidth: 4
|
||||
DerivePointerAlignment: false
|
||||
EmptyLineBeforeAccessModifier: Always
|
||||
IncludeBlocks: Preserve
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseLabels: false
|
||||
IndentExternBlock: NoIndent
|
||||
InsertBraces: false
|
||||
InsertNewlineAtEOF: true
|
||||
PackConstructorInitializers: Never
|
||||
LambdaBodyIndentation: OuterScope
|
||||
PackConstructorInitializers: CurrentLine
|
||||
PointerAlignment: Middle
|
||||
RemoveBracesLLVM: true
|
||||
RemoveSemicolon: true
|
||||
QualifierAlignment: Right
|
||||
SpacesInContainerLiterals: false
|
||||
Standard: Latest
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
||||
|
||||
---
|
||||
Language: Java
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
|
||||
8
.clang-format-ignore
Normal file
@@ -0,0 +1,8 @@
|
||||
# Files that should not be formatted.
|
||||
./3party
|
||||
# A patched copy of the https://registry.khronos.org/OpenGL/api/GLES3/gl3.h
|
||||
./android/sdk/src/main/cpp/app/organicmaps/sdk/opengl/gl3stub.h
|
||||
# Formatting it leads to crashes in runtime. Newer protobuf may fix it.
|
||||
./libs/indexer/drules_struct.pb.cc
|
||||
# No need to format this 3party tool.
|
||||
tools/osmctools/*.c
|
||||
@@ -1,6 +1,5 @@
|
||||
name: 🐞 Bug Report
|
||||
description: Report a problem you've encountered
|
||||
title: "bug: "
|
||||
labels:
|
||||
- bug
|
||||
body:
|
||||
@@ -67,4 +66,4 @@ body:
|
||||
label: Additional context
|
||||
description: Add any other context or comments that may be useful.
|
||||
validations:
|
||||
required: false
|
||||
required: false
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
name: "💡 Feature Request"
|
||||
description: "Suggest an idea or improvement for CoMaps"
|
||||
title: "feat: "
|
||||
labels:
|
||||
- "enhancement"
|
||||
body:
|
||||
@@ -44,4 +43,4 @@ body:
|
||||
label: "Additional context"
|
||||
description: "Any other context, comments, or screenshots to support your request."
|
||||
validations:
|
||||
required: false
|
||||
required: false
|
||||
|
||||
@@ -32,9 +32,6 @@ on:
|
||||
- track_generator/**
|
||||
- xcode/**
|
||||
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
|
||||
|
||||
jobs:
|
||||
android-google-beta:
|
||||
name: Android Google Beta
|
||||
@@ -71,10 +68,6 @@ jobs:
|
||||
SECURE_PROPERTIES: ${{ secrets.SECURE_PROPERTIES }}
|
||||
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Compile
|
||||
shell: bash
|
||||
working-directory: android
|
||||
|
||||
@@ -34,9 +34,6 @@ on:
|
||||
- track_generator/**
|
||||
- xcode/**
|
||||
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Android Lint
|
||||
@@ -51,10 +48,6 @@ jobs:
|
||||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Lint
|
||||
shell: bash
|
||||
working-directory: android
|
||||
@@ -93,10 +86,6 @@ jobs:
|
||||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
|
||||
@@ -4,9 +4,6 @@ on:
|
||||
schedule:
|
||||
- cron: '0 5 * * 0' # Once per week at 05:00 UTC
|
||||
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
|
||||
|
||||
jobs:
|
||||
precondition:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -73,10 +70,6 @@ jobs:
|
||||
SECURE_PROPERTIES: ${{ secrets.SECURE_PROPERTIES }}
|
||||
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Compile
|
||||
shell: bash
|
||||
working-directory: android
|
||||
|
||||
@@ -2,9 +2,6 @@ name: Android Release Metadata
|
||||
on:
|
||||
workflow_dispatch: # Manual trigger
|
||||
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
|
||||
|
||||
jobs:
|
||||
android-release-metadata:
|
||||
name: Upload Google Play metadata
|
||||
|
||||
@@ -5,7 +5,6 @@ on:
|
||||
env:
|
||||
RELEASE_NOTES: android/app/src/google/play/release-notes/en-US/default.txt
|
||||
FDROID_VERSION: android/app/src/fdroid/play/version.yaml
|
||||
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
|
||||
|
||||
jobs:
|
||||
tag:
|
||||
@@ -117,10 +116,6 @@ jobs:
|
||||
SECURE_PROPERTIES: ${{ secrets.SECURE_PROPERTIES }}
|
||||
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Set up SDK
|
||||
shell: bash
|
||||
run: echo "sdk.dir=$ANDROID_SDK_ROOT" > android/local.properties
|
||||
|
||||
@@ -3,20 +3,20 @@ on:
|
||||
workflow_dispatch: # Manual trigger
|
||||
pull_request:
|
||||
paths:
|
||||
- packaging/app.organicmaps.desktop.metainfo.xml
|
||||
- .forgejo/workflows/appstream-check.yaml # Run check on self change
|
||||
- packaging/app.comaps.comaps.metainfo.xml
|
||||
- .forgejo/workflows/appstream-check.yaml # Run check on self change
|
||||
|
||||
jobs:
|
||||
validate-appstream:
|
||||
name: Validate appstream metadata xml
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
sparse-checkout: |
|
||||
packaging/app.organicmaps.desktop.metainfo.xml
|
||||
packaging/app.comaps.comaps.metainfo.xml
|
||||
|
||||
- name: Install appstream validator and flatpak Builder
|
||||
shell: bash
|
||||
@@ -29,8 +29,8 @@ jobs:
|
||||
|
||||
- name: Lint appstream data with flatpak Builder
|
||||
shell: bash
|
||||
run: flatpak run --command=flatpak-builder-lint org.flatpak.Builder appstream packaging/app.organicmaps.desktop.metainfo.xml
|
||||
run: flatpak run --command=flatpak-builder-lint org.flatpak.Builder appstream packaging/app.comaps.comaps.metainfo.xml
|
||||
|
||||
- name: Run appstreamcli in pedantic mode
|
||||
shell: bash
|
||||
run: flatpak run --command=appstreamcli org.flatpak.Builder validate --pedantic packaging/app.organicmaps.desktop.metainfo.xml
|
||||
run: flatpak run --command=appstreamcli org.flatpak.Builder validate --pedantic packaging/app.comaps.comaps.metainfo.xml
|
||||
|
||||
@@ -33,7 +33,7 @@ concurrency:
|
||||
jobs:
|
||||
should-run-check:
|
||||
name: Should run coverage
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
run-from-pr: ${{ steps.run-from-pr.outputs.run-from-pr }}
|
||||
manually-triggered: ${{ steps.manually-triggered.outputs.manually-triggered }}
|
||||
@@ -59,14 +59,9 @@ jobs:
|
||||
coverage:
|
||||
needs: should-run-check
|
||||
name: Generate coverage report
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ needs.should-run-check.outputs.run-from-pr == 'true' || needs.should-run-check.outputs.manually-triggered == 'true'}}
|
||||
steps:
|
||||
- name: Free disk space by removing .NET, Android and Haskell
|
||||
shell: bash
|
||||
run: |
|
||||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -94,10 +89,6 @@ jobs:
|
||||
llvm \
|
||||
gcovr
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
|
||||
@@ -5,4 +5,4 @@ jobs:
|
||||
check:
|
||||
runs-on: codeberg-tiny
|
||||
steps:
|
||||
- uses: https://github.com/KineticCafe/actions-dco@v1
|
||||
- uses: https://github.com/KineticCafe/actions-dco@v1
|
||||
|
||||
@@ -3,20 +3,20 @@ on:
|
||||
workflow_dispatch: # Manual trigger
|
||||
pull_request:
|
||||
paths:
|
||||
- qt/res/app.organicmaps.desktop.desktop
|
||||
- .forgejo/workflows/desktop-file-check.yaml # Run check on self change
|
||||
- qt/res/linux/app.comaps.comaps.desktop
|
||||
- .forgejo/workflows/desktop-file-check.yaml # Run check on self change
|
||||
|
||||
jobs:
|
||||
validate-desktop-file:
|
||||
name: Validate .desktop file
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
sparse-checkout: |
|
||||
qt/res/app.organicmaps.desktop.desktop
|
||||
qt/res/linux/app.comaps.comaps.desktop
|
||||
|
||||
- name: Install desktop-file-validate tool
|
||||
shell: bash
|
||||
@@ -27,4 +27,4 @@ jobs:
|
||||
|
||||
- name: Validate desktop file
|
||||
shell: bash
|
||||
run: desktop-file-validate qt/res/app.organicmaps.desktop.desktop && echo "Successfully validated .desktop file"
|
||||
run: desktop-file-validate qt/res/linux/app.comaps.comaps.desktop && echo "Successfully validated .desktop file"
|
||||
|
||||
@@ -103,4 +103,4 @@ jobs:
|
||||
-destination 'generic/platform=iOS' \
|
||||
-quiet \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
CODE_SIGNING_ALLOWED=NO
|
||||
CODE_SIGNING_ALLOWED=NO
|
||||
|
||||
@@ -31,18 +31,13 @@ on:
|
||||
jobs:
|
||||
linux-no-unity:
|
||||
name: Linux no unity build
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
# Cancels previous jobs if the same branch or PR was updated again.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-no-unity-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
steps:
|
||||
- name: Free disk space by removing .NET, Android and Haskell
|
||||
shell: bash
|
||||
run: |
|
||||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -71,10 +66,6 @@ jobs:
|
||||
libqt6positioning6-plugins \
|
||||
libqt6positioning6
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
@@ -99,7 +90,7 @@ jobs:
|
||||
|
||||
linux-matrix:
|
||||
name: Linux builds and tests
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@@ -111,11 +102,6 @@ jobs:
|
||||
cancel-in-progress: true
|
||||
|
||||
steps:
|
||||
- name: Free disk space by removing .NET, Android and Haskell
|
||||
shell: bash
|
||||
run: |
|
||||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
|
||||
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -142,10 +128,6 @@ jobs:
|
||||
libqt6positioning6-plugins \
|
||||
libqt6positioning6
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
|
||||
@@ -57,10 +57,6 @@ jobs:
|
||||
run: |
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install ninja qt@6
|
||||
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
|
||||
10
.github/workflows/android-check.yaml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
|
||||
env:
|
||||
JAVA_HOME: /usr/lib/jvm/temurin-17-jdk-amd64 # Java 17 is required for Android Gradle 8 plugin
|
||||
SKIP_MAP_DOWNLOAD: true
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
@@ -22,9 +23,9 @@ jobs:
|
||||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Init boost, generate textures
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh --skip-map-download
|
||||
run: SKIP_GENERATE_SYMBOLS=1 ./configure.sh
|
||||
|
||||
- name: Lint
|
||||
shell: bash
|
||||
@@ -65,6 +66,7 @@ jobs:
|
||||
libxinerama-dev \
|
||||
libxcursor-dev \
|
||||
libxi-dev \
|
||||
python3-protobuf \
|
||||
zlib1g-dev
|
||||
|
||||
- name: Checkout sources
|
||||
@@ -76,10 +78,6 @@ jobs:
|
||||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(nproc) * 20))
|
||||
|
||||
- name: Init boost, generate textures
|
||||
shell: bash
|
||||
run: ./configure.sh --skip-map-download
|
||||
|
||||
- name: Configure ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
|
||||
51
.github/workflows/code-style-check.yaml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Code style check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths: # Should stay in sync with tools/unix/clang-format.sh
|
||||
- '.github/workflows/code-style-check.yaml'
|
||||
- 'android/app/src/**.java'
|
||||
- 'android/sdk/src/**.java'
|
||||
- 'android/sdk/src/main/cpp/**.[ch]pp'
|
||||
- 'dev_sandbox/**.[ch]pp'
|
||||
- 'generator/**.[ch]pp'
|
||||
- 'iphone/**.[ch]pp'
|
||||
- 'iphone/**.[hm]'
|
||||
- 'iphone/**.mm'
|
||||
- 'libs/**.[ch]pp'
|
||||
- 'libs/**.[hm]'
|
||||
- '!libs/indexer/drules_struct.pb.h'
|
||||
- 'libs/**.mm'
|
||||
- 'qt/**.[ch]pp'
|
||||
- 'qt/**.h'
|
||||
- 'tools/**.[ch]pp'
|
||||
- '.clang-format'
|
||||
- '.clang-format-ignore'
|
||||
|
||||
jobs:
|
||||
code-style-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
sudo apt purge -y clang-format-18 # Remove default old version of clang-format
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
echo 'deb http://apt.llvm.org/noble/ llvm-toolchain-noble-20 main' | sudo tee /etc/apt/sources.list.d/llvm-toolchain-noble-20.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang-format-20
|
||||
sudo update-alternatives --force --install /usr/bin/clang-format clang-format /usr/bin/clang-format-20 10
|
||||
sudo update-alternatives --force --install /usr/bin/git-clang-format git-clang-format /usr/bin/git-clang-format-20 10
|
||||
clang-format --version
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check code style
|
||||
run: tools/unix/clang-format.sh
|
||||
|
||||
- name: Post clang-format comments
|
||||
if: failure()
|
||||
uses: reviewdog/action-suggester@v1.21.0
|
||||
with:
|
||||
tool_name: clang-format
|
||||
fail_level: error
|
||||
3
.github/workflows/ios-check.yaml
vendored
@@ -30,6 +30,7 @@ jobs:
|
||||
run: |
|
||||
brew install qt \
|
||||
optipng
|
||||
pip3 install "protobuf<3.21" --break-system-packages
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -37,7 +38,7 @@ jobs:
|
||||
shell: bash
|
||||
run: git submodule update --depth 1 --init --recursive --jobs=$(($(sysctl -n hw.logicalcpu) * 20))
|
||||
|
||||
- name: Init boost, download World map, generate textures
|
||||
- name: Configure repository
|
||||
shell: bash
|
||||
run: ./configure.sh
|
||||
|
||||
|
||||
22
.gitignore
vendored
@@ -9,24 +9,29 @@ Makefile.Release
|
||||
object_script.*.Debug
|
||||
object_script.*.Release
|
||||
compile_commands.json
|
||||
*.local.*
|
||||
|
||||
stxxl.errlog
|
||||
stxxl.log
|
||||
screenlog.0
|
||||
|
||||
data/styles/*/*/out/*
|
||||
data/resources-*_design/*
|
||||
data/symbols/*/design/
|
||||
# symbols png/sdf are now generated at build
|
||||
data/resources-*_*/symbols.png
|
||||
data/resources-*_*/symbols.sdf
|
||||
data/drules_proto_default_design.bin
|
||||
data/symbols/**/symbols.png
|
||||
data/symbols/**/symbols.sdf
|
||||
data/colors_design.txt
|
||||
data/patterns_design.txt
|
||||
data/bookmarks
|
||||
data/edits.xml
|
||||
data/World.mwm
|
||||
data/WorldCoasts.mwm
|
||||
data/world_mwm/*
|
||||
data/*_hash
|
||||
data/drules_proto*
|
||||
data/classificator.txt
|
||||
data/types.txt
|
||||
data/visibility.txt
|
||||
data/colors.txt
|
||||
data/patterns.txt
|
||||
|
||||
# Compiled Python
|
||||
*.pyc
|
||||
@@ -45,10 +50,9 @@ omim.sdf
|
||||
*.suo
|
||||
*.aps
|
||||
*.rc
|
||||
!qt/res/windows.rc
|
||||
!qt/res/windows/windows.rc
|
||||
*.pdb
|
||||
out/*
|
||||
qt/mapswithme.log
|
||||
out/
|
||||
|
||||
# XCode
|
||||
xcode/keys/*
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.22.1)
|
||||
|
||||
project(omim C CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
@@ -48,6 +49,8 @@ if (APPLE AND NOT ("${CMAKE_SYSTEM_NAME}" STREQUAL Android))
|
||||
set(CMAKE_OBJCXX_VISIBILITY_PRESET hidden)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND "./configure.sh" WORKING_DIRECTORY ${OMIM_ROOT})
|
||||
|
||||
message(STATUS "Using compiler ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
|
||||
if (CMAKE_UNITY_BUILD)
|
||||
@@ -103,7 +106,7 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
|
||||
elseif (${CMAKE_BUILD_TYPE} MATCHES "Rel")
|
||||
add_definitions(-DRELEASE)
|
||||
if (NOT MSVC)
|
||||
add_compile_options(-Ofast $<$<CXX_COMPILER_ID:GNU>:-flto=auto>) # Also enables -ffast-math
|
||||
add_compile_options(-O3 $<$<CXX_COMPILER_ID:GNU>:-flto=auto>)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown build type: " ${CMAKE_BUILD_TYPE})
|
||||
@@ -182,7 +185,7 @@ if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID)
|
||||
endif()
|
||||
|
||||
# To allow #include "base/file_name.hpp" in all sources.
|
||||
include_directories(${CMAKE_HOME_DIRECTORY})
|
||||
include_directories("${CMAKE_HOME_DIRECTORY}" "${CMAKE_HOME_DIRECTORY}/libs" "${CMAKE_HOME_DIRECTORY}/tools")
|
||||
|
||||
if (USE_PCH)
|
||||
message(STATUS "Precompiled headers are ON")
|
||||
@@ -224,50 +227,23 @@ endif()
|
||||
# Used in qt/ and shaders/
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
|
||||
add_subdirectory(base)
|
||||
add_subdirectory(coding)
|
||||
add_subdirectory(descriptions)
|
||||
add_subdirectory(drape)
|
||||
add_subdirectory(drape_frontend)
|
||||
add_subdirectory(editor)
|
||||
add_subdirectory(ge0)
|
||||
add_subdirectory(generator/mwm_diff)
|
||||
add_subdirectory(geometry)
|
||||
add_subdirectory(indexer)
|
||||
add_subdirectory(kml)
|
||||
add_subdirectory(map)
|
||||
add_subdirectory(cppjansson)
|
||||
add_subdirectory(platform)
|
||||
add_subdirectory(routing)
|
||||
add_subdirectory(routing_common)
|
||||
add_subdirectory(search)
|
||||
add_subdirectory(shaders)
|
||||
add_subdirectory(storage)
|
||||
add_subdirectory(tracking)
|
||||
add_subdirectory(traffic)
|
||||
add_subdirectory(transit)
|
||||
add_subdirectory(libs)
|
||||
|
||||
if (PLATFORM_DESKTOP)
|
||||
omim_add_tool_subdirectory(feature_list)
|
||||
add_subdirectory(dev_sandbox)
|
||||
add_subdirectory(generator)
|
||||
add_subdirectory(openlr)
|
||||
add_subdirectory(poly_borders)
|
||||
omim_add_tool_subdirectory(topography_generator)
|
||||
add_subdirectory(track_analyzing)
|
||||
omim_add_tool_subdirectory(track_generator)
|
||||
add_subdirectory(tools)
|
||||
if (NOT SKIP_QT_GUI)
|
||||
add_subdirectory(qt)
|
||||
omim_add_tool_subdirectory(skin_generator)
|
||||
endif()
|
||||
if (GENERATOR_TOOL)
|
||||
add_compile_options(-march=native -mtune=native)
|
||||
message(STATUS "target CPU optimizations enabled, produced binaries will NOT work on a different CPU")
|
||||
endif()
|
||||
add_subdirectory(dev_sandbox)
|
||||
endif()
|
||||
|
||||
omim_add_test_subdirectory(qt_tstfrm)
|
||||
omim_add_test_subdirectory(libs/qt_tstfrm)
|
||||
|
||||
if (PLATFORM_ANDROID)
|
||||
add_subdirectory(android/app/src/main/cpp)
|
||||
add_subdirectory(android/sdk/src/main/cpp)
|
||||
endif()
|
||||
|
||||
@@ -1 +1 @@
|
||||
See [docs/INSTALL.md](docs/INSTALL.md)
|
||||
See [docs/INSTALL.md](docs/INSTALL.md)
|
||||
|
||||
11
README.md
@@ -53,6 +53,9 @@ A community-led free & open source maps app based on [OpenStreetMap](https://www
|
||||
<a href="https://f-droid.org/en/packages/app.comaps.fdroid/">
|
||||
<img src="docs/badges/fdroid.png" alt="F-Droid" width="160"/>
|
||||
</a>
|
||||
<a href="https://apps.obtainium.imranr.dev/redirect?r=obtainium://add/https://codeberg.org/comaps/comaps">
|
||||
<img src="docs/badges/obtainium.png" alt="Obtainium" width="160"/>
|
||||
</a>
|
||||
<a href="https://codeberg.org/comaps/comaps/releases">
|
||||
<img src="docs/badges/codeberg.png" alt="Codeberg" width="160"/>
|
||||
</a>
|
||||
@@ -122,10 +125,8 @@ You can help by donating, contributing code, translating, or by telling others a
|
||||
|
||||
- Build instructions: [docs/INSTALL.md](docs/INSTALL.md)
|
||||
- Contribution guide: [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md)
|
||||
> [!NOTE]
|
||||
> Some docs might be outdated, contain broken links or old references to Organic Maps, etc. Its a work in progress and help is much appreciated!
|
||||
|
||||
There is a dedicated Zulip chat for active contributors: [Zulip](https://comaps.zulipchat.com)
|
||||
There is a dedicated [Zulip](https://codeberg.org/comaps/Governance/src/branch/main/contribute.md#3-team-messaging) chat for active contributors.
|
||||
|
||||
---
|
||||
|
||||
@@ -139,7 +140,7 @@ There is a dedicated Zulip chat for active contributors: [Zulip](https://comaps.
|
||||
|
||||
## 💸 Funding
|
||||
|
||||
CoMaps is free. To stay that way, it relies on your support.
|
||||
CoMaps is free. To fund development, we rely on your voluntary support ♥️
|
||||
Donate via [OpenCollective](https://opencollective.com/comaps/donate) or [Liberapay](https://liberapay.com/CoMaps).
|
||||
The project's financial information is completely open and transparent at [our Open Collective](https://opencollective.com/comaps).
|
||||
|
||||
@@ -160,4 +161,4 @@ MD5: 9cce0ffea281dc2f0e0a154d6d2e281e
|
||||
## ⚖️ License
|
||||
|
||||
Licensed under the Apache License 2.0.
|
||||
See [LICENSE](LICENSE), [NOTICE](NOTICE), and [data/copyright.html](data/copyright.html).
|
||||
See [LICENSE](LICENSE), [NOTICE](NOTICE), and [data/copyright.html](data/copyright.html).
|
||||
|
||||
@@ -18,5 +18,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libxi-dev \
|
||||
optipng
|
||||
WORKDIR /root/comaps
|
||||
RUN ./configure.sh
|
||||
CMD ./gradlew -Parm64 assembleFdroidDebug
|
||||
|
||||
@@ -19,33 +19,13 @@ apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.github.triplet.play'
|
||||
apply plugin: 'ru.cian.huawei-publish-gradle-plugin'
|
||||
|
||||
def run(cmd) {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
exec {
|
||||
commandLine = cmd
|
||||
standardOutput = stdout
|
||||
}
|
||||
return stdout.toString()
|
||||
}
|
||||
|
||||
|
||||
import com.github.triplet.gradle.androidpublisher.ReleaseStatus
|
||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
|
||||
def getVersion() {
|
||||
def isWindows = DefaultNativePlatform.getCurrentOperatingSystem().isWindows()
|
||||
def bash = isWindows ? 'C:\\Program Files\\Git\\bin\\bash.exe' : 'bash'
|
||||
def versionCode = Integer.parseInt(run([bash, '../../tools/unix/version.sh', 'android_code']).trim())
|
||||
def versionName = run([bash, '../../tools/unix/version.sh', 'android_name']).trim()
|
||||
return new Tuple2(versionCode, versionName)
|
||||
}
|
||||
|
||||
def getCommitMessage() {
|
||||
return run(['git', '--no-pager', 'show', '-s', '--format=%s%n%n%b', 'HEAD']).trim()
|
||||
}
|
||||
|
||||
def osName = System.properties['os.name'].toLowerCase()
|
||||
|
||||
project.ext.appId = 'app.comaps'
|
||||
project.ext.appName = 'CoMaps'
|
||||
|
||||
@@ -57,7 +37,10 @@ project.ext.appName = 'CoMaps'
|
||||
//}
|
||||
|
||||
android {
|
||||
namespace 'app.organicmaps'
|
||||
namespace = 'app.organicmaps'
|
||||
|
||||
// TODO: it should not be here, but in sdk/build.gradle. But for some reason it should be specified here as well.
|
||||
ndkVersion = '28.2.13676358'
|
||||
|
||||
dependenciesInfo {
|
||||
// Disables dependency metadata when building APKs (for IzzyOnDroid/F-Droid)
|
||||
@@ -79,79 +62,23 @@ android {
|
||||
}
|
||||
|
||||
// All properties are read from gradle.properties file
|
||||
compileSdk propCompileSdkVersion.toInteger()
|
||||
|
||||
ndkVersion '28.2.13676358'
|
||||
compileSdk = propCompileSdkVersion.toInteger()
|
||||
|
||||
defaultConfig {
|
||||
// Default package name is taken from the manifest and should be app.comaps
|
||||
def ver = getVersion()
|
||||
versionCode = ver.V1
|
||||
versionName = ver.V2
|
||||
versionCode = rootProject.ext.versionCode
|
||||
versionName = rootProject.ext.versionName
|
||||
println('Version: ' + versionName)
|
||||
println('VersionCode: ' + versionCode)
|
||||
minSdk propMinSdkVersion.toInteger()
|
||||
targetSdk propTargetSdkVersion.toInteger()
|
||||
minSdk = propMinSdkVersion.toInteger()
|
||||
targetSdk = propTargetSdkVersion.toInteger()
|
||||
applicationId project.ext.appId
|
||||
buildConfigField 'String', 'SUPPORT_MAIL', '"android@comaps.app"'
|
||||
// Should be customized in flavors.
|
||||
buildConfigField 'String', 'REVIEW_URL', '""'
|
||||
|
||||
externalNativeBuild {
|
||||
def pchFlag = 'OFF'
|
||||
if (project.hasProperty('pch')) pchFlag = 'ON'
|
||||
base.archivesName = appName.replaceAll('\\s','') + '-' + defaultConfig.versionCode
|
||||
|
||||
def njobs = ''
|
||||
if (project.hasProperty('njobs')) njobs = project.getProperty('njobs')
|
||||
|
||||
def enableVulkanDiagnostics = 'OFF'
|
||||
if (project.hasProperty('enableVulkanDiagnostics')) {
|
||||
enableVulkanDiagnostics = project.getProperty('enableVulkanDiagnostics')
|
||||
}
|
||||
|
||||
def enableTrace = 'OFF'
|
||||
if (project.hasProperty('enableTrace')) {
|
||||
enableTrace = project.getProperty('enableTrace')
|
||||
}
|
||||
|
||||
cmake {
|
||||
cppFlags '-fexceptions', '-frtti'
|
||||
// There is no sense to enable sections without gcc's --gc-sections flag.
|
||||
cFlags '-fno-function-sections', '-fno-data-sections',
|
||||
'-Wno-extern-c-compat'
|
||||
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static',
|
||||
"-DOS=$osName", '-DSKIP_TESTS=ON', '-DSKIP_TOOLS=ON', "-DUSE_PCH=$pchFlag",
|
||||
"-DNJOBS=$njobs", "-DENABLE_VULKAN_DIAGNOSTICS=$enableVulkanDiagnostics",
|
||||
"-DENABLE_TRACE=$enableTrace"
|
||||
targets 'organicmaps'
|
||||
}
|
||||
}
|
||||
|
||||
// Use, for example, -Parm32 gradle parameter to build only for armeabi-v7a.
|
||||
ndk {
|
||||
abiFilters = new HashSet<>()
|
||||
if (project.hasProperty('arm32') || project.hasProperty('armeabi-v7a')) {
|
||||
abiFilters.add('armeabi-v7a')
|
||||
}
|
||||
if (project.hasProperty('arm64') || project.hasProperty('arm64-v8a')) {
|
||||
abiFilters.add('arm64-v8a')
|
||||
}
|
||||
if (project.hasProperty('x86')) {
|
||||
abiFilters.add('x86')
|
||||
}
|
||||
if (project.hasProperty('x86_64') || project.hasProperty('x64')) {
|
||||
abiFilters.add('x86_64')
|
||||
}
|
||||
if (abiFilters.isEmpty()) {
|
||||
abiFilters.add('armeabi-v7a')
|
||||
abiFilters.add('arm64-v8a')
|
||||
// For the emulator, chromebooks and some Intel Atom devices.
|
||||
abiFilters.add('x86_64')
|
||||
}
|
||||
println('Building for ' + abiFilters + ' archs.')
|
||||
}
|
||||
|
||||
setProperty('archivesBaseName', appName.replaceAll('\\s','') + '-' + defaultConfig.versionCode)
|
||||
ndk.debugSymbolLevel = 'full'
|
||||
}
|
||||
|
||||
flavorDimensions += 'default'
|
||||
@@ -201,10 +128,10 @@ android {
|
||||
splits.abi {
|
||||
boolean enabled = project.hasProperty('splitApk')
|
||||
println ('Create separate apks: ' + enabled)
|
||||
enable enabled
|
||||
enable = enabled
|
||||
reset()
|
||||
include 'x86', 'armeabi-v7a', 'arm64-v8a', 'x86_64'
|
||||
universalApk true
|
||||
universalApk = true
|
||||
}
|
||||
|
||||
lint {
|
||||
@@ -217,7 +144,7 @@ android {
|
||||
disable 'CustomSplashScreen'
|
||||
// https://github.com/organicmaps/organicmaps/issues/3610
|
||||
disable 'InsecureBaseConfiguration'
|
||||
abortOnError true
|
||||
abortOnError = true
|
||||
}
|
||||
|
||||
gradle.projectsEvaluated {
|
||||
@@ -276,33 +203,29 @@ android {
|
||||
debug {
|
||||
applicationIdSuffix '.debug' // Allows to install debug and release builds together
|
||||
versionNameSuffix '-debug'
|
||||
jniDebuggable true // Enable jni debug build
|
||||
zipAlignEnabled true
|
||||
signingConfig signingConfigs.debug
|
||||
signingConfig = signingConfigs.debug
|
||||
resValue 'string', 'app_name', 'CoMaps Debug'
|
||||
// Do not generate separate debug symbols for debug apps, because we don't distribute them.
|
||||
ndk.debugSymbolLevel = 'none'
|
||||
}
|
||||
|
||||
release {
|
||||
if (taskName.contains('release')) {
|
||||
if (secureReleasePropertiesFileExists) {
|
||||
println('Using RELEASE signing keys from secure.properties.release')
|
||||
signingConfig signingConfigs.release
|
||||
signingConfig = signingConfigs.release
|
||||
} else {
|
||||
println('NO RELEASE signing keys found')
|
||||
println('Using DEBUG signing keys')
|
||||
signingConfig signingConfigs.debug
|
||||
signingConfig = signingConfigs.debug
|
||||
}
|
||||
}
|
||||
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
shrinkResources = true
|
||||
// Includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
|
||||
// To learn more, go to the documentation section about R8 configuration files.
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
resValue 'string', 'app_name', project.ext.appName
|
||||
// Full size symbols are too big for Google, 217mb aab vs 95mb.
|
||||
ndk.debugSymbolLevel = 'symbol_table'
|
||||
}
|
||||
|
||||
beta {
|
||||
@@ -311,37 +234,27 @@ android {
|
||||
if (taskName.contains('beta')) {
|
||||
if (secureTestPropertiesFileExists) {
|
||||
println('Using TEST signing keys from secure.properties.test')
|
||||
signingConfig signingConfigs.test
|
||||
signingConfig = signingConfigs.test
|
||||
} else {
|
||||
println('NO TEST signing keys found')
|
||||
println('Using DEBUG signing keys')
|
||||
signingConfig signingConfigs.debug
|
||||
signingConfig = signingConfigs.debug
|
||||
}
|
||||
}
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
shrinkResources = true
|
||||
// Includes the default ProGuard rules files that are packaged with the Android Gradle plugin.
|
||||
// To learn more, go to the documentation section about R8 configuration files.
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
matchingFallbacks = ['release'] // use dependencies of "release" build type
|
||||
resValue 'string', 'app_name', 'CoMaps Test'
|
||||
// Full size symbols are too big for Google, 217mb aab vs 95mb.
|
||||
ndk.debugSymbolLevel = 'symbol_table'
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
version '3.22.1+'
|
||||
buildStagingDirectory './nativeOutputs'
|
||||
path '../../CMakeLists.txt'
|
||||
}
|
||||
}
|
||||
|
||||
// We don't compress these extensions in assets/ because our random FileReader can't read zip-compressed files from apk.
|
||||
// TODO: Load all minor files via separate call to ReadAsString which can correctly handle compressed files in zip containers.
|
||||
androidResources {
|
||||
ignoreAssetsPattern '!.svn:!.git:!.DS_Store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||
ignoreAssetsPattern = '!.svn:!.git:!.DS_Store:!*.scc:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||
noCompress = ['txt', 'bin', 'html', 'png', 'json', 'mwm', 'ttf', 'sdf', 'ui', 'config', 'csv', 'spv', 'obj']
|
||||
localeFilters += [
|
||||
"af",
|
||||
@@ -398,7 +311,7 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
coreLibraryDesugaringEnabled true
|
||||
coreLibraryDesugaringEnabled = true
|
||||
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
@@ -453,10 +366,6 @@ dependencies {
|
||||
testImplementation libs.mockito.core
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
def authorityValue = variant.applicationId + ".provider"
|
||||
def authority = "\"" + authorityValue + "\""
|
||||
@@ -504,3 +413,7 @@ huaweiPublish {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 97 KiB |
@@ -0,0 +1 @@
|
||||
সহজ মানচিত্র নেভিগেশন - আপনার যাত্রা সম্পর্কে আরও জানুন - সম্প্রদায় কর্তৃক পরিচালিত
|
||||
1
android/app/src/fdroid/play/listings/bn/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
কোম্যাপস - অফলাইনে হাইকিং, সাইকেলিং এবং ড্রাইভিং করুন গোপনীয়তা সহ
|
||||
@@ -0,0 +1 @@
|
||||
Navegació intuïtiva - Descobreix el teu camí - El poder de la comunitat
|
||||
@@ -0,0 +1,7 @@
|
||||
• Data OpenStreetMap k 4. 8.
|
||||
• vylepšené barvy mapy pro vodu, lesy, křoviny, různé vybavení, pěší zóny atd.
|
||||
• přidány stanice lesní stráže, krytých parkovišť pro jízdní kola, únikových her, úschoven zavazadel, partnerských pošt
|
||||
• vylepšeny výškové vrstevnice na 20 m pro některé oblíbené turistické oblasti
|
||||
• podpora více zkratek a aliasů pro vyhledávání
|
||||
• přidání ikon pro vyhledávání a záložky pro rychlé občerstvení, jízdní kola a dobíjecí stanice
|
||||
• plynulejší pohyb šipky pro určení polohy
|
||||
@@ -1,9 +1,7 @@
|
||||
Wir stellen vor: Das neue CoMaps-Logo!
|
||||
• Verbesserte Höhenlinien in vielen Regionen (Stufen von 20/50 m)
|
||||
• Links zu Panoramax-Bildern für ausgewählte POIs
|
||||
• OpenStreetMap-Daten vom 13. Juli
|
||||
• Neue Farben für viele Objekte und Farben werden früher angezeigt
|
||||
• Öffnungszeiten werden beim Antippen eines POI angezeigt
|
||||
• Verschiedene Arten von Feuchtgebieten
|
||||
• Neue Farben für Vegetation und andere Features; einige neue Icons
|
||||
• Wandern: bessere Darstellung der Höhenlinien
|
||||
• OpenStreetMap-Daten vom 4. August
|
||||
• Verbesserte Farben für Wasser, Wälder, Gestrüpp, verschiedene Einrichtungen, Fussgängerbereiche etc.
|
||||
• Besucherstationen, überdachte Fahrradparkplätze, Escaperooms, Gepäckschließfächer, und Postpartner hinzugefügt
|
||||
• Konturhöhenlinien aktualisiert, bis zu 20m für beliebte Wanderregionen
|
||||
• Unterstützung für mehr Such-Abkürzungen und Synonyme
|
||||
• Such- und Lesezeichen-Symbole für Fast Food, Rad- und Lade-Stationen
|
||||
• Der Positionspfeil bewegt sich gleichmässiger
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
Introducing CoMaps logo!
|
||||
|
||||
• upgrade altitude contour lines for many regions to 20 or 50 meters step
|
||||
• add Panoramax Picture links to selected POIs
|
||||
• OpenStreetMap data as of July 13
|
||||
• add color fills to many features and display fills earlier for existing features
|
||||
• display opening hours state when selecting a POI
|
||||
• split all wetlands into several distinct types
|
||||
• update vegetation and other map colors, update some map icons
|
||||
• outdoors: bolder altitude contour lines
|
||||
• OpenStreetMap data as of August 4
|
||||
• improve map colors for water, forests, scrubs, various amenities, pedestrian areas etc.
|
||||
• add ranger stations, covered bicycle parkings, escape games, luggage lockers, post office partners
|
||||
• upgrade altitude contour lines to 20m step for some popular hiking regions
|
||||
• support more search abbreviations and aliases
|
||||
• add search and bookmark icons for fast food, bicycle and charging stations
|
||||
• more smooth position arrow movements
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
Una aplicación de mapas gratuita y de código abierto liderada por la comunidad, basada en los datos de OpenStreetMap y reforzada con un compromiso con la transparencia, la privacidad y la ausencia de fines de lucro. CoMaps es un fork o derivado de Organic Maps, que a su vez es un fork de Maps.ME.
|
||||
|
||||
<br><br>
|
||||
|
||||
Lee más sobre los motivos del proyecto y su dirección en <b><i>codeberg.org/comaps</i></b>.
|
||||
|
||||
<br><br>
|
||||
|
||||
Únete allí a la comunidad y ayuda a crear la mejor app de mapas
|
||||
|
||||
• Usa la aplicación y corre la voz sobre ella
|
||||
|
||||
• Envía comentarios y reporta problemas
|
||||
|
||||
• Actualiza los datos del mapa en la app o en el sitio web de OpenStreetMap
|
||||
|
||||
<br><br>
|
||||
|
||||
‣ <b>Enfocada en el uso sin conexión</b>: Planifica y navega tus viajes sin necesidad de conexión móvil, busca puntos de paso en rutas remotas, etc. Todas las funciones están diseñadas para funcionar sin conexión.
|
||||
|
||||
‣ <b>Respeta tu Privacidad</b>: La app está diseñada pensando en tu privacidad: no identifica personas, no rastrea y no recoge datos personales. Sin publicidad.
|
||||
|
||||
‣ <b>Sencilla y Pulida</b>: funciones esenciales fáciles de usar que simplemente funcionan.
|
||||
|
||||
‣ <b>Ahorra Batería y Espacio</b>: No consume la batería como otras apps de navegación. Los mapas compactos ahorran espacio valioso en tu teléfono.
|
||||
|
||||
‣ <b>Gratuita y Creada por la Comunidad</b>: Personas como tú ayudaron a construir la app añadiendo lugares a OpenStreetMap, probando funciones, dando opiniones y contribuyendo con desarrollo o financiación.
|
||||
|
||||
‣ <b>Toma de decisiones y finanzas abiertas y transparentes, sin ánimo de lucro y completamente de código abierto.</b>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>Funciones Principales</b>:
|
||||
|
||||
• Mapas detallados descargables con lugares que no aparecen en Google Maps
|
||||
|
||||
• Modo exterior con rutas de senderismo destacadas, campings, fuentes de agua, picos, curvas de nivel, etc.
|
||||
|
||||
• Caminos peatonales y carriles bici
|
||||
|
||||
• Puntos de interés como restaurantes, gasolineras, hoteles, tiendas, lugares turísticos y muchos más
|
||||
|
||||
• Búsqueda por nombre, dirección o categoría de punto de interés
|
||||
|
||||
• Navegación con indicaciones por voz para caminar, ir en bici o conducir
|
||||
|
||||
• Guarda tus lugares favoritos con un solo toque
|
||||
|
||||
• Artículos de Wikipedia sin conexión
|
||||
|
||||
• Capa de transporte subterráneo y rutas
|
||||
|
||||
• Grabación de rutas
|
||||
|
||||
• Exporta e importa favoritos y rutas en formatos KML, KMZ y GPX
|
||||
|
||||
• Modo oscuro para usar de noche
|
||||
|
||||
• Mejora los datos del mapa para todos usando un editor básico integrado
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>La Libertad Está Aquí</b>
|
||||
|
||||
Descubre tu camino, navega el mundo con privacidad y con la comunidad como prioridad.
|
||||
@@ -1,9 +1,7 @@
|
||||
¡Presentamos el logo de CoMaps!
|
||||
• mejora de isolíneas con más detalle para muchas regiones
|
||||
• añade enlaces de imágenes de Panoramax a POIs seleccionados
|
||||
• datos de OpenStreetMap a 13 de julio
|
||||
• añadidos rellenos de color a muchas características
|
||||
• se muestra el estado de horarios de apertura al seleccionar un POI
|
||||
• se dividen los humedales en tipos distintos
|
||||
• se actualiza la vegetación y otros colores del mapa, así como otros iconos
|
||||
• exteriores: líneas de contorno de altitud más gruesas
|
||||
• Datos de OpenStreetMap a fecha 2025.08.04
|
||||
• Mejora de colores del mapa para agua, bosques, matorrales, servicios, zonas peatonales, etc.
|
||||
• Añadidas estaciones de guardabosques, aparcamientos cubiertos de bicis, juegos de escape, consignas y oficinas de correo
|
||||
• Nuevas curvas de nivel (20 m) en regiones populares para senderismo
|
||||
• Más abreviaturas y alias de búsqueda
|
||||
• Iconos de búsqueda y marcadores para comida rápida, bicicletas y estaciones de recarga
|
||||
• Más fluidez de la flecha de posición
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Navegación de mapa fácil - Descubre más en tu camino - Creado por la comunidad
|
||||
1
android/app/src/fdroid/play/listings/es-ES/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps - Senderismo, ciclismo y conducción offline
|
||||
@@ -0,0 +1 @@
|
||||
ناوبری آسان نقشه - کشف بیشتر از سفر شما - توسط جامعه
|
||||
1
android/app/src/fdroid/play/listings/fa-IR/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps - کوه نوردی، دوچرخه سواری و رانندگی افلاین و خصوصی
|
||||
@@ -1,7 +0,0 @@
|
||||
Présentation du logo CoMaps !
|
||||
• Amélioration des courbes d’altitude à une précision de 20 ou 50 mètres pour de nombreuses régions
|
||||
• Ajout d'un lien vers les images Panoramax des POI
|
||||
• Données OpenStreetMap du 13 juillet
|
||||
• Affichage de l’état des heures d’ouverture lors de la sélection d’un POI
|
||||
• Mise à jour du style(végétation et zones humides), mise à jour de certaines icônes de la carte
|
||||
• Outdoors: Améliorations de la visibilité des courbes d'altitude
|
||||
@@ -1 +1 @@
|
||||
Navigation cartographique facile - Découvrez davantage de votre voyage - Propulsé par la communauté
|
||||
Navigation de cartes facile - Découvrez le monde - Propulsé par la communauté
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Könnyű térképes navigáció - Fedezz fel többet az útjaidról - A közösség erejével
|
||||
@@ -0,0 +1 @@
|
||||
Navigation facile del mappa – Discoperi tu viage – Alimentate per le communitate
|
||||
@@ -0,0 +1,7 @@
|
||||
• Dati di OpenStreetMap aggiornati al 4 Agosto
|
||||
• Migliorati i colori per acqua, foreste, servizi etc
|
||||
• Aggiunte le stazioni delle guardie forestali, i parcheggi coperti per bici, gli escape games e altri servizi
|
||||
• Aggiornato l'intervallo delle isolinee a 20 m per le zone escursionistiche più popolari
|
||||
• Aggiunto il supporto per un maggior numero di alias
|
||||
• Aggiunte le icone per i fast food, i punti di ricarica e le biciclette
|
||||
• Resi più fluidi i movimenti della freccia di posizione
|
||||
@@ -1,9 +0,0 @@
|
||||
Wprowadzamy logo CoMaps!
|
||||
• zwiększenie dokładności izolinii w wielu regionach w krokach 20 do 50 metrów
|
||||
• dodanie linków do zdjęć z Panoramax do wybranych POI
|
||||
• aktualizacja danych OpenStreetMap z 13 lipca
|
||||
• dodanie wypełnienia kolorem dla wielu typów obiektów
|
||||
• wyświetlanie stanu godzin otwarcia przy wyborze POI
|
||||
• podział mokradeł na kilka typów
|
||||
• aktualizacja koloru roślinności i innych kolorów, aktualizacja części ikon na mapie
|
||||
• tryb outdoorowy: pogrubione warstwice wysokości
|
||||
@@ -1,9 +1,7 @@
|
||||
Apresentamos o logo do CoMaps!
|
||||
• Curvas de nível mais detalhadas em muitas regiões
|
||||
• Adicionados links de imagens do Panoramax para pontos de interesse selecionados
|
||||
• Dados OSM de 13/07
|
||||
• Adicionados preenchimentos de cor a muitos elementos
|
||||
• Exibição de horário de funcionamento ao selecionar um ponto de interesse
|
||||
• Divididas áreas úmidas em vários tipos distintos
|
||||
• Atualizada cores/ícones para vegetação e outros elementos
|
||||
• Ar livre: curvas de nível de altitude mais destacadas
|
||||
• Dados OSM de 4/08
|
||||
• Melhoria nas cores para água, florestas, matagais, serviços, áreas de pedestres, etc.
|
||||
• Adição de guarda-florestais, estacionamentos cobertos para bicicletas, jogos de fuga, armários para bagagem e parceiros postais
|
||||
• Melhoria na precisão de curvas de nível para 20 m em algumas regiões populares
|
||||
• Suporte a mais abreviações para busca
|
||||
• Adição de ícones de pesquisa e favoritos para fast food, bicicletas e estações de recarga
|
||||
• Movimentos mais suaves para seta de posição
|
||||
|
||||
@@ -1 +1 @@
|
||||
CoMaps - Mapas com Privacidade
|
||||
CoMaps - Mapas e Navegação Offline com Privacidade
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Navegação fácil nos mapas - Descubra mais sobre o seu percurso - Feito por todos
|
||||
1
android/app/src/fdroid/play/listings/pt-PT/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps - Mapas e Navegação - Offline e Privada
|
||||
@@ -1,9 +1,7 @@
|
||||
Представляем логотип CoMaps!
|
||||
• Линии высот для многих регионов с шагом 20м или 50м
|
||||
• Ссылки на изображения Panoramax к выбранным POI
|
||||
• Карты OpenStreetMap от 13 июля
|
||||
• Заливки цветом ко многим объектам и более ранняя заливка для существующих объектов
|
||||
• Показ часов работы при выборе POI
|
||||
• Разные водно-болотные угодья отличаются цветом
|
||||
• Обновлены цвета растительности и другие цвета на карте, изменены некоторые иконки
|
||||
• В стиле "Активный отдых" более четкие линии высот
|
||||
• Карты OpenStreetMap от 4 августа
|
||||
• Улучшен цвет воды, леса, кустарников, различных объектов инфраструктуры, пешеходных зон и т.д.
|
||||
• Добавлены лесничества, крытые велопарковки, квесты, камеры хранения
|
||||
• Для некоторых популярных туристических регионов добавлены линии высот 20м
|
||||
• Поддержка дополнительных поисковых сокращений и синонимов
|
||||
• Добавлены иконки меток и результатов поиска для фастфуда, велопарковок и зарядных станций
|
||||
• Более плавное движение стрелки местоположения
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
Представљамо CoMaps лого!
|
||||
• ажуриране изохипсе за многе регионе на кораке од 20 или 50 метара
|
||||
• додате везе ка Panoramax сликама за изабране тачке интересовања (POI)
|
||||
• подаци са OpenStreetMap-а од 13. јула
|
||||
• додате боје за многе елементе и раније приказивање постојећих површина
|
||||
• приказ стања радног времена при избору POI-ја
|
||||
• мочваре подељене на неколико различитих типова
|
||||
• ажуриране боје вегетације и других елемената на мапи, ажуриране поједине иконе
|
||||
• на отвореном: наглашеније изохипсе
|
||||
• подаци из OpenStreetMap-а од 4. августа
|
||||
• побољшане боје на мапи за воду, шуме, жбуње, разне објекте, пешачке зоне итд.
|
||||
• додате станице ренџера, наткривена паркинг места за бицикле, escape room-ови, ормарићи за пртљаг
|
||||
• унапређене изохипсе на кораке од 20 м за популарне планинарске регионе
|
||||
• подршка за више скраћеница и алтернативних назива у претрази
|
||||
• додате иконе за претрагу и обележавање за брзу храну, бицикле и станице за пуњење
|
||||
• равномерније кретање стрелице која приказује позицију
|
||||
@@ -8,10 +8,10 @@ import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresPermission;
|
||||
|
||||
import app.organicmaps.sdk.util.LocationUtils;
|
||||
import app.organicmaps.sdk.util.log.Logger;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.android.gms.common.api.ResolvableApiException;
|
||||
import com.google.android.gms.location.FusedLocationProviderClient;
|
||||
@@ -26,9 +26,6 @@ import com.google.android.gms.location.LocationSettingsStatusCodes;
|
||||
import com.google.android.gms.location.Priority;
|
||||
import com.google.android.gms.location.SettingsClient;
|
||||
|
||||
import app.organicmaps.sdk.util.LocationUtils;
|
||||
import app.organicmaps.sdk.util.log.Logger;
|
||||
|
||||
class GoogleFusedLocationProvider extends BaseLocationProvider
|
||||
{
|
||||
private static final String TAG = GoogleFusedLocationProvider.class.getSimpleName();
|
||||
@@ -72,71 +69,75 @@ class GoogleFusedLocationProvider extends BaseLocationProvider
|
||||
{
|
||||
Logger.d(TAG);
|
||||
|
||||
final LocationRequest locationRequest = new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, interval)
|
||||
// Wait a few seconds for accurate locations initially, when accurate locations could not be computed on the device immediately.
|
||||
// https://github.com/organicmaps/organicmaps/issues/2149
|
||||
.setWaitForAccurateLocation(true)
|
||||
// The desired location granularity should correspond to the client permission level. The client will be
|
||||
// delivered fine locations while it has the Manifest.permission.ACCESS_FINE_LOCATION permission, coarse
|
||||
// locations while it has only the Manifest.permission.ACCESS_COARSE_LOCATION permission, and no location
|
||||
// if it lacks either.
|
||||
.setGranularity(Granularity.GRANULARITY_PERMISSION_LEVEL)
|
||||
// Sets the maximum age of an initial historical location delivered for this request.
|
||||
.setMaxUpdateAgeMillis(60 * 60 * 1000L) // 1 hour
|
||||
.build();
|
||||
final LocationRequest locationRequest =
|
||||
new LocationRequest
|
||||
.Builder(Priority.PRIORITY_HIGH_ACCURACY, interval)
|
||||
// Wait a few seconds for accurate locations initially, when accurate locations could not be computed on the
|
||||
// device immediately. https://github.com/organicmaps/organicmaps/issues/2149
|
||||
.setWaitForAccurateLocation(true)
|
||||
// The desired location granularity should correspond to the client permission level. The client will be
|
||||
// delivered fine locations while it has the Manifest.permission.ACCESS_FINE_LOCATION permission, coarse
|
||||
// locations while it has only the Manifest.permission.ACCESS_COARSE_LOCATION permission, and no location
|
||||
// if it lacks either.
|
||||
.setGranularity(Granularity.GRANULARITY_PERMISSION_LEVEL)
|
||||
// Sets the maximum age of an initial historical location delivered for this request.
|
||||
.setMaxUpdateAgeMillis(60 * 60 * 1000L) // 1 hour
|
||||
.build();
|
||||
|
||||
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder();
|
||||
builder.addLocationRequest(locationRequest);
|
||||
builder.setAlwaysShow(true); // improves the wording/appearance of the dialog
|
||||
final LocationSettingsRequest locationSettingsRequest = builder.build();
|
||||
|
||||
mSettingsClient.checkLocationSettings(locationSettingsRequest).addOnSuccessListener(locationSettingsResponse -> {
|
||||
Logger.d(TAG, "Service is available");
|
||||
mFusedLocationClient.requestLocationUpdates(locationRequest, mCallback, Looper.myLooper());
|
||||
}).addOnFailureListener(e -> {
|
||||
try
|
||||
{
|
||||
int statusCode = ((ApiException) e).getStatusCode();
|
||||
if (statusCode == LocationSettingsStatusCodes.RESOLUTION_REQUIRED)
|
||||
{
|
||||
// This case happens if at least one of the following system settings is off:
|
||||
// 1. Location Services a.k.a GPS;
|
||||
// 2. Google Location Accuracy a.k.a High Accuracy;
|
||||
// 3. Both Wi-Fi && Mobile Data together (needed for 2).
|
||||
//
|
||||
// PendingIntent below will show a special Google "For better experience... enable (1) and/or (2) and/or (3)"
|
||||
// dialog. This system dialog can change system settings if "Yes" is pressed. We can't do it from our app.
|
||||
// However, we don't want to annoy a user who disabled (2) or (3) intentionally. GPS (1) is mandatory to
|
||||
// continue, while (2) and (3) are not dealbreakers here.
|
||||
//
|
||||
// See https://github.com/organicmaps/organicmaps/issues/3846
|
||||
//
|
||||
if (LocationUtils.areLocationServicesTurnedOn(mContext))
|
||||
mSettingsClient.checkLocationSettings(locationSettingsRequest)
|
||||
.addOnSuccessListener(locationSettingsResponse -> {
|
||||
Logger.d(TAG, "Service is available");
|
||||
mFusedLocationClient.requestLocationUpdates(locationRequest, mCallback, Looper.myLooper());
|
||||
})
|
||||
.addOnFailureListener(e -> {
|
||||
try
|
||||
{
|
||||
Logger.d(TAG, "Don't show 'location resolution' dialog because location services are already on");
|
||||
mFusedLocationClient.requestLocationUpdates(locationRequest, mCallback, Looper.myLooper());
|
||||
return;
|
||||
int statusCode = ((ApiException) e).getStatusCode();
|
||||
if (statusCode == LocationSettingsStatusCodes.RESOLUTION_REQUIRED)
|
||||
{
|
||||
// This case happens if at least one of the following system settings is off:
|
||||
// 1. Location Services a.k.a GPS;
|
||||
// 2. Google Location Accuracy a.k.a High Accuracy;
|
||||
// 3. Both Wi-Fi && Mobile Data together (needed for 2).
|
||||
//
|
||||
// PendingIntent below will show a special Google "For better experience... enable (1) and/or (2) and/or
|
||||
// (3)" dialog. This system dialog can change system settings if "Yes" is pressed. We can't do it from our
|
||||
// app. However, we don't want to annoy a user who disabled (2) or (3) intentionally. GPS (1) is mandatory
|
||||
// to continue, while (2) and (3) are not dealbreakers here.
|
||||
//
|
||||
// See https://github.com/organicmaps/organicmaps/issues/3846
|
||||
//
|
||||
if (LocationUtils.areLocationServicesTurnedOn(mContext))
|
||||
{
|
||||
Logger.d(TAG, "Don't show 'location resolution' dialog because location services are already on");
|
||||
mFusedLocationClient.requestLocationUpdates(locationRequest, mCallback, Looper.myLooper());
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "Requesting 'location resolution' dialog");
|
||||
final ResolvableApiException resolvable = (ResolvableApiException) e;
|
||||
final PendingIntent pendingIntent = resolvable.getResolution();
|
||||
// Call this callback in the next event loop to allow LocationHelper::start() to finish.
|
||||
runLater(() -> mListener.onLocationResolutionRequired(pendingIntent));
|
||||
return;
|
||||
}
|
||||
}
|
||||
Logger.d(TAG, "Requesting 'location resolution' dialog");
|
||||
final ResolvableApiException resolvable = (ResolvableApiException) e;
|
||||
final PendingIntent pendingIntent = resolvable.getResolution();
|
||||
catch (ClassCastException ex)
|
||||
{
|
||||
// Ignore, should be an impossible error.
|
||||
// https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient
|
||||
Logger.e(TAG, "An error that should be impossible: " + ex);
|
||||
}
|
||||
// Location settings are not satisfied. However, we have no way to fix the
|
||||
// settings so we won't show the dialog.
|
||||
Logger.e(TAG, "Service is not available: " + e);
|
||||
// Call this callback in the next event loop to allow LocationHelper::start() to finish.
|
||||
runLater(() -> mListener.onLocationResolutionRequired(pendingIntent));
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (ClassCastException ex)
|
||||
{
|
||||
// Ignore, should be an impossible error.
|
||||
// https://developers.google.com/android/reference/com/google/android/gms/location/SettingsClient
|
||||
Logger.e(TAG, "An error that should be impossible: " + ex);
|
||||
}
|
||||
// Location settings are not satisfied. However, we have no way to fix the
|
||||
// settings so we won't show the dialog.
|
||||
Logger.e(TAG, "Service is not available: " + e);
|
||||
// Call this callback in the next event loop to allow LocationHelper::start() to finish.
|
||||
runLater(mListener::onFusedLocationUnsupported);
|
||||
});
|
||||
runLater(mListener::onFusedLocationUnsupported);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package app.organicmaps.sdk.location;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GoogleApiAvailability;
|
||||
|
||||
import app.organicmaps.sdk.util.Config;
|
||||
import app.organicmaps.sdk.util.log.Logger;
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.GoogleApiAvailability;
|
||||
|
||||
public class LocationProviderFactory
|
||||
{
|
||||
@@ -18,7 +16,8 @@ public class LocationProviderFactory
|
||||
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS;
|
||||
}
|
||||
|
||||
public static BaseLocationProvider getProvider(@NonNull Context context, @NonNull BaseLocationProvider.Listener listener)
|
||||
public static BaseLocationProvider getProvider(@NonNull Context context,
|
||||
@NonNull BaseLocationProvider.Listener listener)
|
||||
{
|
||||
if (isGoogleLocationAvailable(context) && Config.useGoogleServices())
|
||||
{
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
সহজ মানচিত্র নেভিগেশন - আপনার যাত্রা সম্পর্কে আরও জানুন - সম্প্রদায় কর্তৃক পরিচালিত
|
||||
1
android/app/src/google/play/listings/bn/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps - গোপনীয়তা সহ যাতায়াত
|
||||
36
android/app/src/google/play/listings/ca/full-description.txt
Normal file
@@ -0,0 +1,36 @@
|
||||
CoMaps és una aplicació de mapes lliure i de codi obert a càrrec de la comunitat que es basa en les dades OpenStreetMap i es fonamenta en el compromís amb la transparència i la privadesa sense ànim de lucre.
|
||||
|
||||
Uneix-te a la comunitat i ajuda a crear la millor aplicació de mapes.
|
||||
• Fes servir l'aplicació i recomana-la.
|
||||
• Dona la teva opinió i comunica qualsevol problema.
|
||||
• Actualitza les dades de mapes a l'aplicació o al web d'OpenStreetMap.
|
||||
|
||||
<i>Els teus comentaris i les valoracions de 5 estrelles són el que més ens ajuda.</i>
|
||||
|
||||
‣ <b>Disseny senzill i polit</b>: funcions bàsiques i fàcils de fer servir que funcionen i punt.
|
||||
‣ <b>Centrada en l'ús sense connexió</b>: planifica viatges a l'estranger i navega sense haver d'accedir a les dades mòbils o cerca punts d'interès durant rutes d'excursionisme llargues. Totes les funcions de l'aplicació s'han dissenyat perquè funcionin sense connexió.
|
||||
‣ <b>Respecte per la privadesa</b>: el disseny de l'aplicació prioritza la privadesa. No t'identifica, no fa cap seguiment i no recull dades personals. A més, no té anuncis.
|
||||
‣ <b>Ús eficient de la bateria i l'espai</b>: consumeix menys bateria que altres aplicacions de navegació. Els mapes compactes ocupen molt poc espai al telèfon.
|
||||
‣ <b>Lliure gràcies a la comunitat</b>: aquesta aplicació s'ha desenvolupat gràcies a persones com tu que han afegit llocs a OpenStreetMap, han provat funcions, n'han aportat comentaris i hi han contribuït amb diners i esforç.
|
||||
‣ <b>És un projecte obert i transparent en les seves decisions i finances. No té cap ànim de lucre i és completament de codi obert.</b>
|
||||
|
||||
<b>Funcions principals</b>:
|
||||
• Mapes detallats que es poden baixar i inclouen llocs que no apareixen a Google Maps
|
||||
• Mode exterior en què es ressalten les rutes d'excursionisme, els llocs d'acampada, les fonts d'aigua, els pics i les línies de contorn, entre altres coses
|
||||
• Zones per a vianants i carrils bici
|
||||
• Punts d'interès, com ara restaurants, benzineres, hotels, botigues, atraccions turístiques i molt més
|
||||
• Cerques per nom, adreça o categoria de punt d'interès
|
||||
• Navegació amb indicacions per veu mentre camines, vas amb bicicleta o condueixes
|
||||
• Adreces d'interès perquè desis els teus llocs preferits amb un toc
|
||||
• Articles de Wikipedia sense connexió
|
||||
• Capa de línies de metro amb direccions
|
||||
• Enregistrament d'itineraris
|
||||
• Exportació i importació d'adreces d'interès i itineraris en els formats KML, KMZ i GPX
|
||||
• Mode fosc per fer servir l'aplicació a la nit
|
||||
• Millora de les dades de mapes per a tothom amb un editor integrat bàsic
|
||||
• Compatibilitat amb Android Auto
|
||||
|
||||
Pots informar de problemes a l'aplicació, suggerir idees i unir-te a la comunitat al web <b><i>comaps.app</i></b>.
|
||||
|
||||
<b>La llibertat ha arribat</b>
|
||||
Descobreix el teu camí i explora el món amb la privadesa i la comunitat com a eix central!
|
||||
@@ -0,0 +1 @@
|
||||
Navegació intuïtiva - Descobreix el teu camí - El poder de la comunitat
|
||||
1
android/app/src/google/play/listings/ca/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps – Navega amb privadesa
|
||||
@@ -0,0 +1,71 @@
|
||||
Una aplicación de mapas gratuita y de código abierto liderada por la comunidad, basada en los datos de OpenStreetMap y reforzada con un compromiso con la transparencia, la privacidad y la ausencia de fines de lucro.
|
||||
|
||||
<br><br>
|
||||
|
||||
Únete a la comunidad y ayuda a crear la mejor app de mapas
|
||||
|
||||
• Usa la aplicación y corre la voz sobre ella
|
||||
|
||||
• Envía comentarios y reporta problemas
|
||||
|
||||
• Actualiza los datos del mapa en la app o en el sitio web de OpenStreetMap
|
||||
|
||||
<br><br>
|
||||
|
||||
<i>¡Tus comentarios y valoraciones de 5 estrellas son el mejor apoyo para nosotros!</i>
|
||||
|
||||
<br><br>
|
||||
|
||||
‣ <b>Sencilla y Pulida</b>: funciones esenciales fáciles de usar que simplemente funcionan.
|
||||
|
||||
‣ <b>Enfocada en el uso sin conexión</b>: Planifica y navega tus viajes sin necesidad de conexión móvil, busca puntos de paso en rutas remotas, etc. Todas las funciones están diseñadas para funcionar sin conexión.
|
||||
|
||||
‣ <b>Respeta tu Privacidad</b>: La app está diseñada pensando en tu privacidad: no identifica personas, no rastrea y no recoge datos personales. Sin publicidad.
|
||||
|
||||
‣ <b>Ahorra Batería y Espacio</b>: No consume la batería como otras apps de navegación. Los mapas compactos ahorran espacio valioso en tu teléfono.
|
||||
|
||||
‣ <b>Gratuita y Creada por la Comunidad</b>: Personas como tú ayudaron a construir la app añadiendo lugares a OpenStreetMap, probando funciones, dando opiniones y contribuyendo con desarrollo o financiación.
|
||||
|
||||
‣ <b>Toma de decisiones y finanzas abiertas y transparentes, sin ánimo de lucro y completamente de código abierto.</b>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>Funciones Principales</b>:
|
||||
|
||||
• Mapas detallados descargables con lugares que no aparecen en Google Maps
|
||||
|
||||
• Modo exterior con rutas de senderismo destacadas, campings, fuentes de agua, picos, curvas de nivel, etc.
|
||||
|
||||
• Caminos peatonales y carriles bici
|
||||
|
||||
• Puntos de interés como restaurantes, gasolineras, hoteles, tiendas, lugares turísticos y muchos más
|
||||
|
||||
• Búsqueda por nombre, dirección o categoría de punto de interés
|
||||
|
||||
• Navegación con indicaciones por voz para caminar, ir en bici o conducir
|
||||
|
||||
• Guarda tus lugares favoritos con un solo toque
|
||||
|
||||
• Artículos de Wikipedia sin conexión
|
||||
|
||||
• Capa de transporte subterráneo y rutas
|
||||
|
||||
• Grabación de rutas
|
||||
|
||||
• Exporta e importa favoritos y rutas en formatos KML, KMZ y GPX
|
||||
|
||||
• Modo oscuro para usar de noche
|
||||
|
||||
• Mejora los datos del mapa para todos usando un editor básico integrado
|
||||
|
||||
• Compatibilidad con Android Auto
|
||||
|
||||
<br><br>
|
||||
|
||||
Por favor, informa de errores, sugiere ideas y únete a nuestra comunidad en el sitio web <b><i>comaps.app</i></b>.
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>La Libertad Está Aquí</b>
|
||||
|
||||
Descubre tu camino, navega el mundo con privacidad y con la comunidad como prioridad.
|
||||
@@ -0,0 +1 @@
|
||||
Navegación de mapa fácil - Descubre más en tu camino - Creado por la comunidad
|
||||
1
android/app/src/google/play/listings/es-ES/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps - Navega con Privacidad
|
||||
@@ -1 +1 @@
|
||||
Navigation cartographique facile - Découvrez davantage de votre voyage - Propulsé par la communauté
|
||||
Navigation cartographique facile - Vivez de grands voyages - Propulsé par la communauté
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Könnyű térképes navigáció - Fedezz fel többet az útjaidról - A közösség erejével
|
||||
1
android/app/src/google/play/listings/hu-HU/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps - Az adatvédő navigáció
|
||||
@@ -0,0 +1 @@
|
||||
Navigation facile del mappa – Discoperi tu viage – Alimentate per le communitate
|
||||
1
android/app/src/google/play/listings/ia/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps – Naviga private
|
||||
1
android/app/src/google/play/listings/ml-IN/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
കോമാപ്പ്സ് - സ്വകാര്യതയോടെ സഞ്ചരിക്കൂ
|
||||
1
android/app/src/google/play/listings/pl-PL/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
CoMaps - Nawigacja szanująca prywatność
|
||||
@@ -1 +1 @@
|
||||
CoMaps - Navegue privadamente
|
||||
CoMaps - Navegue Privadamente
|
||||
|
||||
@@ -1 +1 @@
|
||||
CoMaps - Оффлайн навигация
|
||||
CoMaps - Приватная навигация
|
||||
|
||||
@@ -7,12 +7,12 @@ Topluluğa katılın ve en iyi harita uygulamasını oluşturmamıza yardım edi
|
||||
|
||||
<i>Geri bildirimleriniz ve 5 yıldızlı yorumlarınız bizim için en iyi destektir!</i>
|
||||
|
||||
‣ <b>Basit ve Temiz</b>: Sadece temel, kullanımı basit, işe yarayan özellikler.
|
||||
‣ <b>Çevrimdışı Odaklı</b>: Mobil veriye ihtiyaç duymadan yurt dışı seyahatinizi planlayın ve gezin, uzun bir yürüyüş sırasında rotanızdaki noktaları bulun ve daha fazlası . Tüm özellikler çevrimdışı çalışmak üzere tasarlanmıştır.
|
||||
‣ <b>Basit ve Temiz</b>: Sadece temel, kullanımı basit ve işe yarayan özellikler.
|
||||
‣ <b>Çevrimdışı Odaklı</b>: Mobil veriye ihtiyaç duymadan yurt dışı seyahatinizi planlayın ve gezin, uzun bir yürüyüş sırasında rotanızdaki noktaları bulun ve daha fazlası. Tüm özellikler çevrimdışı çalışmak üzere tasarlanmıştır.
|
||||
‣ <b>Gizliliğe Saygılı</b>: Uygulama gizliliğe saygılı olarak tasarlanmıştır. Kullanıcı profilinizi çıkarmaz, sizi takip etmez ve kişisel bilgi toplamaz. Üstelik tamamen reklamsızdır.
|
||||
‣ <b>Pil ve Depolamanızdan Tasarruf Eder</b>: Diğer navigasyon uygulamaları gibi pilinizi sömürmez. Compact maps değerli depolama alanınızdan tasarruf eder.
|
||||
‣ <b>Ücretsizdir ve Gücünü Topluluktan Alır</b>: Sizin gibi insanlar OpenStreetMap'e yer ekleyerek, yeni özellikleri test ederek, geri bildirimde bulunarak, program geliştirme becerileri ve bağışlarla katkıda bulunarak uygulamanın oluşturulmasına yardımcı oldu.
|
||||
‣ <b>Açık ve Şeffaf Şekilde Yürütülen Karar Alma ve Fonlama Süreçleri, Kâr Amacı Gütmez ve Tamamen Açık Kaynaklı.</b>
|
||||
‣ <b>Pil ve Depolamanızdan Tasarruf Eder</b>: Diğer navigasyon uygulamaları gibi pilinizi sömürmez. Kompakt harita dosyaları, değerli depolama alanınızdan tasarruf eder.
|
||||
‣ <b>Ücretsizdir ve Gücünü Topluluktan Alır</b>: Sizin gibi insanlar OpenStreetMap'e yer ekleyerek, yeni özellikleri test ederek, geri bildirimde bulunarak, program geliştirme becerileri ve bağışlarla katkıda bulunarak bu uygulamanın oluşturulmasına yardımcı oldular.
|
||||
‣ <b>Açık ve Şeffaf Bir Şekilde Yürütülen Karar Alma ve Fonlama Süreçlerine Sahip, Kâr Amacı Gütmeyen ve Tamamen Açık Kaynaklı Bir Uygulama.</b>
|
||||
|
||||
<b>Ana Özellikler</b>:
|
||||
• Google Haritalar'da bulunmayan yerleri içeren, çevrimdışı detaylı haritalar
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<!-- Requiring "android.hardware.touchscreen" here breaks DeX mode -->
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
android:glEsVersion="0x00030000"
|
||||
android:required="true"/>
|
||||
<uses-feature
|
||||
android:name="android.hardware.wifi"
|
||||
@@ -75,6 +75,7 @@
|
||||
android:backupInForeground="true"
|
||||
android:fullBackupContent="@xml/backup_content"
|
||||
android:dataExtractionRules="@xml/backup_content_v31"
|
||||
android:enableOnBackInvokedCallback="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:localeConfig="@xml/locales_config"
|
||||
@@ -376,6 +377,7 @@
|
||||
|
||||
<activity
|
||||
android:name="app.organicmaps.downloader.DownloaderActivity"
|
||||
android:enableOnBackInvokedCallback="true"
|
||||
android:configChanges="orientation|screenLayout|screenSize"
|
||||
android:screenOrientation="fullUser"
|
||||
android:label="@string/download_maps"
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
#include "Framework.hpp"
|
||||
|
||||
#include "defines.hpp"
|
||||
|
||||
#include "storage/downloader.hpp"
|
||||
#include "storage/storage.hpp"
|
||||
|
||||
#include "platform/downloader_defines.hpp"
|
||||
#include "platform/http_request.hpp"
|
||||
#include "platform/platform.hpp"
|
||||
|
||||
#include "coding/internal/file_data.hpp"
|
||||
#include "coding/reader_streambuf.hpp"
|
||||
|
||||
#include "base/file_name_utils.hpp"
|
||||
#include "base/logging.hpp"
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
#include "app/organicmaps/sdk/core/jni_helper.hpp"
|
||||
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace downloader;
|
||||
using namespace storage;
|
||||
|
||||
using namespace std::placeholders;
|
||||
|
||||
/// Special error codes to notify GUI about free space
|
||||
//@{
|
||||
#define ERR_DOWNLOAD_SUCCESS 0
|
||||
#define ERR_DISK_ERROR -1
|
||||
#define ERR_NOT_ENOUGH_FREE_SPACE -2
|
||||
#define ERR_STORAGE_DISCONNECTED -3
|
||||
#define ERR_DOWNLOAD_ERROR -4
|
||||
#define ERR_NO_MORE_FILES -5
|
||||
#define ERR_FILE_IN_PROGRESS -6
|
||||
//@}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
static std::vector<platform::CountryFile> g_filesToDownload;
|
||||
static int g_totalDownloadedBytes;
|
||||
static int g_totalBytesToDownload;
|
||||
static std::shared_ptr<HttpRequest> g_currentRequest;
|
||||
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
{
|
||||
using Callback = HttpRequest::Callback;
|
||||
|
||||
static int HasSpaceForFiles(Platform & pl, std::string const & sdcardPath, size_t fileSize)
|
||||
{
|
||||
switch (pl.GetWritableStorageStatus(fileSize))
|
||||
{
|
||||
case Platform::STORAGE_DISCONNECTED:
|
||||
return ERR_STORAGE_DISCONNECTED;
|
||||
|
||||
case Platform::NOT_ENOUGH_SPACE:
|
||||
return ERR_NOT_ENOUGH_FREE_SPACE;
|
||||
|
||||
default:
|
||||
return static_cast<int>(fileSize);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_app_organicmaps_sdk_DownloadResourcesLegacyActivity_nativeGetBytesToDownload(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
// clear all
|
||||
g_filesToDownload.clear();
|
||||
g_totalBytesToDownload = 0;
|
||||
g_totalDownloadedBytes = 0;
|
||||
|
||||
using namespace storage;
|
||||
Storage const & storage = g_framework->GetStorage();
|
||||
auto const status = storage.GetForceDownloadWorlds(g_filesToDownload);
|
||||
|
||||
for (auto const & cf : g_filesToDownload)
|
||||
g_totalBytesToDownload += cf.GetRemoteSize();
|
||||
|
||||
int res;
|
||||
if (status == Storage::WorldStatus::ERROR_CREATE_FOLDER ||
|
||||
status == Storage::WorldStatus::ERROR_MOVE_FILE)
|
||||
{
|
||||
res = ERR_DISK_ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
Platform & pl = GetPlatform();
|
||||
res = HasSpaceForFiles(pl, pl.WritableDir(), g_totalBytesToDownload);
|
||||
}
|
||||
|
||||
if (res == ERR_STORAGE_DISCONNECTED)
|
||||
LOG(LWARNING, ("External file system is not available"));
|
||||
else if (res == ERR_NOT_ENOUGH_FREE_SPACE)
|
||||
LOG(LWARNING, ("Not enough space to extract files"));
|
||||
|
||||
g_currentRequest.reset();
|
||||
|
||||
if (status == Storage::WorldStatus::WAS_MOVED)
|
||||
{
|
||||
g_framework->ReloadWorldMaps();
|
||||
res = ERR_DOWNLOAD_SUCCESS; // reset possible storage error if we moved files
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void DownloadFileFinished(std::shared_ptr<jobject> obj, HttpRequest const & req)
|
||||
{
|
||||
auto const status = req.GetStatus();
|
||||
ASSERT_NOT_EQUAL(status, DownloadStatus::InProgress, ());
|
||||
|
||||
int errorCode = ERR_DOWNLOAD_ERROR;
|
||||
if (status == DownloadStatus::Completed)
|
||||
errorCode = ERR_DOWNLOAD_SUCCESS;
|
||||
|
||||
g_currentRequest.reset();
|
||||
|
||||
if (errorCode == ERR_DOWNLOAD_SUCCESS)
|
||||
{
|
||||
auto const & curFile = g_filesToDownload.back();
|
||||
size_t const sz = curFile.GetRemoteSize();
|
||||
LOG(LDEBUG, ("finished downloading", curFile.GetName(), "size", sz, "bytes"));
|
||||
|
||||
g_totalDownloadedBytes += sz;
|
||||
LOG(LDEBUG, ("totalDownloadedBytes:", g_totalDownloadedBytes));
|
||||
|
||||
g_filesToDownload.pop_back();
|
||||
}
|
||||
|
||||
JNIEnv * env = jni::GetEnv();
|
||||
|
||||
jmethodID methodID = jni::GetMethodID(env, *obj, "onFinish", "(I)V");
|
||||
env->CallVoidMethod(*obj, methodID, errorCode);
|
||||
}
|
||||
|
||||
static void DownloadFileProgress(std::shared_ptr<jobject> listener, HttpRequest const & req)
|
||||
{
|
||||
JNIEnv * env = jni::GetEnv();
|
||||
static jmethodID methodID = jni::GetMethodID(env, *listener, "onProgress", "(I)V");
|
||||
env->CallVoidMethod(*listener, methodID, static_cast<jint>(g_totalDownloadedBytes + req.GetProgress().m_bytesDownloaded));
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_app_organicmaps_sdk_DownloadResourcesLegacyActivity_nativeStartNextFileDownload(JNIEnv * env, jclass clazz, jobject listener)
|
||||
{
|
||||
if (g_filesToDownload.empty())
|
||||
return ERR_NO_MORE_FILES;
|
||||
|
||||
/// @todo One downloader instance with cached servers. All this routine will be refactored some time.
|
||||
static auto downloader = storage::GetDownloader();
|
||||
storage::Storage const & storage = g_framework->GetStorage();
|
||||
downloader->SetDataVersion(storage.GetCurrentDataVersion());
|
||||
|
||||
downloader->EnsureMetaConfigReady([&storage, ptr = jni::make_global_ref(listener)]()
|
||||
{
|
||||
auto const & curFile = g_filesToDownload.back();
|
||||
auto const fileName = curFile.GetFileName(MapFileType::Map);
|
||||
LOG(LINFO, ("Downloading file", fileName));
|
||||
|
||||
g_currentRequest.reset(HttpRequest::GetFile(
|
||||
downloader->MakeUrlListLegacy(fileName),
|
||||
storage.GetFilePath(curFile.GetName(), MapFileType::Map),
|
||||
curFile.GetRemoteSize(),
|
||||
std::bind(&DownloadFileFinished, ptr, _1),
|
||||
std::bind(&DownloadFileProgress, ptr, _1),
|
||||
0, false));
|
||||
});
|
||||
|
||||
return ERR_FILE_IN_PROGRESS;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_DownloadResourcesLegacyActivity_nativeCancelCurrentFile(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
LOG(LDEBUG, ("cancelCurrentFile, currentRequest=", g_currentRequest));
|
||||
g_currentRequest.reset();
|
||||
}
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include "map/framework.hpp"
|
||||
#include "map/place_page_info.hpp"
|
||||
#include "map/power_management/power_manager.hpp"
|
||||
|
||||
#include "search/result.hpp"
|
||||
|
||||
#include "drape_frontend/gui/skin.hpp"
|
||||
|
||||
#include "drape/pointers.hpp"
|
||||
#include "drape/graphics_context_factory.hpp"
|
||||
|
||||
|
||||
#include "indexer/feature_decl.hpp"
|
||||
#include "indexer/map_style.hpp"
|
||||
|
||||
#include "platform/country_defines.hpp"
|
||||
#include "platform/location.hpp"
|
||||
|
||||
#include "geometry/avg_vector.hpp"
|
||||
|
||||
#include "base/timer.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
class DataSource;
|
||||
struct FeatureID;
|
||||
|
||||
namespace search
|
||||
{
|
||||
struct EverywhereSearchParams;
|
||||
}
|
||||
|
||||
namespace android
|
||||
{
|
||||
enum CoordinatesFormat // See Java enum app.organicmaps.widget.placepage.CoordinatesFormat for all possible values.
|
||||
{
|
||||
LatLonDMS = 0, // Latitude, Longitude in degrees minutes seconds format, comma separated
|
||||
LatLonDecimal = 1, // Latitude, Longitude in decimal format, comma separated
|
||||
OLCFull = 2, // Open location code, full format
|
||||
OSMLink = 3, // Link to the OSM. E.g. https://osm.org/go/xcXjyqQlq-?m=
|
||||
UTM = 4, // Universal Transverse Mercator
|
||||
MGRS = 5 // Military Grid Reference System
|
||||
};
|
||||
|
||||
// Keep in sync `public @interface ChoosePositionMode`in Framework.java.
|
||||
enum class ChoosePositionMode
|
||||
{
|
||||
None = 0,
|
||||
Editor = 1,
|
||||
Api = 2,
|
||||
};
|
||||
|
||||
class Framework : private power_management::PowerManager::Subscriber
|
||||
{
|
||||
private:
|
||||
drape_ptr<dp::ThreadSafeFactory> m_oglContextFactory;
|
||||
drape_ptr<dp::GraphicsContextFactory> m_vulkanContextFactory;
|
||||
::Framework m_work;
|
||||
|
||||
math::LowPassVector<float, 3> m_sensors[2];
|
||||
double m_lastCompass = 0;
|
||||
|
||||
std::string m_searchQuery;
|
||||
|
||||
std::map<gui::EWidget, gui::Position> m_guiPositions;
|
||||
|
||||
void TrafficStateChanged(TrafficManager::TrafficState state);
|
||||
void TransitSchemeStateChanged(TransitReadManager::TransitSchemeState state);
|
||||
void IsolinesSchemeStateChanged(IsolinesManager::IsolinesState state);
|
||||
|
||||
void MyPositionModeChanged(location::EMyPositionMode mode, bool routingActive);
|
||||
|
||||
location::TMyPositionModeChanged m_myPositionModeSignal;
|
||||
|
||||
TrafficManager::TrafficStateChangedFn m_onTrafficStateChangedFn;
|
||||
TransitReadManager::TransitStateChangedFn m_onTransitStateChangedFn;
|
||||
IsolinesManager::IsolinesStateChangedFn m_onIsolinesStateChangedFn;
|
||||
|
||||
ChoosePositionMode m_isChoosePositionMode = ChoosePositionMode::None;
|
||||
bool m_isSurfaceDestroyed = false;
|
||||
|
||||
public:
|
||||
Framework(std::function<void()> && afterMapsLoaded);
|
||||
|
||||
storage::Storage & GetStorage();
|
||||
DataSource const & GetDataSource();
|
||||
|
||||
void ShowNode(storage::CountryId const & countryId, bool zoomToDownloadButton);
|
||||
|
||||
void OnLocationError(int/* == location::TLocationStatus*/ newStatus);
|
||||
void OnLocationUpdated(location::GpsInfo const & info);
|
||||
void OnCompassUpdated(location::CompassInfo const & info, bool forceRedraw);
|
||||
|
||||
bool CreateDrapeEngine(JNIEnv * env, jobject jSurface, int densityDpi, bool firstLaunch,
|
||||
bool launchByDeepLink, uint32_t appVersionCode, bool isCustomROM);
|
||||
bool IsDrapeEngineCreated() const;
|
||||
void UpdateDpi(int dpi);
|
||||
bool DestroySurfaceOnDetach();
|
||||
void DetachSurface(bool destroySurface);
|
||||
bool AttachSurface(JNIEnv * env, jobject jSurface);
|
||||
void PauseSurfaceRendering();
|
||||
void ResumeSurfaceRendering();
|
||||
|
||||
void SetMapStyle(MapStyle mapStyle);
|
||||
void MarkMapStyle(MapStyle mapStyle);
|
||||
MapStyle GetMapStyle() const;
|
||||
|
||||
void SetupMeasurementSystem();
|
||||
|
||||
RoutingManager & GetRoutingManager() { return m_work.GetRoutingManager(); }
|
||||
void SetRouter(routing::RouterType type) { m_work.GetRoutingManager().SetRouter(type); }
|
||||
routing::RouterType GetRouter() const { return m_work.GetRoutingManager().GetRouter(); }
|
||||
routing::RouterType GetLastUsedRouter() const
|
||||
{
|
||||
return m_work.GetRoutingManager().GetLastUsedRouter();
|
||||
}
|
||||
|
||||
void Resize(JNIEnv * env, jobject jSurface, int w, int h);
|
||||
|
||||
struct Finger
|
||||
{
|
||||
Finger(int64_t id, float x, float y)
|
||||
: m_id(id)
|
||||
, m_x(x)
|
||||
, m_y(y)
|
||||
{
|
||||
}
|
||||
|
||||
int64_t m_id;
|
||||
float m_x, m_y;
|
||||
};
|
||||
|
||||
void Scale(double factor, m2::PointD const & pxPoint, bool isAnim);
|
||||
|
||||
void Scroll(double distanceX, double distanceY);
|
||||
|
||||
void Touch(int action, Finger const & f1, Finger const & f2, uint8_t maskedPointer);
|
||||
|
||||
bool Search(search::EverywhereSearchParams const & params);
|
||||
std::string GetLastSearchQuery() { return m_searchQuery; }
|
||||
void ClearLastSearchQuery() { m_searchQuery.clear(); }
|
||||
|
||||
void AddLocalMaps();
|
||||
void RemoveLocalMaps();
|
||||
void ReloadWorldMaps();
|
||||
|
||||
m2::PointD GetViewportCenter() const;
|
||||
|
||||
void AddString(std::string const & name, std::string const & value);
|
||||
|
||||
void Scale(::Framework::EScaleMode mode);
|
||||
void Scale(m2::PointD const & centerPt, int targetZoom, bool animate);
|
||||
|
||||
void ChangeTrackColor(kml::TrackId trackId, dp::Color color);
|
||||
void ReplaceBookmark(kml::MarkId markId, kml::BookmarkData & bm);
|
||||
void ReplaceTrack(kml::TrackId trackId, kml::TrackData & trackData);
|
||||
void MoveBookmark(kml::MarkId markId, kml::MarkGroupId curCat, kml::MarkGroupId newCat);
|
||||
void MoveTrack(kml::TrackId trackId, kml::MarkGroupId curCat, kml::MarkGroupId newCat);
|
||||
|
||||
::Framework * NativeFramework();
|
||||
|
||||
bool IsDownloadingActive();
|
||||
|
||||
void ExecuteMapApiRequest();
|
||||
|
||||
void DeactivatePopup();
|
||||
void DeactivateMapSelectionCircle();
|
||||
|
||||
// std::string GetOutdatedCountriesString();
|
||||
|
||||
void SetMyPositionModeListener(location::TMyPositionModeChanged const & fn);
|
||||
location::EMyPositionMode GetMyPositionMode() const;
|
||||
void SwitchMyPositionNextMode();
|
||||
|
||||
void SetTrafficStateListener(TrafficManager::TrafficStateChangedFn const & fn);
|
||||
void SetTransitSchemeListener(TransitReadManager::TransitStateChangedFn const & fn);
|
||||
void SetIsolinesListener(IsolinesManager::IsolinesStateChangedFn const & fn);
|
||||
|
||||
bool IsTrafficEnabled();
|
||||
void EnableTraffic();
|
||||
void DisableTraffic();
|
||||
|
||||
void Save3dMode(bool allow3d, bool allow3dBuildings);
|
||||
void Set3dMode(bool allow3d, bool allow3dBuildings);
|
||||
void Get3dMode(bool & allow3d, bool & allow3dBuildings);
|
||||
|
||||
void SetMapLanguageCode(std::string const & languageCode);
|
||||
std::string GetMapLanguageCode();
|
||||
|
||||
void SetChoosePositionMode(ChoosePositionMode mode, bool isBusiness, m2::PointD const * optionalPosition);
|
||||
ChoosePositionMode GetChoosePositionMode();
|
||||
|
||||
void UpdateMyPositionRoutingOffset(int offsetY);
|
||||
void SetupWidget(gui::EWidget widget, float x, float y, dp::Anchor anchor);
|
||||
void ApplyWidgets();
|
||||
void CleanWidgets();
|
||||
|
||||
place_page::Info & GetPlacePageInfo();
|
||||
|
||||
bool IsAutoRetryDownloadFailed();
|
||||
bool IsDownloadOn3gEnabled();
|
||||
void EnableDownloadOn3g();
|
||||
|
||||
// int ToDoAfterUpdate() const;
|
||||
|
||||
// PowerManager::Subscriber overrides:
|
||||
void OnPowerFacilityChanged(power_management::Facility const facility, bool enabled) override;
|
||||
void OnPowerSchemeChanged(power_management::Scheme const actualScheme) override;
|
||||
|
||||
FeatureID BuildFeatureId(JNIEnv * env, jobject featureId);
|
||||
};
|
||||
}
|
||||
|
||||
extern std::unique_ptr<android::Framework> g_framework;
|
||||
::Framework * frm();
|
||||
@@ -1,190 +0,0 @@
|
||||
#include "Framework.hpp"
|
||||
|
||||
#include "app/organicmaps/sdk/core/jni_helper.hpp"
|
||||
|
||||
#include "app/organicmaps/sdk/platform/AndroidPlatform.hpp"
|
||||
|
||||
#include "storage/storage_defines.hpp"
|
||||
|
||||
#include "base/logging.hpp"
|
||||
|
||||
#include "platform/settings.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
void OnRenderingInitializationFinished(std::shared_ptr<jobject> const & listener)
|
||||
{
|
||||
JNIEnv * env = jni::GetEnv();
|
||||
env->CallVoidMethod(*listener, jni::GetMethodID(env, *listener.get(),
|
||||
"onRenderingInitializationFinished", "()V"));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
{
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeCreateEngine(JNIEnv * env, jclass,
|
||||
jobject surface, jint density,
|
||||
jboolean firstLaunch,
|
||||
jboolean isLaunchByDeepLink,
|
||||
jint appVersionCode,
|
||||
jboolean isCustomROM)
|
||||
{
|
||||
return g_framework->CreateDrapeEngine(env, surface, density, firstLaunch, isLaunchByDeepLink,
|
||||
base::asserted_cast<uint32_t>(appVersionCode), isCustomROM);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeIsEngineCreated(JNIEnv *, jclass)
|
||||
{
|
||||
return g_framework->IsDrapeEngineCreated();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeUpdateEngineDpi(JNIEnv *, jclass, jint dpi)
|
||||
{
|
||||
return g_framework->UpdateDpi(dpi);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeExecuteMapApiRequest(JNIEnv * env, jclass)
|
||||
{
|
||||
return g_framework->ExecuteMapApiRequest();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeSetRenderingInitializationFinishedListener(
|
||||
JNIEnv *, jclass, jobject listener)
|
||||
{
|
||||
if (listener)
|
||||
{
|
||||
g_framework->NativeFramework()->SetGraphicsContextInitializationHandler(
|
||||
std::bind(&OnRenderingInitializationFinished, jni::make_global_ref(listener)));
|
||||
}
|
||||
else
|
||||
{
|
||||
g_framework->NativeFramework()->SetGraphicsContextInitializationHandler(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeAttachSurface(JNIEnv * env, jclass, jobject surface)
|
||||
{
|
||||
return g_framework->AttachSurface(env, surface);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeDetachSurface(JNIEnv *, jclass, jboolean destroySurface)
|
||||
{
|
||||
g_framework->DetachSurface(destroySurface);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeSurfaceChanged(JNIEnv * env, jclass, jobject surface, jint w, jint h)
|
||||
{
|
||||
g_framework->Resize(env, surface, w, h);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeDestroySurfaceOnDetach(JNIEnv *, jclass)
|
||||
{
|
||||
return g_framework->DestroySurfaceOnDetach();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativePauseSurfaceRendering(JNIEnv *, jclass)
|
||||
{
|
||||
g_framework->PauseSurfaceRendering();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeResumeSurfaceRendering(JNIEnv *, jclass)
|
||||
{
|
||||
g_framework->ResumeSurfaceRendering();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeUpdateMyPositionRoutingOffset(JNIEnv * env, jclass clazz, int offsetY)
|
||||
{
|
||||
g_framework->UpdateMyPositionRoutingOffset(offsetY);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeApplyWidgets(JNIEnv *, jclass)
|
||||
{
|
||||
g_framework->ApplyWidgets();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeCleanWidgets(JNIEnv *, jclass)
|
||||
{
|
||||
g_framework->CleanWidgets();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeSetupWidget(
|
||||
JNIEnv *, jclass, jint widget, jfloat x, jfloat y, jint anchor)
|
||||
{
|
||||
g_framework->SetupWidget(static_cast<gui::EWidget>(widget), x, y, static_cast<dp::Anchor>(anchor));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeCompassUpdated(JNIEnv *, jclass, jdouble north, jboolean forceRedraw)
|
||||
{
|
||||
location::CompassInfo info;
|
||||
info.m_bearing = north;
|
||||
|
||||
g_framework->OnCompassUpdated(info, forceRedraw);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeScalePlus(JNIEnv *, jclass)
|
||||
{
|
||||
g_framework->Scale(::Framework::SCALE_MAG);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeScaleMinus(JNIEnv *, jclass)
|
||||
{
|
||||
g_framework->Scale(::Framework::SCALE_MIN);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeOnScroll(
|
||||
JNIEnv *, jclass, jdouble distanceX, jdouble distanceY)
|
||||
{
|
||||
g_framework->Scroll(distanceX, distanceY);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeOnScale(
|
||||
JNIEnv *, jclass, jdouble factor, jdouble focusX, jdouble focusY, jboolean isAnim)
|
||||
{
|
||||
g_framework->Scale(factor, {focusX, focusY}, isAnim);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeOnTouch(JNIEnv *, jclass, jint action,
|
||||
jint id1, jfloat x1, jfloat y1,
|
||||
jint id2, jfloat x2, jfloat y2,
|
||||
jint maskedPointer)
|
||||
{
|
||||
g_framework->Touch(action,
|
||||
android::Framework::Finger(id1, x1, y1),
|
||||
android::Framework::Finger(id2, x2, y2), maskedPointer);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeStorageConnected(JNIEnv *, jclass)
|
||||
{
|
||||
android::Platform::Instance().OnExternalStorageStatusChanged(true);
|
||||
g_framework->AddLocalMaps();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_Map_nativeStorageDisconnected(JNIEnv *, jclass)
|
||||
{
|
||||
android::Platform::Instance().OnExternalStorageStatusChanged(false);
|
||||
g_framework->RemoveLocalMaps();
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,59 +0,0 @@
|
||||
#include "Framework.hpp"
|
||||
|
||||
#include "map/gps_tracker.hpp"
|
||||
|
||||
#include "app/organicmaps/sdk/core/jni_helper.hpp"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_location_TrackRecorder_nativeSetEnabled(JNIEnv * env, jclass clazz, jboolean enable)
|
||||
{
|
||||
GpsTracker::Instance().SetEnabled(enable);
|
||||
Framework * const f = frm();
|
||||
if (f == nullptr)
|
||||
return;
|
||||
if (enable)
|
||||
f->ConnectToGpsTracker();
|
||||
else
|
||||
f->DisconnectFromGpsTracker();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_location_TrackRecorder_nativeIsEnabled(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
return GpsTracker::Instance().IsEnabled();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_location_TrackRecorder_nativeStartTrackRecording(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
frm()->StartTrackRecording();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_location_TrackRecorder_nativeStopTrackRecording(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
frm()->StopTrackRecording();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_location_TrackRecorder_nativeSaveTrackRecordingWithName(JNIEnv * env, jclass clazz, jstring name)
|
||||
{
|
||||
frm()->SaveTrackRecordingWithName(jni::ToNativeString(env, name));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_location_TrackRecorder_nativeIsTrackRecordingEmpty(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
return frm()->IsTrackRecordingEmpty();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_location_TrackRecorder_nativeIsTrackRecordingEnabled(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
return frm()->IsTrackRecordingEnabled();
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
#include "Framework.hpp"
|
||||
|
||||
#include "app/organicmaps/sdk/core/jni_helper.hpp"
|
||||
|
||||
#include "app/organicmaps/sdk/platform/AndroidPlatform.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
static void TrafficStateChanged(TrafficManager::TrafficState state, std::shared_ptr<jobject> const & listener)
|
||||
{
|
||||
JNIEnv * env = jni::GetEnv();
|
||||
env->CallVoidMethod(*listener, jni::GetMethodID(env, *listener, "onTrafficStateChanged", "(I)V"), static_cast<jint>(state));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_maplayer_traffic_TrafficState_nativeSetListener(JNIEnv * env, jclass clazz, jobject listener)
|
||||
{
|
||||
CHECK(g_framework, ("Framework isn't created yet!"));
|
||||
g_framework->SetTrafficStateListener(std::bind(&TrafficStateChanged, std::placeholders::_1, jni::make_global_ref(listener)));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_maplayer_traffic_TrafficState_nativeRemoveListener(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
CHECK(g_framework, ("Framework isn't created yet!"));
|
||||
g_framework->SetTrafficStateListener(TrafficManager::TrafficStateChangedFn());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_maplayer_traffic_TrafficState_nativeEnable(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
CHECK(g_framework, ("Framework isn't created yet!"));
|
||||
g_framework->EnableTraffic();
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_maplayer_traffic_TrafficState_nativeIsEnabled(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
CHECK(g_framework, ("Framework isn't created yet!"));
|
||||
return static_cast<jboolean>(g_framework->IsTrafficEnabled());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_maplayer_traffic_TrafficState_nativeDisable(JNIEnv * env, jclass clazz)
|
||||
{
|
||||
CHECK(g_framework, ("Framework isn't created yet!"));
|
||||
g_framework->DisableTraffic();
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,240 +0,0 @@
|
||||
#include "UserMarkHelper.hpp"
|
||||
|
||||
#include "app/organicmaps/sdk/routing/RoutePointInfo.hpp"
|
||||
|
||||
#include "map/elevation_info.hpp"
|
||||
#include "map/place_page_info.hpp"
|
||||
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
namespace usermark_helper
|
||||
{
|
||||
|
||||
void InjectMetadata(JNIEnv * env, jclass const clazz, jobject const mapObject, osm::MapObject const & src)
|
||||
{
|
||||
static jmethodID const addId = env->GetMethodID(clazz, "addMetadata", "(ILjava/lang/String;)V");
|
||||
ASSERT(addId, ());
|
||||
|
||||
src.ForEachMetadataReadable([env, &mapObject](osm::MapObject::MetadataID id, std::string const & meta)
|
||||
{
|
||||
/// @todo Make separate processing of non-string values like FMD_DESCRIPTION.
|
||||
/// Actually, better to call separate getters instead of ToString processing.
|
||||
if (!meta.empty())
|
||||
{
|
||||
jni::TScopedLocalRef metaString(env, jni::ToJavaString(env, meta));
|
||||
env->CallVoidMethod(mapObject, addId, static_cast<jint>(id), metaString.get());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//jobject CreatePopularity(JNIEnv * env, place_page::Info const & info)
|
||||
//{
|
||||
// static jclass const popularityClass =
|
||||
// jni::GetGlobalClassRef(env, "app/organicmaps/sdk/search/Popularity");
|
||||
// static jmethodID const popularityConstructor =
|
||||
// jni::GetConstructorID(env, popularityClass, "(I)V");
|
||||
// auto const popularityValue = info.GetPopularity();
|
||||
// return env->NewObject(popularityClass, popularityConstructor, static_cast<jint>(popularityValue));
|
||||
//}
|
||||
|
||||
jobject CreateMapObject(JNIEnv * env, place_page::Info const & info, int mapObjectType,
|
||||
double lat, double lon, bool parseMeta, bool parseApi,
|
||||
jobject const & routingPointInfo, jobject const & popularity, jobjectArray jrawTypes)
|
||||
{
|
||||
// public MapObject(@NonNull FeatureId featureId, @MapObjectType int mapObjectType, String title,
|
||||
// @Nullable String secondaryTitle, String subtitle, String address,
|
||||
// double lat, double lon, String apiId, @Nullable RoutePointInfo routePointInfo,
|
||||
// @OpeningMode int openingMode, @NonNull Popularity popularity, @NonNull String description,
|
||||
// int roadWarningType, @Nullable String[] rawTypes)
|
||||
static jmethodID const ctorId = jni::GetConstructorID(
|
||||
env, g_mapObjectClazz,
|
||||
"("
|
||||
"Lapp/organicmaps/sdk/bookmarks/data/FeatureId;" // featureId
|
||||
"I" // mapObjectType
|
||||
"Ljava/lang/String;" // title
|
||||
"Ljava/lang/String;" // secondaryTitle
|
||||
"Ljava/lang/String;" // subtitle
|
||||
"Ljava/lang/String;" // address
|
||||
"DD" // lat, lon
|
||||
"Ljava/lang/String;" // appId
|
||||
"Lapp/organicmaps/sdk/routing/RoutePointInfo;" // routePointInfo
|
||||
"I" // openingMode
|
||||
"Lapp/organicmaps/sdk/search/Popularity;" // popularity
|
||||
"Ljava/lang/String;" // description
|
||||
"I" // roadWarnType
|
||||
"[Ljava/lang/String;" // rawTypes
|
||||
")V");
|
||||
|
||||
//public FeatureId(@NonNull String mwmName, long mwmVersion, int featureIndex)
|
||||
static jmethodID const featureCtorId =
|
||||
jni::GetConstructorID(env, g_featureIdClazz, "(Ljava/lang/String;JI)V");
|
||||
|
||||
auto const fID = info.GetID();
|
||||
jni::TScopedLocalRef jMwmName(env, jni::ToJavaString(env, fID.GetMwmName()));
|
||||
jni::TScopedLocalRef jFeatureId(
|
||||
env, env->NewObject(g_featureIdClazz, featureCtorId, jMwmName.get(), (jlong)fID.GetMwmVersion(),
|
||||
(jint)fID.m_index));
|
||||
jni::TScopedLocalRef jTitle(env, jni::ToJavaString(env, info.GetTitle()));
|
||||
jni::TScopedLocalRef jSecondaryTitle(env, jni::ToJavaString(env, info.GetSecondaryTitle()));
|
||||
jni::TScopedLocalRef jSubtitle(env, jni::ToJavaStringWithSupplementalCharsFix(env, info.GetSubtitle()));
|
||||
jni::TScopedLocalRef jAddress(env, jni::ToJavaString(env, info.GetSecondarySubtitle()));
|
||||
jni::TScopedLocalRef jApiId(env, jni::ToJavaString(env, parseApi ? info.GetApiUrl() : ""));
|
||||
jni::TScopedLocalRef jWikiDescription(env, jni::ToJavaString(env, info.GetWikiDescription()));
|
||||
jobject mapObject =
|
||||
env->NewObject(g_mapObjectClazz, ctorId, jFeatureId.get(), mapObjectType, jTitle.get(),
|
||||
jSecondaryTitle.get(), jSubtitle.get(), jAddress.get(), lat, lon, jApiId.get(),
|
||||
routingPointInfo,
|
||||
static_cast<jint>(info.GetOpeningMode()), popularity, jWikiDescription.get(),
|
||||
static_cast<jint>(info.GetRoadType()), jrawTypes);
|
||||
|
||||
if (parseMeta)
|
||||
InjectMetadata(env, g_mapObjectClazz, mapObject, info);
|
||||
return mapObject;
|
||||
}
|
||||
|
||||
jobject CreateBookmark(JNIEnv *env, const place_page::Info &info,
|
||||
const jni::TScopedLocalObjectArrayRef &jrawTypes,
|
||||
const jni::TScopedLocalRef &routingPointInfo,
|
||||
jobject const & popularity)
|
||||
{
|
||||
//public Bookmark(@NonNull FeatureId featureId, @IntRange(from = 0) long categoryId,
|
||||
// @IntRange(from = 0) long bookmarkId, String title, @Nullable String secondaryTitle,
|
||||
// @Nullable String subtitle, @Nullable String address, @Nullable RoutePointInfo routePointInfo,
|
||||
// @OpeningMode int openingMode, @NonNull Popularity popularity, @NonNull String description,
|
||||
// @Nullable String[] rawTypes)
|
||||
static jmethodID const ctorId =
|
||||
jni::GetConstructorID(env, g_bookmarkClazz,
|
||||
"(Lapp/organicmaps/sdk/bookmarks/data/FeatureId;JJLjava/lang/String;"
|
||||
"Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;"
|
||||
"Lapp/organicmaps/sdk/routing/RoutePointInfo;"
|
||||
"ILapp/organicmaps/sdk/search/Popularity;Ljava/lang/String;"
|
||||
"[Ljava/lang/String;)V");
|
||||
static jmethodID const featureCtorId =
|
||||
jni::GetConstructorID(env, g_featureIdClazz, "(Ljava/lang/String;JI)V");
|
||||
|
||||
auto const bookmarkId = info.GetBookmarkId();
|
||||
auto const categoryId = info.GetBookmarkCategoryId();
|
||||
jni::TScopedLocalRef jMwmName(env, jni::ToJavaString(env, info.GetID().GetMwmName()));
|
||||
jni::TScopedLocalRef jFeatureId(
|
||||
env, env->NewObject(g_featureIdClazz, featureCtorId, jMwmName.get(),
|
||||
(jlong)info.GetID().GetMwmVersion(), (jint)info.GetID().m_index));
|
||||
jni::TScopedLocalRef jTitle(env, jni::ToJavaString(env, info.GetTitle()));
|
||||
jni::TScopedLocalRef jSecondaryTitle(env, jni::ToJavaString(env, info.GetSecondaryTitle()));
|
||||
jni::TScopedLocalRef jSubtitle(env, jni::ToJavaStringWithSupplementalCharsFix(env, info.GetSubtitle()));
|
||||
jni::TScopedLocalRef jAddress(env, jni::ToJavaString(env, info.GetSecondarySubtitle()));
|
||||
jni::TScopedLocalRef jWikiDescription(env, jni::ToJavaString(env, info.GetWikiDescription()));
|
||||
jobject mapObject = env->NewObject(
|
||||
g_bookmarkClazz, ctorId, jFeatureId.get(), static_cast<jlong>(categoryId),
|
||||
static_cast<jlong>(bookmarkId), jTitle.get(), jSecondaryTitle.get(), jSubtitle.get(),
|
||||
jAddress.get(), routingPointInfo.get(), info.GetOpeningMode(), popularity,
|
||||
jWikiDescription.get(), jrawTypes.get());
|
||||
|
||||
if (info.HasMetadata())
|
||||
InjectMetadata(env, g_mapObjectClazz, mapObject, info);
|
||||
return mapObject;
|
||||
}
|
||||
|
||||
jobject CreateElevationPoint(JNIEnv * env, ElevationInfo::Point const & point)
|
||||
{
|
||||
static jclass const pointClass =
|
||||
jni::GetGlobalClassRef(env, "app/organicmaps/sdk/bookmarks/data/ElevationInfo$Point");
|
||||
// public Point(double distance, int altitude)
|
||||
static jmethodID const pointCtorId =
|
||||
jni::GetConstructorID(env, pointClass, "(DI)V");
|
||||
return env->NewObject(pointClass, pointCtorId, static_cast<jdouble >(point.m_distance),
|
||||
static_cast<jint>(point.m_point.GetAltitude()));
|
||||
}
|
||||
|
||||
jobjectArray ToElevationPointArray(JNIEnv * env, ElevationInfo::Points const & points)
|
||||
{
|
||||
CHECK(!points.empty(), ("Elevation points must be non empty!"));
|
||||
static jclass const pointClass =
|
||||
jni::GetGlobalClassRef(env, "app/organicmaps/sdk/bookmarks/data/ElevationInfo$Point");
|
||||
return jni::ToJavaArray(env, pointClass, points,
|
||||
[](JNIEnv * env, ElevationInfo::Point const & item)
|
||||
{
|
||||
return CreateElevationPoint(env, item);
|
||||
});
|
||||
}
|
||||
|
||||
jobject CreateElevationInfo(JNIEnv * env, ElevationInfo const & info)
|
||||
{
|
||||
// public ElevationInfo(long trackId, @NonNull String name, @NonNull Point[] points,
|
||||
// int ascent, int descent, int minAltitude, int maxAltitude, int difficulty,
|
||||
// long m_duration)
|
||||
static jmethodID const ctorId =
|
||||
jni::GetConstructorID(env, g_elevationInfoClazz, "(JLjava/lang/String;Ljava/lang/String;"
|
||||
"[Lapp/organicmaps/sdk/bookmarks/data/ElevationInfo$Point;"
|
||||
"IIIIIJ)V");
|
||||
jni::TScopedLocalObjectArrayRef jPoints(env, ToElevationPointArray(env, info.GetPoints()));
|
||||
// TODO (KK): elevation info should have only the elevation data - see the https://github.com/organicmaps/organicmaps/pull/10063
|
||||
return env->NewObject(g_elevationInfoClazz, ctorId,
|
||||
jPoints.get(),
|
||||
// static_cast<jint>(info.GetAscent()),
|
||||
// static_cast<jint>(info.GetDescent()),
|
||||
// static_cast<jint>(info.GetMinAltitude()),
|
||||
// static_cast<jint>(info.GetMaxAltitude()),
|
||||
static_cast<jint>(info.GetDifficulty()));
|
||||
}
|
||||
|
||||
jobject CreateMapObject(JNIEnv * env, place_page::Info const & info)
|
||||
{
|
||||
jni::TScopedLocalObjectArrayRef jrawTypes(env, jni::ToJavaStringArray(env, info.GetRawTypes()));
|
||||
|
||||
jni::TScopedLocalRef routingPointInfo(env, nullptr);
|
||||
if (info.IsRoutePoint())
|
||||
routingPointInfo.reset(CreateRoutePointInfo(env, info));
|
||||
|
||||
//jni::TScopedLocalRef popularity(env, CreatePopularity(env, info));
|
||||
jobject popularity = nullptr;
|
||||
|
||||
if (info.IsBookmark())
|
||||
{
|
||||
return CreateBookmark(env, info, jrawTypes, routingPointInfo, popularity);
|
||||
}
|
||||
|
||||
ms::LatLon const ll = info.GetLatLon();
|
||||
// TODO(yunikkk): object can be POI + API + search result + bookmark simultaneously.
|
||||
// TODO(yunikkk): Should we pass localized strings here and in other methods as byte arrays?
|
||||
if (info.IsMyPosition())
|
||||
{
|
||||
return CreateMapObject(env, info, kMyPosition, ll.m_lat, ll.m_lon,
|
||||
false /* parseMeta */, false /* parseApi */,
|
||||
routingPointInfo.get(), popularity, jrawTypes.get());
|
||||
}
|
||||
|
||||
if (info.HasApiUrl())
|
||||
{
|
||||
return CreateMapObject(env, info, kApiPoint, ll.m_lat, ll.m_lon,
|
||||
true /* parseMeta */, true /* parseApi */,
|
||||
routingPointInfo.get(), popularity, jrawTypes.get());
|
||||
}
|
||||
|
||||
return CreateMapObject(env, info, kPoi, ll.m_lat, ll.m_lon,
|
||||
true /* parseMeta */, false /* parseApi */,
|
||||
routingPointInfo.get(), popularity, jrawTypes.get());
|
||||
}
|
||||
|
||||
jobject CreateFeatureId(JNIEnv * env, FeatureID const & fid)
|
||||
{
|
||||
static jmethodID const featureCtorId =
|
||||
jni::GetConstructorID(env, g_featureIdClazz, "(Ljava/lang/String;JI)V");
|
||||
|
||||
auto const & info = fid.m_mwmId.GetInfo();
|
||||
jni::TScopedLocalRef jMwmName(env, jni::ToJavaString(env, info ? info->GetCountryName() : ""));
|
||||
return env->NewObject(g_featureIdClazz, featureCtorId, jMwmName.get(),
|
||||
info ? static_cast<jlong>(info->GetVersion()) : 0,
|
||||
static_cast<jint>(fid.m_index));
|
||||
}
|
||||
|
||||
jobjectArray ToFeatureIdArray(JNIEnv * env, std::vector<FeatureID> const & ids)
|
||||
{
|
||||
if (ids.empty())
|
||||
return nullptr;
|
||||
|
||||
return jni::ToJavaArray(env, g_featureIdClazz, ids,
|
||||
[](JNIEnv * env, FeatureID const & fid) {
|
||||
return CreateFeatureId(env, fid);
|
||||
});
|
||||
}
|
||||
} // namespace usermark_helper
|
||||
@@ -1,943 +0,0 @@
|
||||
#include "app/organicmaps/sdk/core/jni_helper.hpp"
|
||||
#include "app/organicmaps/sdk/Framework.hpp"
|
||||
#include "app/organicmaps/sdk/UserMarkHelper.hpp"
|
||||
#include "app/organicmaps/sdk/util/Distance.hpp"
|
||||
|
||||
#include "map/bookmark_helpers.hpp"
|
||||
#include "map/place_page_info.hpp"
|
||||
|
||||
|
||||
#include "coding/zip_creator.hpp"
|
||||
|
||||
#include "platform/localization.hpp"
|
||||
#include "platform/preferred_languages.hpp"
|
||||
|
||||
#include "base/macros.hpp"
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
using namespace jni;
|
||||
using namespace std::placeholders;
|
||||
|
||||
namespace
|
||||
{
|
||||
jclass g_bookmarkManagerClass;
|
||||
jfieldID g_bookmarkManagerInstanceField;
|
||||
jmethodID g_onBookmarksChangedMethod;
|
||||
jmethodID g_onBookmarksLoadingStartedMethod;
|
||||
jmethodID g_onBookmarksLoadingFinishedMethod;
|
||||
jmethodID g_onBookmarksFileLoadedMethod;
|
||||
jmethodID g_onPreparedFileForSharingMethod;
|
||||
jmethodID g_onElevationActivePointChangedMethod;
|
||||
jmethodID g_onElevationCurrentPositionChangedMethod;
|
||||
jclass g_bookmarkCategoryClass;
|
||||
jmethodID g_bookmarkCategoryConstructor;
|
||||
|
||||
jclass g_sortedBlockClass;
|
||||
jmethodID g_sortedBlockConstructor;
|
||||
jclass g_longClass;
|
||||
jmethodID g_longConstructor;
|
||||
jmethodID g_onBookmarksSortingCompleted;
|
||||
jmethodID g_onBookmarksSortingCancelled;
|
||||
jmethodID g_bookmarkInfoConstructor;
|
||||
jclass g_bookmarkInfoClass;
|
||||
|
||||
|
||||
void PrepareClassRefs(JNIEnv * env)
|
||||
{
|
||||
if (g_bookmarkManagerClass)
|
||||
return;
|
||||
|
||||
g_bookmarkManagerClass =
|
||||
jni::GetGlobalClassRef(env, "app/organicmaps/sdk/bookmarks/data/BookmarkManager");
|
||||
g_bookmarkManagerInstanceField = jni::GetStaticFieldID(env, g_bookmarkManagerClass, "INSTANCE",
|
||||
"Lapp/organicmaps/sdk/bookmarks/data/BookmarkManager;");
|
||||
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
|
||||
g_bookmarkManagerInstanceField);
|
||||
g_onBookmarksChangedMethod =
|
||||
jni::GetMethodID(env, bookmarkManagerInstance, "onBookmarksChanged", "()V");
|
||||
g_onBookmarksLoadingStartedMethod =
|
||||
jni::GetMethodID(env, bookmarkManagerInstance, "onBookmarksLoadingStarted", "()V");
|
||||
g_onBookmarksLoadingFinishedMethod =
|
||||
jni::GetMethodID(env, bookmarkManagerInstance, "onBookmarksLoadingFinished", "()V");
|
||||
g_onBookmarksFileLoadedMethod =
|
||||
jni::GetMethodID(env, bookmarkManagerInstance, "onBookmarksFileLoaded",
|
||||
"(ZLjava/lang/String;Z)V");
|
||||
g_onPreparedFileForSharingMethod =
|
||||
jni::GetMethodID(env, bookmarkManagerInstance, "onPreparedFileForSharing",
|
||||
"(Lapp/organicmaps/sdk/bookmarks/data/BookmarkSharingResult;)V");
|
||||
|
||||
g_longClass = jni::GetGlobalClassRef(env,"java/lang/Long");
|
||||
g_longConstructor = jni::GetConstructorID(env, g_longClass, "(J)V");
|
||||
g_sortedBlockClass =
|
||||
jni::GetGlobalClassRef(env, "app/organicmaps/sdk/bookmarks/data/SortedBlock");
|
||||
g_sortedBlockConstructor =
|
||||
jni::GetConstructorID(env, g_sortedBlockClass,
|
||||
"(Ljava/lang/String;[Ljava/lang/Long;[Ljava/lang/Long;)V");
|
||||
|
||||
|
||||
g_onBookmarksSortingCompleted = jni::GetMethodID(env, bookmarkManagerInstance,
|
||||
"onBookmarksSortingCompleted", "([Lapp/organicmaps/sdk/bookmarks/data/SortedBlock;J)V");
|
||||
g_onBookmarksSortingCancelled = jni::GetMethodID(env, bookmarkManagerInstance,
|
||||
"onBookmarksSortingCancelled", "(J)V");
|
||||
g_bookmarkInfoClass =
|
||||
jni::GetGlobalClassRef(env, "app/organicmaps/sdk/bookmarks/data/BookmarkInfo");
|
||||
g_bookmarkInfoConstructor =
|
||||
jni::GetConstructorID(env, g_bookmarkInfoClass, "(JJ)V" );
|
||||
g_bookmarkCategoryClass =
|
||||
jni::GetGlobalClassRef(env, "app/organicmaps/sdk/bookmarks/data/BookmarkCategory");
|
||||
|
||||
//public BookmarkCategory(long id,
|
||||
// String name,
|
||||
// String annotation,
|
||||
// String desc,
|
||||
// int tracksCount,
|
||||
// int bookmarksCount,
|
||||
// boolean isVisible)
|
||||
g_bookmarkCategoryConstructor =
|
||||
jni::GetConstructorID(env, g_bookmarkCategoryClass,
|
||||
"("
|
||||
"J" // id
|
||||
"Ljava/lang/String;" // name
|
||||
"Ljava/lang/String;" // annotation
|
||||
"Ljava/lang/String;" // desc
|
||||
"I" // tracksCount
|
||||
"I" // bookmarksCount
|
||||
"Z" // isVisible
|
||||
")V");
|
||||
g_onElevationCurrentPositionChangedMethod =
|
||||
jni::GetMethodID(env, bookmarkManagerInstance, "onElevationCurrentPositionChanged", "()V");
|
||||
g_onElevationActivePointChangedMethod =
|
||||
jni::GetMethodID(env, bookmarkManagerInstance, "onElevationActivePointChanged", "()V");
|
||||
}
|
||||
|
||||
void OnElevationCurPositionChanged(JNIEnv * env)
|
||||
{
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
jobject bookmarkManagerInstance =
|
||||
env->GetStaticObjectField(g_bookmarkManagerClass, g_bookmarkManagerInstanceField);
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onElevationCurrentPositionChangedMethod);
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
void OnElevationActivePointChanged(JNIEnv * env)
|
||||
{
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
|
||||
g_bookmarkManagerInstanceField);
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onElevationActivePointChangedMethod);
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
void OnBookmarksChanged(JNIEnv * env)
|
||||
{
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
|
||||
g_bookmarkManagerInstanceField);
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksChangedMethod);
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
void OnAsyncLoadingStarted(JNIEnv * env)
|
||||
{
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
|
||||
g_bookmarkManagerInstanceField);
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksLoadingStartedMethod);
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
void OnAsyncLoadingFinished(JNIEnv * env)
|
||||
{
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
|
||||
g_bookmarkManagerInstanceField);
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksLoadingFinishedMethod);
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
void OnAsyncLoadingFileSuccess(JNIEnv * env, std::string const & fileName, bool isTemporaryFile)
|
||||
{
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
|
||||
g_bookmarkManagerInstanceField);
|
||||
jni::TScopedLocalRef jFileName(env, jni::ToJavaString(env, fileName));
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksFileLoadedMethod,
|
||||
true /* success */, jFileName.get(), isTemporaryFile);
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
void OnAsyncLoadingFileError(JNIEnv * env, std::string const & fileName, bool isTemporaryFile)
|
||||
{
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
|
||||
g_bookmarkManagerInstanceField);
|
||||
jni::TScopedLocalRef jFileName(env, jni::ToJavaString(env, fileName));
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksFileLoadedMethod,
|
||||
false /* success */, jFileName.get(), isTemporaryFile);
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
void OnPreparedFileForSharing(JNIEnv * env, BookmarkManager::SharingResult const & result)
|
||||
{
|
||||
static jclass const classBookmarkSharingResult = jni::GetGlobalClassRef(env, "app/organicmaps/sdk/bookmarks/data/BookmarkSharingResult");
|
||||
// BookmarkSharingResult(long[] categoriesIds, @Code int code, @NonNull String sharingPath, @NonNull String mimeType, @NonNull String errorString)
|
||||
static jmethodID const ctorBookmarkSharingResult = jni::GetConstructorID(env, classBookmarkSharingResult, "([JILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
|
||||
static_assert(sizeof(jlong) == sizeof(decltype(result.m_categoriesIds)::value_type));
|
||||
jsize const categoriesIdsSize = static_cast<jsize>(result.m_categoriesIds.size());
|
||||
jni::ScopedLocalRef<jlongArray> categoriesIds(env, env->NewLongArray(categoriesIdsSize));
|
||||
env->SetLongArrayRegion(categoriesIds.get(), 0, categoriesIdsSize, reinterpret_cast<jlong const *>(result.m_categoriesIds.data()));
|
||||
jni::TScopedLocalRef const sharingPath(env, jni::ToJavaString(env, result.m_sharingPath));
|
||||
jni::TScopedLocalRef const mimeType(env, jni::ToJavaString(env, result.m_mimeType));
|
||||
jni::TScopedLocalRef const errorString(env, jni::ToJavaString(env, result.m_errorString));
|
||||
|
||||
jni::TScopedLocalRef const sharingResult(env, env->NewObject(classBookmarkSharingResult, ctorBookmarkSharingResult,
|
||||
categoriesIds.get(), static_cast<jint>(result.m_code), sharingPath.get(), mimeType.get(), errorString.get()));
|
||||
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass, g_bookmarkManagerInstanceField);
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onPreparedFileForSharingMethod, sharingResult.get());
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
void OnCategorySortingResults(JNIEnv * env, long long timestamp,
|
||||
BookmarkManager::SortedBlocksCollection && sortedBlocks,
|
||||
BookmarkManager::SortParams::Status status)
|
||||
{
|
||||
ASSERT(g_bookmarkManagerClass, ());
|
||||
ASSERT(g_sortedBlockClass, ());
|
||||
ASSERT(g_sortedBlockConstructor, ());
|
||||
|
||||
jobject bookmarkManagerInstance = env->GetStaticObjectField(g_bookmarkManagerClass,
|
||||
g_bookmarkManagerInstanceField);
|
||||
|
||||
if (status == BookmarkManager::SortParams::Status::Cancelled)
|
||||
{
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksSortingCancelled,
|
||||
static_cast<jlong>(timestamp));
|
||||
jni::HandleJavaException(env);
|
||||
return;
|
||||
}
|
||||
|
||||
jni::TScopedLocalObjectArrayRef blocksRef(env,
|
||||
jni::ToJavaArray(env, g_sortedBlockClass, sortedBlocks,
|
||||
[](JNIEnv * env, BookmarkManager::SortedBlock const & block)
|
||||
{
|
||||
jni::TScopedLocalRef blockNameRef(env, jni::ToJavaString(env, block.m_blockName));
|
||||
|
||||
jni::TScopedLocalObjectArrayRef marksRef(env,
|
||||
jni::ToJavaArray(env, g_longClass, block.m_markIds,
|
||||
[](JNIEnv * env, kml::MarkId const & markId)
|
||||
{
|
||||
return env->NewObject(g_longClass, g_longConstructor,
|
||||
static_cast<jlong>(markId));
|
||||
}));
|
||||
|
||||
jni::TScopedLocalObjectArrayRef tracksRef(env,
|
||||
jni::ToJavaArray(env, g_longClass, block.m_trackIds,
|
||||
[](JNIEnv * env, kml::TrackId const & trackId)
|
||||
{
|
||||
return env->NewObject(g_longClass, g_longConstructor,
|
||||
static_cast<jlong>(trackId));
|
||||
}));
|
||||
|
||||
return env->NewObject(g_sortedBlockClass, g_sortedBlockConstructor,
|
||||
blockNameRef.get(), marksRef.get(), tracksRef.get());
|
||||
|
||||
}));
|
||||
env->CallVoidMethod(bookmarkManagerInstance, g_onBookmarksSortingCompleted,
|
||||
blocksRef.get(), static_cast<jlong>(timestamp));
|
||||
jni::HandleJavaException(env);
|
||||
}
|
||||
|
||||
Bookmark const * getBookmark(jlong bokmarkId)
|
||||
{
|
||||
Bookmark const * pBmk = frm()->GetBookmarkManager().GetBookmark(static_cast<kml::MarkId>(bokmarkId));
|
||||
ASSERT(pBmk, ("Bookmark not found, id", bokmarkId));
|
||||
return pBmk;
|
||||
}
|
||||
|
||||
jobject MakeCategory(JNIEnv * env, kml::MarkGroupId id)
|
||||
{
|
||||
auto const & manager = frm()->GetBookmarkManager();
|
||||
auto const & data = manager.GetCategoryData(id);
|
||||
|
||||
auto const tracksCount = manager.GetTrackIds(data.m_id).size();
|
||||
auto const bookmarksCount = manager.GetUserMarkIds(data.m_id).size();
|
||||
auto const isVisible = manager.IsVisible(data.m_id);
|
||||
auto const preferBookmarkStr = GetPreferredBookmarkStr(data.m_name);
|
||||
auto const annotation = GetPreferredBookmarkStr(data.m_annotation);
|
||||
auto const description = GetPreferredBookmarkStr(data.m_description);
|
||||
|
||||
jni::TScopedLocalRef preferBookmarkStrRef(env, jni::ToJavaString(env, preferBookmarkStr));
|
||||
jni::TScopedLocalRef annotationRef(env, jni::ToJavaString(env, annotation));
|
||||
jni::TScopedLocalRef descriptionRef(env, jni::ToJavaString(env, description));
|
||||
|
||||
return env->NewObject(g_bookmarkCategoryClass,
|
||||
g_bookmarkCategoryConstructor,
|
||||
static_cast<jlong>(data.m_id),
|
||||
preferBookmarkStrRef.get(),
|
||||
annotationRef.get(),
|
||||
descriptionRef.get(),
|
||||
static_cast<jint>(tracksCount),
|
||||
static_cast<jint>(bookmarksCount),
|
||||
static_cast<jboolean>(isVisible));
|
||||
}
|
||||
|
||||
jobjectArray MakeCategories(JNIEnv * env, kml::GroupIdCollection const & ids)
|
||||
{
|
||||
return ToJavaArray(env, g_bookmarkCategoryClass, ids, std::bind(&MakeCategory, _1, _2));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
extern "C"
|
||||
{
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeShowBookmarkOnMap(
|
||||
JNIEnv *, jobject, jlong bmkId)
|
||||
{
|
||||
frm()->ShowBookmark(static_cast<kml::MarkId>(bmkId));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeShowBookmarkCategoryOnMap(
|
||||
JNIEnv *, jobject, jlong catId)
|
||||
{
|
||||
frm()->ShowBookmarkCategory(static_cast<kml::MarkGroupId>(catId), true /* animated */);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeLoadBookmarks(JNIEnv * env, jclass)
|
||||
{
|
||||
PrepareClassRefs(env);
|
||||
BookmarkManager::AsyncLoadingCallbacks callbacks;
|
||||
callbacks.m_onStarted = std::bind(&OnAsyncLoadingStarted, env);
|
||||
callbacks.m_onFinished = std::bind(&OnAsyncLoadingFinished, env);
|
||||
callbacks.m_onFileSuccess = std::bind(&OnAsyncLoadingFileSuccess, env, _1, _2);
|
||||
callbacks.m_onFileError = std::bind(&OnAsyncLoadingFileError, env, _1, _2);
|
||||
frm()->GetBookmarkManager().SetAsyncLoadingCallbacks(std::move(callbacks));
|
||||
|
||||
frm()->GetBookmarkManager().SetBookmarksChangedCallback(std::bind(&OnBookmarksChanged, env));
|
||||
|
||||
frm()->LoadBookmarks();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeCreateCategory(
|
||||
JNIEnv * env, jobject, jstring name)
|
||||
{
|
||||
auto const categoryId = frm()->GetBookmarkManager().CreateBookmarkCategory(ToNativeString(env, name));
|
||||
frm()->GetBookmarkManager().SetLastEditedBmCategory(categoryId);
|
||||
return static_cast<jlong>(categoryId);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeDeleteCategory(
|
||||
JNIEnv *, jobject, jlong catId)
|
||||
{
|
||||
auto const categoryId = static_cast<kml::MarkGroupId>(catId);
|
||||
// `permanently` should be set to false when the Recently Deleted Lists feature be implemented
|
||||
return static_cast<jboolean>(frm()->GetBookmarkManager().GetEditSession().DeleteBmCategory(categoryId, true /* permanently */));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeDeleteBookmark(JNIEnv *, jobject, jlong bmkId)
|
||||
{
|
||||
frm()->GetBookmarkManager().GetEditSession().DeleteBookmark(static_cast<kml::MarkId>(bmkId));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeDeleteTrack(
|
||||
JNIEnv *, jobject, jlong trkId)
|
||||
{
|
||||
frm()->GetBookmarkManager().GetEditSession().DeleteTrack(static_cast<kml::TrackId>(trkId));
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeAddBookmarkToLastEditedCategory(
|
||||
JNIEnv * env, jobject, double lat, double lon)
|
||||
{
|
||||
if (!frm()->HasPlacePageInfo())
|
||||
return nullptr;
|
||||
|
||||
BookmarkManager & bmMng = frm()->GetBookmarkManager();
|
||||
|
||||
place_page::Info const & info = g_framework->GetPlacePageInfo();
|
||||
|
||||
kml::BookmarkData bmData;
|
||||
bmData.m_name = info.FormatNewBookmarkName();
|
||||
bmData.m_color.m_predefinedColor = frm()->LastEditedBMColor();
|
||||
bmData.m_point = mercator::FromLatLon(lat, lon);
|
||||
auto const lastEditedCategory = frm()->LastEditedBMCategory();
|
||||
|
||||
if (info.IsFeature())
|
||||
SaveFeatureTypes(info.GetTypes(), bmData);
|
||||
|
||||
auto const * createdBookmark = bmMng.GetEditSession().CreateBookmark(std::move(bmData),
|
||||
lastEditedCategory);
|
||||
|
||||
auto buildInfo = info.GetBuildInfo();
|
||||
buildInfo.m_match = place_page::BuildInfo::Match::Everything;
|
||||
buildInfo.m_userMarkId = createdBookmark->GetId();
|
||||
frm()->UpdatePlacePageInfoForCurrentSelection(buildInfo);
|
||||
|
||||
return usermark_helper::CreateMapObject(env, g_framework->GetPlacePageInfo());
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetLastEditedCategory(
|
||||
JNIEnv *, jobject)
|
||||
{
|
||||
return static_cast<jlong>(frm()->LastEditedBMCategory());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetLastEditedColor(
|
||||
JNIEnv *, jobject)
|
||||
{
|
||||
return static_cast<jint>(frm()->LastEditedBMColor());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeLoadBookmarksFile(JNIEnv * env, jclass,
|
||||
jstring path, jboolean isTemporaryFile)
|
||||
{
|
||||
frm()->AddBookmarksFile(ToNativeString(env, path), isTemporaryFile);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeIsAsyncBookmarksLoadingInProgress(JNIEnv *, jclass)
|
||||
{
|
||||
return static_cast<jboolean>(frm()->GetBookmarkManager().IsAsyncLoadingInProgress());
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeIsVisible(
|
||||
JNIEnv *, jobject, jlong catId)
|
||||
{
|
||||
return static_cast<jboolean>(frm()->GetBookmarkManager().IsVisible(static_cast<kml::MarkGroupId>(catId)));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetVisibility(
|
||||
JNIEnv *, jobject, jlong catId, jboolean isVisible)
|
||||
{
|
||||
frm()->GetBookmarkManager().GetEditSession().SetIsVisible(static_cast<kml::MarkGroupId>(catId), isVisible);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetCategoryName(
|
||||
JNIEnv * env, jobject, jlong catId, jstring name)
|
||||
{
|
||||
frm()->GetBookmarkManager().GetEditSession().SetCategoryName(static_cast<kml::MarkGroupId>(catId),
|
||||
jni::ToNativeString(env, name));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetCategoryDescription(JNIEnv * env,
|
||||
jobject,
|
||||
jlong catId,
|
||||
jstring desc)
|
||||
{
|
||||
frm()->GetBookmarkManager().GetEditSession().SetCategoryDescription(
|
||||
static_cast<kml::MarkGroupId>(catId), jni::ToNativeString(env, desc));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetCategoryTags(
|
||||
JNIEnv * env, jobject, jlong catId, jobjectArray tagsIds)
|
||||
{
|
||||
auto const size = env->GetArrayLength(tagsIds);
|
||||
std::vector<std::string> categoryTags;
|
||||
categoryTags.reserve(static_cast<size_t>(size));
|
||||
for (auto i = 0; i < size; i++)
|
||||
{
|
||||
jni::TScopedLocalRef const item(env, env->GetObjectArrayElement(tagsIds, i));
|
||||
categoryTags.push_back(jni::ToNativeString(env, static_cast<jstring>(item.get())));
|
||||
}
|
||||
|
||||
frm()->GetBookmarkManager().GetEditSession().SetCategoryTags(static_cast<kml::MarkGroupId>(catId),
|
||||
categoryTags);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetCategoryAccessRules(
|
||||
JNIEnv *, jobject, jlong catId, jint accessRules)
|
||||
{
|
||||
frm()->GetBookmarkManager().GetEditSession().SetCategoryAccessRules(
|
||||
static_cast<kml::MarkGroupId>(catId), static_cast<kml::AccessRules>(accessRules));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetCategoryCustomProperty(
|
||||
JNIEnv * env, jobject, jlong catId, jstring key, jstring value)
|
||||
{
|
||||
frm()->GetBookmarkManager().GetEditSession().SetCategoryCustomProperty(
|
||||
static_cast<kml::MarkGroupId>(catId), ToNativeString(env, key), ToNativeString(env, value));
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeUpdateBookmarkPlacePage(
|
||||
JNIEnv * env, jobject, jlong bmkId)
|
||||
{
|
||||
if (!frm()->HasPlacePageInfo())
|
||||
return nullptr;
|
||||
|
||||
auto & info = g_framework->GetPlacePageInfo();
|
||||
auto buildInfo = info.GetBuildInfo();
|
||||
buildInfo.m_userMarkId = static_cast<kml::MarkId>(bmkId);
|
||||
frm()->UpdatePlacePageInfoForCurrentSelection(buildInfo);
|
||||
|
||||
return usermark_helper::CreateMapObject(env, g_framework->GetPlacePageInfo());
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkInfo(
|
||||
JNIEnv * env, jobject, jlong bmkId)
|
||||
{
|
||||
auto const bookmark = frm()->GetBookmarkManager().GetBookmark(static_cast<kml::MarkId>(bmkId));
|
||||
if (!bookmark)
|
||||
return nullptr;
|
||||
return env->NewObject(g_bookmarkInfoClass,
|
||||
g_bookmarkInfoConstructor, static_cast<jlong>(bookmark->GetGroupId()),
|
||||
static_cast<jlong>(bmkId));
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkIdByPosition(
|
||||
JNIEnv *, jobject, jlong catId, jint positionInCategory)
|
||||
{
|
||||
auto const & ids = frm()->GetBookmarkManager().GetUserMarkIds(static_cast<kml::MarkGroupId>(catId));
|
||||
if (positionInCategory >= static_cast<jlong>(ids.size()))
|
||||
return static_cast<jlong>(kml::kInvalidMarkId);
|
||||
auto it = ids.begin();
|
||||
std::advance(it, positionInCategory);
|
||||
return static_cast<jlong>(*it);
|
||||
}
|
||||
|
||||
static uint32_t shift(uint32_t v, uint8_t bitCount) { return v << bitCount; }
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetTrack(
|
||||
JNIEnv * env, jobject, jlong trackId, jclass trackClazz)
|
||||
{
|
||||
// Track(long trackId, long categoryId, String name, String lengthString, int color)
|
||||
static jmethodID const cId = jni::GetConstructorID(env, trackClazz,
|
||||
"(JJLjava/lang/String;Lapp/organicmaps/sdk/util/Distance;I)V");
|
||||
auto const * nTrack = frm()->GetBookmarkManager().GetTrack(static_cast<kml::TrackId>(trackId));
|
||||
|
||||
ASSERT(nTrack, ("Track must not be null with id:)", trackId));
|
||||
|
||||
dp::Color nColor = nTrack->GetColor(0);
|
||||
|
||||
jint androidColor = shift(nColor.GetAlpha(), 24) +
|
||||
shift(nColor.GetRed(), 16) +
|
||||
shift(nColor.GetGreen(), 8) +
|
||||
nColor.GetBlue();
|
||||
|
||||
return env->NewObject(trackClazz, cId,
|
||||
trackId, static_cast<jlong>(nTrack->GetGroupId()), jni::ToJavaString(env, nTrack->GetName()),
|
||||
ToJavaDistance(env, platform::Distance::CreateFormatted(nTrack->GetLengthMeters())), androidColor);
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetTrackIdByPosition(
|
||||
JNIEnv *, jobject, jlong catId, jint positionInCategory)
|
||||
{
|
||||
auto const & ids = frm()->GetBookmarkManager().GetTrackIds(static_cast<kml::MarkGroupId>(catId));
|
||||
if (positionInCategory >= static_cast<jlong>(ids.size()))
|
||||
return static_cast<jlong>(kml::kInvalidTrackId);
|
||||
auto it = ids.begin();
|
||||
std::advance(it, positionInCategory);
|
||||
return static_cast<jlong>(*it);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeIsUsedCategoryName(
|
||||
JNIEnv * env, jclass, jstring name)
|
||||
{
|
||||
return static_cast<jboolean>(frm()->GetBookmarkManager().IsUsedCategoryName(ToNativeString(env, name)));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativePrepareForSearch(
|
||||
JNIEnv *, jclass, jlong catId)
|
||||
{
|
||||
frm()->GetBookmarkManager().PrepareForSearch(static_cast<kml::MarkGroupId>(catId));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeAreAllCategoriesInvisible(
|
||||
JNIEnv *, jclass)
|
||||
{
|
||||
return static_cast<jboolean>(frm()->GetBookmarkManager().AreAllCategoriesInvisible());
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeAreAllCategoriesVisible(
|
||||
JNIEnv *, jclass)
|
||||
{
|
||||
return static_cast<jboolean>(frm()->GetBookmarkManager().AreAllCategoriesVisible());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetAllCategoriesVisibility(
|
||||
JNIEnv *, jclass, jboolean visible)
|
||||
{
|
||||
frm()->GetBookmarkManager().SetAllCategoriesVisibility(static_cast<bool>(visible));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativePrepareTrackFileForSharing(JNIEnv * env, jclass, jlong trackId, jint kmlFileType)
|
||||
{
|
||||
frm()->GetBookmarkManager().PrepareTrackFileForSharing(static_cast<kml::TrackId>(trackId), [env](BookmarkManager::SharingResult const & result)
|
||||
{
|
||||
OnPreparedFileForSharing(env, result);
|
||||
}, static_cast<KmlFileType>(kmlFileType));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativePrepareFileForSharing(JNIEnv * env, jclass, jlongArray catIds, jint kmlFileType)
|
||||
{
|
||||
auto const size = env->GetArrayLength(catIds);
|
||||
kml::GroupIdCollection catIdsVector(size);
|
||||
static_assert(sizeof(jlong) == sizeof(decltype(catIdsVector)::value_type));
|
||||
env->GetLongArrayRegion(catIds, 0, size, reinterpret_cast<jlong *>(catIdsVector.data()));
|
||||
frm()->GetBookmarkManager().PrepareFileForSharing(std::move(catIdsVector), [env](BookmarkManager::SharingResult const & result)
|
||||
{
|
||||
OnPreparedFileForSharing(env, result);
|
||||
}, static_cast<KmlFileType>(kmlFileType));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeIsCategoryEmpty(
|
||||
JNIEnv *, jclass, jlong catId)
|
||||
{
|
||||
return static_cast<jboolean>(frm()->GetBookmarkManager().IsCategoryEmpty(
|
||||
static_cast<kml::MarkGroupId>(catId)));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetNotificationsEnabled(
|
||||
JNIEnv *, jclass, jboolean enabled)
|
||||
{
|
||||
frm()->GetBookmarkManager().SetNotificationsEnabled(static_cast<bool>(enabled));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeAreNotificationsEnabled(
|
||||
JNIEnv *, jclass)
|
||||
{
|
||||
return static_cast<jboolean>(frm()->GetBookmarkManager().AreNotificationsEnabled());
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkCategory(JNIEnv *env, jobject, jlong id)
|
||||
{
|
||||
return MakeCategory(env, static_cast<kml::MarkGroupId>(id));
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkCategories(JNIEnv *env, jobject)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
auto const & ids = bm.GetSortedBmGroupIdList();
|
||||
|
||||
return MakeCategories(env, ids);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkCategoriesCount(JNIEnv *env, jobject)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
auto const count = bm.GetBmGroupsCount();
|
||||
|
||||
return static_cast<jint>(count);
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetChildrenCategories(JNIEnv *env, jobject, jlong parentId)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
auto const ids = bm.GetChildrenCategories(static_cast<kml::MarkGroupId>(parentId));
|
||||
|
||||
return MakeCategories(env, ids);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeHasLastSortingType(
|
||||
JNIEnv *, jobject, jlong catId)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
BookmarkManager::SortingType type;
|
||||
return static_cast<jboolean>(bm.GetLastSortingType(static_cast<kml::MarkGroupId>(catId), type));
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetLastSortingType(
|
||||
JNIEnv *, jobject, jlong catId)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
BookmarkManager::SortingType type;
|
||||
auto const hasType = bm.GetLastSortingType(static_cast<kml::MarkGroupId>(catId), type);
|
||||
ASSERT(hasType, ());
|
||||
UNUSED_VALUE(hasType);
|
||||
return static_cast<jint>(type);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetLastSortingType(
|
||||
JNIEnv *, jobject, jlong catId, jint type)
|
||||
{
|
||||
auto & bm = frm()->GetBookmarkManager();
|
||||
bm.SetLastSortingType(static_cast<kml::MarkGroupId>(catId),
|
||||
static_cast<BookmarkManager::SortingType>(type));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeResetLastSortingType(
|
||||
JNIEnv *, jobject, jlong catId)
|
||||
{
|
||||
auto & bm = frm()->GetBookmarkManager();
|
||||
bm.ResetLastSortingType(static_cast<kml::MarkGroupId>(catId));
|
||||
}
|
||||
|
||||
JNIEXPORT jintArray JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetAvailableSortingTypes(JNIEnv *env,
|
||||
jobject, jlong catId, jboolean hasMyPosition)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
auto const types = bm.GetAvailableSortingTypes(static_cast<kml::MarkGroupId>(catId),
|
||||
static_cast<bool>(hasMyPosition));
|
||||
int const size = static_cast<int>(types.size());
|
||||
jintArray jTypes = env->NewIntArray(size);
|
||||
jint * arr = env->GetIntArrayElements(jTypes, 0);
|
||||
for (int i = 0; i < size; ++i)
|
||||
arr[i] = static_cast<int>(types[i]);
|
||||
env->ReleaseIntArrayElements(jTypes, arr, 0);
|
||||
|
||||
return jTypes;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetSortedCategory(JNIEnv *env,
|
||||
jobject, jlong catId, jint sortingType, jboolean hasMyPosition, jdouble lat, jdouble lon,
|
||||
jlong timestamp)
|
||||
{
|
||||
auto & bm = frm()->GetBookmarkManager();
|
||||
BookmarkManager::SortParams sortParams;
|
||||
sortParams.m_groupId = static_cast<kml::MarkGroupId>(catId);
|
||||
sortParams.m_sortingType = static_cast<BookmarkManager::SortingType>(sortingType);
|
||||
sortParams.m_hasMyPosition = static_cast<bool>(hasMyPosition);
|
||||
sortParams.m_myPosition = mercator::FromLatLon(static_cast<double>(lat),
|
||||
static_cast<double>(lon));
|
||||
sortParams.m_onResults = bind(&OnCategorySortingResults, env, timestamp, _1, _2);
|
||||
|
||||
bm.GetSortedCategory(sortParams);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkName(
|
||||
JNIEnv * env, jclass, jlong bmk)
|
||||
{
|
||||
return jni::ToJavaString(env, getBookmark(bmk)->GetPreferredName());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkFeatureType(
|
||||
JNIEnv * env, jclass, jlong bmk)
|
||||
{
|
||||
return jni::ToJavaString(env,
|
||||
kml::GetLocalizedFeatureType(getBookmark(bmk)->GetData().m_featureTypes));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkDescription(
|
||||
JNIEnv * env, jclass, jlong bmk)
|
||||
{
|
||||
return jni::ToJavaString(env, getBookmark(bmk)->GetDescription());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkColor(
|
||||
JNIEnv *, jclass, jlong bmk)
|
||||
{
|
||||
auto const * mark = getBookmark(bmk);
|
||||
return static_cast<jint>(mark != nullptr ? mark->GetColor()
|
||||
: frm()->LastEditedBMColor());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkIcon(
|
||||
JNIEnv *, jclass, jlong bmk)
|
||||
{
|
||||
auto const * mark = getBookmark(bmk);
|
||||
return static_cast<jint>(mark != nullptr ? mark->GetData().m_icon
|
||||
: kml::BookmarkIcon::None);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetBookmarkParams(
|
||||
JNIEnv * env, jclass, jlong bmk,
|
||||
jstring name, jint color, jstring descr)
|
||||
{
|
||||
auto const * mark = getBookmark(bmk);
|
||||
|
||||
// initialize new bookmark
|
||||
kml::BookmarkData bmData(mark->GetData());
|
||||
auto const bmName = jni::ToNativeString(env, name);
|
||||
if (mark->GetPreferredName() != bmName)
|
||||
kml::SetDefaultStr(bmData.m_customName, bmName);
|
||||
if (descr)
|
||||
kml::SetDefaultStr(bmData.m_description, jni::ToNativeString(env, descr));
|
||||
bmData.m_color.m_predefinedColor = static_cast<kml::PredefinedColor>(color);
|
||||
|
||||
g_framework->ReplaceBookmark(static_cast<kml::MarkId>(bmk), bmData);
|
||||
}
|
||||
|
||||
constexpr static uint8_t ExtractByte(uint32_t number, uint8_t byteIdx) { return (number >> (8 * byteIdx)) & 0xFF; }
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetTrackParams(
|
||||
JNIEnv * env, jclass, jlong trackId,
|
||||
jstring name, jint color, jstring descr)
|
||||
{
|
||||
auto const * nTrack = frm()->GetBookmarkManager().GetTrack(static_cast<kml::TrackId>(trackId));
|
||||
CHECK(nTrack, ("Track must not be null with id:", trackId));
|
||||
|
||||
kml::TrackData trackData(nTrack->GetData());
|
||||
auto const trkName = jni::ToNativeString(env, name);
|
||||
kml::SetDefaultStr(trackData.m_name, trkName);
|
||||
kml::SetDefaultStr(trackData.m_description, jni::ToNativeString(env, descr));
|
||||
|
||||
uint8_t alpha = ExtractByte(color, 3);
|
||||
trackData.m_layers[0].m_color.m_rgba = static_cast<uint32_t>(shift(color,8) + alpha);
|
||||
|
||||
g_framework->ReplaceTrack(static_cast<kml::TrackId>(trackId), trackData);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetTrackDescription(
|
||||
JNIEnv * env, jclass, jlong trackId)
|
||||
{
|
||||
return jni::ToJavaString(env, frm()->GetBookmarkManager().GetTrack(static_cast<kml::TrackId>(trackId))->GetDescription());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeChangeBookmarkCategory(
|
||||
JNIEnv *, jclass, jlong oldCat, jlong newCat, jlong bmk)
|
||||
{
|
||||
g_framework->MoveBookmark(static_cast<kml::MarkId>(bmk), static_cast<kml::MarkGroupId>(oldCat),
|
||||
static_cast<kml::MarkGroupId>(newCat));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeChangeTrackCategory(
|
||||
JNIEnv *, jclass, jlong oldCat, jlong newCat, jlong trackId)
|
||||
{
|
||||
g_framework->MoveTrack(static_cast<kml::TrackId>(trackId), static_cast<kml::MarkGroupId>(oldCat),
|
||||
static_cast<kml::MarkGroupId>(newCat));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeChangeTrackColor(
|
||||
JNIEnv *, jclass, jlong trackId, jint color)
|
||||
{
|
||||
uint8_t alpha = ExtractByte(color, 3);
|
||||
g_framework->ChangeTrackColor(static_cast<kml::TrackId>(trackId), static_cast<dp::Color>(shift(color,8) + alpha));
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkXY(
|
||||
JNIEnv * env, jclass, jlong bmk)
|
||||
{
|
||||
return jni::GetNewParcelablePointD(env, getBookmark(bmk)->GetPivot());
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkScale(
|
||||
JNIEnv *, jclass, jlong bmk)
|
||||
{
|
||||
return getBookmark(bmk)->GetScale();
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeEncode2Ge0Url(
|
||||
JNIEnv * env, jclass, jlong bmk, jboolean addName)
|
||||
{
|
||||
return jni::ToJavaString(env, frm()->CodeGe0url(getBookmark(bmk), addName));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetBookmarkAddress(
|
||||
JNIEnv * env, jclass, jlong bmkId)
|
||||
{
|
||||
auto const address = frm()->GetAddressAtPoint(getBookmark(bmkId)->GetPivot()).FormatAddress();
|
||||
return jni::ToJavaString(env, address);
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetElevationCurPositionDistance(
|
||||
JNIEnv *, jclass, jlong trackId)
|
||||
{
|
||||
auto const & bm = frm()->GetBookmarkManager();
|
||||
return static_cast<jdouble>(bm.GetElevationMyPosition(static_cast<kml::TrackId>(trackId)));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetElevationCurrentPositionChangedListener(
|
||||
JNIEnv * env, jclass)
|
||||
{
|
||||
frm()->GetBookmarkManager().SetElevationMyPositionChangedCallback(
|
||||
std::bind(&OnElevationCurPositionChanged, env));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeRemoveElevationCurrentPositionChangedListener(
|
||||
JNIEnv *, jclass)
|
||||
{
|
||||
frm()->GetBookmarkManager().SetElevationMyPositionChangedCallback(nullptr);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetElevationActivePoint(
|
||||
JNIEnv *, jclass, jlong trackId, jdouble distanceInMeters)
|
||||
{
|
||||
auto & bm = frm()->GetBookmarkManager();
|
||||
bm.SetElevationActivePoint(static_cast<kml::TrackId>(trackId),
|
||||
{0,0}, // todo(KK): replace with coordinates from the elevation profile point to show selection mark on the track
|
||||
static_cast<double>(distanceInMeters));
|
||||
}
|
||||
|
||||
JNIEXPORT jdouble JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeGetElevationActivePointDistance(
|
||||
JNIEnv *, jclass, jlong trackId)
|
||||
{
|
||||
auto & bm = frm()->GetBookmarkManager();
|
||||
return static_cast<jdouble>(bm.GetElevationActivePoint(static_cast<kml::TrackId>(trackId)));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeSetElevationActiveChangedListener(
|
||||
JNIEnv *env, jclass)
|
||||
{
|
||||
frm()->GetBookmarkManager().SetElevationActivePointChangedCallback(std::bind(&OnElevationActivePointChanged, env));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_sdk_bookmarks_data_BookmarkManager_nativeRemoveElevationActiveChangedListener(
|
||||
JNIEnv *, jclass)
|
||||
{
|
||||
frm()->GetBookmarkManager().SetElevationActivePointChangedCallback(nullptr);
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_app_organicmaps_sdk_widget_placepage_PlacePageButtonFactory_nativeHasRecentlyDeletedBookmark(JNIEnv *, jclass)
|
||||
{
|
||||
return frm()->GetBookmarkManager().HasRecentlyDeletedBookmark();
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace jni
|
||||
{
|
||||
void InitSystemLog();
|
||||
void InitAssertLog();
|
||||
void ToggleDebugLogs(bool enabled);
|
||||
}
|
||||