Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Commit f68d774

Browse files
committed
Merge branch 'refs/heads/native_map_download_ui'
2 parents 37aa91d + 336f58e commit f68d774

27 files changed

+369
-112
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ dependencies {
155155
}
156156
implementation libs.vtm.android
157157
implementation libs.androidsvg
158+
implementation libs.jsoup.jsoup
158159

159160
testImplementation libs.junit.jupiter
160161
testImplementation libs.assertj.core
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- Beschreibung für die Offline-Version geändert
22
- Neu: Map und Theme Downloads über Android DownloadManager
3+
- Neu: Map Download über nativen Dialog (ersetzt WebView)
34
- Übersetzungen aktualisiert
45
- Abhängigkeiten aktualisiert
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
- Change description for offline version
2-
- New: map and theme donwloads use now the Android DownloadManager
2+
- New: map and theme downloads use now the Android DownloadManager
3+
- New: map download via native dialog (replaces WebView)
34
- Updated translations
45
- Updated dependencies

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ material = "1.12.0"
1616
preferenceKtx = "1.2.1"
1717
runner = "1.6.2"
1818
slf4jApi = "2.0.16"
19+
jsoup = "1.18.1"
1920

2021
[libraries]
2122
android-test-runner = { module = "de.mannodermaus.junit5:android-test-runner", version.ref = "androidTest" }
@@ -27,6 +28,7 @@ constraintlayout = { module = "androidx.constraintlayout:constraintlayout", vers
2728
desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }
2829
documentfile = { module = "androidx.documentfile:documentfile", version.ref = "documentfile" }
2930
gradle = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePlugin" }
31+
jsoup-jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
3032
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junitJupiter" }
3133
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junitJupiter" }
3234
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junitJupiter" }

src/main/AndroidManifest.xml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
<activity
2828
android:name=".settings.SettingsActivity"
2929
android:label="@string/title_activity_settings" />
30-
<activity android:name=".DirectoryChooserActivity$MapDirectoryChooserActivity"/>
31-
<activity android:name=".DirectoryChooserActivity$ThemeDirectoryChooserActivity"/>
30+
<activity android:name=".settings.DirectoryChooserActivity$MapDirectoryChooserActivity" />
31+
<activity android:name=".settings.DirectoryChooserActivity$ThemeDirectoryChooserActivity" />
3232
<activity
3333
android:name=".MapsActivity"
3434
android:launchMode="singleTask"
@@ -48,63 +48,73 @@
4848
</intent-filter>
4949
</activity>
5050
<activity
51-
android:name=".DownloadActivity" android:exported="true">
51+
android:name=".download.DownloadActivity"
52+
android:exported="true">
5253
<intent-filter>
5354
<action android:name="android.intent.action.VIEW" />
55+
5456
<category android:name="android.intent.category.DEFAULT" />
5557
<category android:name="android.intent.category.BROWSABLE" />
58+
5659
<data android:scheme="mf-v4-map" />
5760
</intent-filter>
5861
<intent-filter>
5962
<action android:name="android.intent.action.VIEW" />
63+
6064
<category android:name="android.intent.category.DEFAULT" />
6165
<category android:name="android.intent.category.BROWSABLE" />
66+
6267
<data android:scheme="mf-theme" />
6368
</intent-filter>
6469
<intent-filter>
6570
<action android:name="android.intent.action.VIEW" />
6671
<action android:name="android.intent.action.SEND" />
72+
6773
<category android:name="android.intent.category.DEFAULT" />
6874
<category android:name="android.intent.category.BROWSABLE" />
75+
6976
<data android:scheme="http" />
7077
<data android:host="download.mapsforge.org" />
71-
<data android:pathPattern=".*\\.map"/>
78+
<data android:pathPattern=".*\\.map" />
7279
</intent-filter>
7380
<intent-filter>
7481
<action android:name="android.intent.action.VIEW" />
7582
<action android:name="android.intent.action.SEND" />
83+
7684
<category android:name="android.intent.category.DEFAULT" />
7785
<category android:name="android.intent.category.BROWSABLE" />
86+
7887
<data android:scheme="https" />
7988
<data android:host="download.freizeitkarte-osm.de" />
80-
<data android:pathPattern="/android/latest/.*\\.map\\.zip"/>
81-
<data android:pathPattern="/android/latest/.*\\.zip"/>
89+
<data android:pathPattern="/android/latest/.*\\.map\\.zip" />
90+
<data android:pathPattern="/android/latest/.*\\.zip" />
8291
</intent-filter>
8392
<intent-filter>
8493
<action android:name="android.intent.action.VIEW" />
8594
<action android:name="android.intent.action.SEND" />
95+
8696
<category android:name="android.intent.category.DEFAULT" />
8797
<category android:name="android.intent.category.BROWSABLE" />
98+
8899
<data android:scheme="https" />
89100
<data android:host="ftp.gwdg.de" />
90-
<data android:pathPattern="/pub/misc/openstreetmap/openandromaps/mapsV4/.*\\.zip"/>
101+
<data android:pathPattern="/pub/misc/openstreetmap/openandromaps/mapsV4/.*\\.zip" />
91102
</intent-filter>
92103
<intent-filter>
93104
<action android:name="android.intent.action.VIEW" />
94105
<action android:name="android.intent.action.SEND" />
106+
95107
<category android:name="android.intent.category.DEFAULT" />
96108
<category android:name="android.intent.category.BROWSABLE" />
109+
97110
<data android:scheme="https" />
98111
<data android:host="www.openandromaps.org" />
99-
<data android:pathPattern="/wp-content/users/tobias/.*\\.zip"/>
112+
<data android:pathPattern="/wp-content/users/tobias/.*\\.zip" />
100113
</intent-filter>
101114
</activity>
102-
<activity
103-
android:name=".DownloadMapSelectionActivity" />
104-
<activity
105-
android:name=".MapSelectionActivity"/>
106-
<activity
107-
android:name=".ThemeSelectionActivity" />
115+
<activity android:name=".download.DownloadMapSelectionActivity" />
116+
<activity android:name=".settings.MapSelectionActivity" />
117+
<activity android:name=".settings.ThemeSelectionActivity" />
108118
<activity
109119
android:name=".ShowErrorActivity"
110120
android:excludeFromRecents="true"

src/main/java/de/storchp/opentracks/osmplugin/BaseActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import de.storchp.opentracks.osmplugin.settings.SettingsActivity;
1515

16-
abstract class BaseActivity extends AppCompatActivity {
16+
public abstract class BaseActivity extends AppCompatActivity {
1717

1818
public void onCreateOptionsMenu(Menu menu, boolean showInfo) {
1919
super.onCreateOptionsMenu(menu);

src/main/java/de/storchp/opentracks/osmplugin/DownloadMapSelectionActivity.java

Lines changed: 0 additions & 61 deletions
This file was deleted.

src/main/java/de/storchp/opentracks/osmplugin/DownloadActivity.java renamed to src/main/java/de/storchp/opentracks/osmplugin/download/DownloadActivity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.storchp.opentracks.osmplugin;
1+
package de.storchp.opentracks.osmplugin.download;
22

33
import android.annotation.SuppressLint;
44
import android.app.Activity;
@@ -36,7 +36,10 @@
3636
import java.util.zip.ZipEntry;
3737
import java.util.zip.ZipInputStream;
3838

39+
import de.storchp.opentracks.osmplugin.BaseActivity;
40+
import de.storchp.opentracks.osmplugin.R;
3941
import de.storchp.opentracks.osmplugin.databinding.ActivityDownloadBinding;
42+
import de.storchp.opentracks.osmplugin.settings.DirectoryChooserActivity;
4043
import de.storchp.opentracks.osmplugin.utils.FileUtil;
4144
import de.storchp.opentracks.osmplugin.utils.PreferencesUtils;
4245

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package de.storchp.opentracks.osmplugin.download;
2+
3+
import java.util.Arrays;
4+
import java.util.Optional;
5+
6+
import de.storchp.opentracks.osmplugin.R;
7+
8+
public enum DownloadItemType {
9+
SUBDIR(R.drawable.baseline_folder_24, "[DIR]"), MAP(R.drawable.baseline_map_24, "[ ]");
10+
11+
private final int iconResId;
12+
private final String alt;
13+
14+
DownloadItemType(int iconResId, String alt) {
15+
this.iconResId = iconResId;
16+
this.alt = alt;
17+
}
18+
19+
public static Optional<DownloadItemType> ofAlt(String alt) {
20+
return Arrays.stream(DownloadItemType.values()).filter(downloadItemType -> downloadItemType.alt.equals(alt)).findFirst();
21+
}
22+
23+
public int getIconResId() {
24+
return iconResId;
25+
}
26+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package de.storchp.opentracks.osmplugin.download;
2+
3+
import android.net.Uri;
4+
5+
import androidx.annotation.NonNull;
6+
7+
public record DownloadMapItem(DownloadItemType downloadItemType, String name, String date,
8+
String size, Uri uri) implements Comparable<DownloadMapItem> {
9+
10+
@NonNull
11+
@Override
12+
public String toString() {
13+
return name();
14+
}
15+
16+
@Override
17+
public int compareTo(DownloadMapItem o) {
18+
if (downloadItemType != o.downloadItemType) {
19+
return downloadItemType.compareTo(o.downloadItemType);
20+
}
21+
return name.compareTo(o.name);
22+
}
23+
}

0 commit comments

Comments
 (0)