Compare commits

...

16 commits

Author SHA1 Message Date
dc3f3f5ac3 Add inset fallback if insets are not used, add exit functionality 2025-09-03 01:09:19 +02:00
1180d3cfdd Attempt to support lower android versions too 2025-09-03 01:09:05 +02:00
ea7cadde4e Attempt to support lower android versions too 2025-09-03 00:17:20 +02:00
817e8198b5 Formatting 2025-08-20 14:28:48 +02:00
5f0fb91b49 Fix build script 2025-08-19 18:23:52 +02:00
b0824407b1 Fix build script 2025-08-19 17:37:30 +02:00
19cc005d60 Merge pull request 'Enable EdgeToEdge mode by default' (#2) from feature/edge-to-edge into main
Reviewed-on: #2
Reviewed-by: Pieter Vander Vennet <pietervdvn@posteo.net>
2025-08-15 10:21:02 +00:00
c15e95245e
Enable EdgeToEdge mode by default, also on android versions lower that 15 2025-08-11 11:50:57 +02:00
8253f92149 Merge pull request 'Fix spelling in application description' (#1) from midgard/mapcomplete-android-wrapper:main into main
Reviewed-on: #1
2025-07-22 16:05:37 +00:00
3aa85d562e
Fix spelling in application description
And reword the line about images for clarity
2025-07-22 16:58:36 +02:00
a48aaffec4 Disable insets unless android >= 15 2025-07-21 22:28:13 +02:00
bdbf551132 Disable insets unless android >= 15 2025-07-21 22:14:07 +02:00
4bb7346a3b Add automatic builds for lower android versions 2025-07-21 21:15:53 +02:00
17f87a9611 Revert "Reverse min and target SDK version"
This reverts commit b7b29d20e4.
2025-07-21 20:17:34 +02:00
b7b29d20e4 Reverse min and target SDK version 2025-07-20 16:34:22 +02:00
3e5101aab8 Also support lower android version 2025-07-17 16:50:39 +02:00
6 changed files with 100 additions and 41 deletions

View file

@ -44,17 +44,20 @@ jobs:
export keyPassword=${{ secrets.KEY_PASSWORD }}
./gradlew build
./gradlew assembleRelease
rm -rf app/build/outputs/apk/release/baselineProfiles
rm -rf app/build/outputs/apk/release/output-metadata.json
- name: Upload APK to hetzner
shell: bash
run: |
TAG=$( echo ${{ env.GITHUB_REF_NAME }} )
scp app/build/outputs/apk/release/app-release.apk hetzner:~/public/apk/mapcomplete-$TAG.apk
if [[ ! $tag =~ -sfw$ ]]; then
ssh hetzner 'rm -f public/apk/mapcomplete-latest.apk && cp "public/apk/$(ls -v public/apk/ | tail -n 1)" public/apk/mapcomplete-latest.apk'
fi
# Build versions for legacy versions
./scripts/compile_version.sh $TAG 9-PIE 28
./scripts/compile_version.sh $TAG 10-QUINCE-TART 29
./scripts/compile_version.sh $TAG 11-RED-VELVET-CAKE 30
./scripts/compile_version.sh $TAG 12-SNOW-CONE 31
./scripts/compile_version.sh $TAG 13-TIRAMISU 32
- name: clean intermediate files
run: |
rm -rf app/build/outputs/apk/release/baselineProfiles
rm -rf app/build/outputs/apk/release/output-metadata.json
- name: Upload APK to forgejo releases (MapComplete)
uses: https://source.mapcomplete.org/actions/forgejo-release@v2.6.0

View file

@ -5,9 +5,9 @@ android {
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "org.mapcomplete"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 9
minSdk 28
targetSdkVersion 35
versionCode 10
versionName "debug"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
@ -75,3 +75,9 @@ try {
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<uses-sdk tools:overrideLibrary="com.getcapacitor.android, capacitor.cordova.android.plugins" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"

View file

@ -11,6 +11,7 @@ import android.view.Window;
import android.view.WindowInsets;
import android.window.OnBackInvokedDispatcher;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
@ -19,7 +20,7 @@ import androidx.core.view.WindowCompat;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.JSObject;
import com.getcapacitor.PluginCall;
import android.app.Activity;
public class MainActivity extends BridgeActivity {
private PluginCall locationRequest = null;
@ -66,19 +67,37 @@ public class MainActivity extends BridgeActivity {
responder.setKeepAlive(true);
});
Databridge.addResponder("exit", responder -> {
Log.i("databridge","got exit request");
finishAffinity();
});
super.onCreate(savedInstanceState);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
EdgeToEdge.enable(this);
var useInsets = Build.VERSION.SDK_INT > Build.VERSION_CODES.UPSIDE_DOWN_CAKE;
Log.i("Insets","Using insets:"+useInsets+", sdk_int:"+Build.VERSION.SDK_INT+" "+Build.VERSION_CODES.UPSIDE_DOWN_CAKE);
WindowCompat.setDecorFitsSystemWindows(getWindow(), !useInsets);
if(useInsets) {
Databridge.addResponder("insets", (responder) -> {
var view = getWindow().getDecorView();
var insets = view.getRootWindowInsets();
var topInsetPxSize= insets.getInsetsIgnoringVisibility(WindowInsets.Type.statusBars()).top;
var bottomInsetPxSize= insets.getInsetsIgnoringVisibility(WindowInsets.Type.navigationBars()).bottom;
var topInsetPxSize = insets.getInsetsIgnoringVisibility(WindowInsets.Type.statusBars()).top;
var bottomInsetPxSize = insets.getInsetsIgnoringVisibility(WindowInsets.Type.navigationBars()).bottom;
var json = "{ \"top\": "+topInsetPxSize+", \"bottom\":"+bottomInsetPxSize+"}";
Log.i("insets","Inset sizes are:"+topInsetPxSize+" bottom:"+ bottomInsetPxSize);
var json = "{ \"top\": " + topInsetPxSize + ", \"bottom\":" + bottomInsetPxSize + "}";
Log.i("insets", "Inset sizes are:" + topInsetPxSize + " bottom:" + bottomInsetPxSize);
Databridge.sendAnswerTo(responder, json);
});
}else{
Log.i("insets","Not enabling insets, version to low");
Databridge.addResponder("insets", (responder) -> {
var json = "{ \"top\": 0, \"bottom\": 0}";
Databridge.sendAnswerTo(responder, json);
});
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
getOnBackInvokedDispatcher().registerOnBackInvokedCallback(OnBackInvokedDispatcher.PRIORITY_OVERLAY,
() -> {
System.out.println("Back button pressed");
@ -88,6 +107,21 @@ public class MainActivity extends BridgeActivity {
}
);
}
}
@Override
public void onBackPressed() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
System.out.println("Back button pressed (old)");
if (this.backbutton != null) {
Databridge.sendAnswerTo(this.backbutton, "backbutton pressed");
}
}else{
super.onBackPressed();
}
}
private boolean hasGeolocationPermission() {

View file

@ -1,15 +1,15 @@
MapComplete has more then 70 maps, each showing features withing a certain topic. For example:
MapComplete has more than 70 maps, each showing features within a certain topic. For example:
- Restaurants, including information about vegan, vegetarian, glutenfree and lactosefree options
- Restaurants, including information about vegan, vegetarian, gluten-free and lactose-free options
- Shops
- healthcare providers such as doctors, pharmacies, dentists, physical therapists,...
- Healthcare providers such as doctors, pharmacies, dentists, physical therapists...
- Vending machines
- Drinking water fountains
- Public bookcases
- Public toilets
- Defibrillators (AED)
- Defibrillators (AEDs)
- Bicycle pumps and bicycle shops
- Artworks and status
- Artworks and statues
- Benches
- Waste baskets and containers
- Pubs
@ -17,7 +17,7 @@ MapComplete has more then 70 maps, each showing features withing a certain topic
- Charging stations
- Surveillance cameras
- Advertisement billboards
- cClimbing gyms
- Climbing gyms
- Schools
- Memorials
- Hackerspaces
@ -25,6 +25,5 @@ MapComplete has more then 70 maps, each showing features withing a certain topic
When selecting an item, all the relevant information is shown in a user-friendly way. Unknown information can be easily added by answering the questions, which will be saved into OpenStreetMap directly (this requires a free account).
An (anonymous) review can left for some types of features, which is hosted by https://Mangrove.reviews, an libre and open data review project.
Images can be added via Panoramax, but will also be pulled from various sources such as Wikipedia and Mapillary.
An (anonymous) review can be left for some types of features, hosted by https://Mangrove.reviews, a libre and open data review project.
Images are fetched from various sources, such as Panoramax, Wikipedia and Mapillary. New images can be contributed to Panoramax directly from within MapComplete.

16
scripts/compile_version.sh Executable file
View file

@ -0,0 +1,16 @@
#! /bin/bash
# Edit the 'build.gradle' file to a certain target sdk
TAG="$1"
LABEL="$2"
VERSION="$3"
echo "Setting $VERSION"
# sed -i "s/compileSdkVersion *[0-9]\+/compileSdkVersion $VERSION/" app/build.gradle
sed -i "s/minSdk *[0-9]\+/minSdk $VERSION/" app/build.gradle
sed -i "s/targetSdkVersion *[0-9]\+/targetSdkVersion $VERSION/" app/build.gradle
./gradlew build
scp app/build/outputs/apk/release/app-release.apk hetzner:~/public/apk/mapcomplete-$TAG-$LABEL.apk
ssh hetzner "cp ~/public/apk/mapcomplete-$TAG-$LABEL.apk ~/public/apk/mapcomplete-latest-$LABEL.apk"