Skip to content

Commit 3296996

Browse files
authored
Version 2025.02
Merge pull request #516 from labexp/develop
2 parents 184c600 + d34b0b5 commit 3296996

File tree

178 files changed

+2921
-1530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+2921
-1530
lines changed

.github/workflows/android.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
- name: Grant execute permission for gradlew
2828
run: chmod +x gradlew
2929

30-
- name: Build with Gradle # skip tests, coverage, etc.
31-
run: ./gradlew assembleDebug --stacktrace -x test
30+
- name: Build with Gradle
31+
run: ./gradlew assembleDebug --stacktrace
3232

3333
- name: Rename output APK
3434
run: |
@@ -41,3 +41,25 @@ jobs:
4141
with:
4242
name: debug-${{ env.ARTIFACT_DATE }}
4343
path: app/build/outputs/apk/debug/OSMTracker-debug-*.apk
44+
45+
- name: Run unit tests and jacoco coverage
46+
run: ./gradlew testDebugUnitTest jacocoTestReport --stacktrace
47+
48+
- name: Enable KVM
49+
run: |
50+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
51+
sudo udevadm control --reload-rules
52+
sudo udevadm trigger --name-match=kvm
53+
54+
- name: Run connected tests
55+
uses: ReactiveCircus/android-emulator-runner@v2
56+
with:
57+
api-level: 26
58+
script: |
59+
adb logcat &
60+
./gradlew connectedCheck --no-parallel
61+
62+
- name: Coveralls GitHub Action
63+
uses: coverallsapp/github-action@v2
64+
with:
65+
format: jacoco

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
1+
# OSMTracker for Android™
2+
3+
![Build](https://github.com/labexp/osmtracker-android/actions/workflows/android.yml/badge.svg?branch=develop)
4+
[![Coverage Status](https://coveralls.io/repos/github/labexp/osmtracker-android/badge.svg?branch=develop)](https://coveralls.io/github/labexp/osmtracker-android?branch=develop)
5+
6+
**OSMTracker for Android™** is a mobile app designed for OpenStreetMap mappers and outdoor adventurers. It lets you log a GPS track to document your journey. Its customizable buttons let you simply add POIs as track points directly inside your GPX track.
7+
8+
It also supports voice recording, picture taking, and note-taking. This is the perfect app to survey a place or a path whether you are hiking, cycling, or exploring new areas.
9+
10+
![Main screen](https://wiki.openstreetmap.org/w/images/thumb/7/7b/OSMTracker-Android-main-screen-en.jpg/200px-OSMTracker-Android-main-screen-en.jpg)
11+
12+
Here is a screenshot of the main screen with its default buttons. You can [customize](https://github.com/labexp/osmtracker-android/wiki/Custom-buttons-layouts) these buttons to your liking.
13+
14+
## Get the App 📲
15+
116
[<img alt='Get it on Google Play' src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png' height="80"/>](https://play.google.com/store/apps/details?id=net.osmtracker)
217
[<img src="https://f-droid.org/badge/get-it-on.png" alt="Get it on F-Droid" height="80">](https://f-droid.org/app/net.osmtracker)
318

4-
OSMTracker for Android™ official source code repository is [https://github.com/labexp/osmtracker-android](https://github.com/labexp/osmtracker-android).
19+
## More Info ℹ️
520

6-
[![Build Status](https://travis-ci.org/labexp/osmtracker-android.svg?branch=master)](https://travis-ci.org/labexp/osmtracker-android)
21+
- Find more information in the [documentation](https://github.com/labexp/osmtracker-android/wiki)
22+
- Submit bug reports in the [issue tracker](https://github.com/labexp/osmtracker-android/issues)
23+
- Contributions are welcome, please visit our [contributor guide](https://github.com/labexp/osmtracker-android/blob/master/CONTRIBUTING.md)
24+
- Translations can be done on [Transifex](https://explore.transifex.com/labexp/osmtracker-android/)
725

8-
For more information about the project, documentation and bug reports please visit https://github.com/labexp/osmtracker-android/wiki
26+
## Note 📝
927

10-
If you are interested in contribute to this project, please visit https://github.com/labexp/osmtracker-android/blob/master/CONTRIBUTING.md to know the way you could do it.
11-
12-
To help translate OSMTracker, please visit https://www.transifex.com/projects/p/osmtracker-android/
28+
OSMTracker for Android™ official source code repository is [https://github.com/labexp/osmtracker-android](https://github.com/labexp/osmtracker-android).

app/build.gradle

Lines changed: 83 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,47 @@
1-
apply plugin: 'com.android.application'
2-
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
id 'jacoco'
5+
}
46

57
android {
6-
7-
useLibrary 'org.apache.http.legacy'
8-
compileSdk 33
8+
namespace 'net.osmtracker'
9+
compileSdk 35
910

1011
defaultConfig {
1112
applicationId "net.osmtracker"
12-
minSdkVersion 25
13-
targetSdkVersion 33
13+
minSdk 25
14+
targetSdk 35
1415
multiDexEnabled true
1516

17+
// Version code should be increased after each release
18+
versionCode 65
19+
versionName new Date().format('yyyy.MM.dd')
20+
1621
testApplicationId "net.osmtracker.test"
17-
testInstrumentationRunner "android.test.InstrumentationTestRunner"
22+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23+
}
24+
25+
buildTypes {
26+
release {
27+
minifyEnabled false
28+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29+
signingConfig signingConfigs.findByName('release')
30+
}
31+
debug {
32+
versionNameSuffix "-dev"
33+
}
34+
}
35+
36+
compileOptions {
37+
sourceCompatibility JavaVersion.VERSION_17
38+
targetCompatibility JavaVersion.VERSION_17
39+
}
40+
kotlinOptions {
41+
jvmTarget = JavaVersion.VERSION_17
1842
}
1943

2044
signingConfigs {
21-
// Create a file $HOME/.gradle/gradle.properties
22-
// containing the values signing.storeFile=..., etc.
2345
if (project.hasProperty('signing.storeFile')) {
2446
release {
2547
storeFile file(project.property('signing.storeFile'))
@@ -30,92 +52,72 @@ android {
3052
}
3153
}
3254

33-
buildTypes {
34-
release {
35-
minifyEnabled false
36-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
37-
if (signingConfigs.hasProperty('release')) {
38-
signingConfig signingConfigs.release
39-
}
40-
41-
42-
}
43-
}
44-
4555
packagingOptions {
46-
exclude 'META-INF/DEPENDENCIES'
47-
exclude 'META-INF/LICENSE.txt'
48-
exclude 'META-INF/NOTICE.txt'
49-
}
50-
android {
51-
lintOptions {
52-
abortOnError false
53-
}
56+
resources.excludes += [
57+
'META-INF/DEPENDENCIES',
58+
'META-INF/LICENSE.txt',
59+
'META-INF/NOTICE.txt'
60+
]
5461
}
55-
56-
defaultConfig {
57-
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
58-
}
59-
6062
testOptions {
6163
unitTests.returnDefaultValues = true
64+
unitTests.all {
65+
it.jvmArgs = [
66+
'--add-opens', 'java.base/java.io=ALL-UNNAMED',
67+
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
68+
'--add-opens', 'java.base/java.lang.reflect=ALL-UNNAMED',
69+
'--add-opens', 'java.base/java.util=ALL-UNNAMED'
70+
]
71+
}
6272
animationsDisabled = true
6373
}
64-
namespace 'net.osmtracker'
65-
6674
}
6775

6876
dependencies {
69-
70-
//implementation 'org.apache.james:apache-mime4j-core:0.8.3'
71-
72-
//implementation 'org.apache.httpcomponents:httpmime:4.5.6'
73-
74-
implementation 'org.osmdroid:osmdroid-android:6.1.5'
75-
//implementation 'org.apache.httpcomponents:httpcore:4.4.13'
76-
77-
//implementation 'oauth.signpost:signpost-commonshttp4:1.2.1.2'
78-
implementation 'org.slf4j:slf4j-android:1.7.30'
79-
implementation 'androidx.core:core:1.6.0'
80-
//implementation 'org.apache.commons:commons-io:1.3.2'
81-
82-
// For upload traces to osm server
77+
// Lib to show OSM map as background
78+
implementation 'org.osmdroid:osmdroid-android:6.1.20'
79+
// OAuth
8380
implementation 'net.openid:appauth:0.11.1'
84-
implementation 'de.westnordost:osmapi-traces:3.1'
85-
86-
// Required for local unit tests (JUnit 4 framework)
87-
testImplementation 'junit:junit:4.12'
88-
testImplementation 'org.mockito:mockito-core:2.4.0'
81+
// For upload traces to osm server
82+
implementation('de.westnordost:osmapi-traces:3.1') {
83+
// Already included in Android
84+
exclude group: 'net.sf.kxml', module: 'kxml2'
85+
exclude group: 'xmlpull', module: 'xmlpull'
86+
}
87+
// App intro
88+
implementation 'com.github.AppIntro:AppIntro:6.3.1'
8989

90-
testImplementation 'org.powermock:powermock-core:1.7.0RC2'
91-
testImplementation 'org.powermock:powermock-module-junit4:1.7.0RC2'
92-
testImplementation 'org.powermock:powermock-api-mockito2:1.7.0RC2'
90+
implementation 'com.google.android.material:material:1.12.0'
91+
implementation 'org.slf4j:slf4j-android:1.7.30'
92+
implementation 'org.apache.commons:commons-io:1.3.2'
93+
implementation 'androidx.core:core:1.15.0'
94+
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
95+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
96+
implementation 'androidx.appcompat:appcompat:1.7.0'
97+
98+
// Required -- JUnit 4 framework
99+
testImplementation 'junit:junit:4.13.2'
100+
// Robolectric environment
101+
testImplementation "androidx.test:core:1.6.1"
102+
// Mockito framework
103+
testImplementation "org.mockito:mockito-core:3.12.4"
104+
105+
testImplementation 'org.powermock:powermock-core:2.0.9'
106+
testImplementation 'org.powermock:powermock-api-mockito2:2.0.9'
107+
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'
108+
// Required for local unit tests. Prevent null in JSONObject, JSONArray, etc.
109+
testImplementation 'org.json:json:20240303'
93110

94111
// Required for instrumented tests
95-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
96-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
97-
androidTestImplementation 'androidx.test:rules:1.4.0'
98-
99-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
100-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
101-
implementation 'androidx.appcompat:appcompat:1.3.0'
102-
103-
//compileOnly 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
104-
105-
// AndroidX Capable version
106-
implementation 'com.github.AppIntro:AppIntro:6.0.0'
107-
implementation 'com.google.android.material:material:1.4.0'
108-
109-
110-
}
111-
112-
configurations.all {
113-
// it's already included in Android and not need from osmapi
114-
exclude group:'net.sf.kxml', module:'kxml2'
115-
exclude group: 'xmlpull', module: 'xmlpull'
112+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
113+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
114+
androidTestImplementation 'androidx.test:rules:1.6.1'
116115
}
117116

118117
repositories {
118+
google()
119119
mavenCentral()
120120
maven { url "https://jitpack.io" }
121121
}
122+
123+
apply from: "jacoco.gradle"

app/jacoco.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
jacoco {
2+
toolVersion = jacocoVersion
3+
}
4+
5+
tasks.withType(Test).configureEach {
6+
jacoco.includeNoLocationClasses = true
7+
jacoco.excludes = ['jdk.internal.*']
8+
}
9+
10+
tasks.register("jacocoTestReport", JacocoReport) {
11+
dependsOn testDebugUnitTest
12+
13+
reports {
14+
xml.required = true
15+
}
16+
17+
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*']
18+
def mainSrc = "${project.projectDir}/src/main/java"
19+
20+
sourceDirectories.setFrom(files([mainSrc]))
21+
classDirectories.setFrom(fileTree(dir: layout.buildDirectory.dir("intermediates/javac/debug").get().asFile, excludes: fileFilter))
22+
executionData.setFrom(fileTree(dir: layout.buildDirectory.get(), includes: [
23+
'jacoco/testDebugUnitTest.exec', 'outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec'
24+
]))
25+
}

app/src/androidTest/java/net/osmtracker/layouts/DeleteLayoutTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.osmtracker.activity.ButtonsPresets;
99
import net.osmtracker.activity.Preferences;
1010
import net.osmtracker.util.CustomLayoutsUtils;
11+
import net.osmtracker.util.TestUtils;
1112

1213
import org.junit.Rule;
1314
import org.junit.Test;
@@ -32,6 +33,9 @@
3233

3334
public class DeleteLayoutTest {
3435

36+
@Rule
37+
public GrantPermissionRule storagePermission = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE);
38+
3539
@Rule
3640
public ActivityTestRule<ButtonsPresets> mRule = new ActivityTestRule(ButtonsPresets.class) {
3741
@Override
@@ -47,10 +51,6 @@ protected void beforeActivityLaunched() {
4751
}
4852
};
4953

50-
// Storage permissions are required
51-
@Rule
52-
public GrantPermissionRule writePermission = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE);
53-
5454
private static String layoutName = "mock";
5555
private static String ISOLanguageCode = "es";
5656

0 commit comments

Comments
 (0)