Here's a patch to use native Zip library on Android
Two problems
* apparently this can't be used for sounds in zip (mediaplayer requires a seekable data source, and the zip entry probably is not seekable); with the bundled-with-source zip, there's a mod which exposes the offset of the sound zip data in the zip file, and the zip file is used as input for mediaplayer with offset & size
* this doesn't work even for other map data than sound; as there's the noisemaker problem, didn't bother to debug what's wrong
$ git diff
diff --git a/src/de/ueller/gpsmid/data/Configuration.java b/src/de/ueller/gpsmid/data/Configuration.java
index 8f056d1..6b98a1f 100644
--- a/src/de/ueller/gpsmid/data/Configuration.java
+++ b/src/de/ueller/gpsmid/data/Configuration.java
@@ -32,7 +32,12 @@ import javax.microedition.lcdui.Command;
import javax.microedition.rms.InvalidRecordIDException;
import javax.microedition.rms.RecordStore;
+//#if polish.android
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+//#else
import net.sourceforge.util.zip.ZipFile;
+//#endif
import de.ueller.gps.Node;
import de.ueller.gpsmid.graphics.ProjFactory;
@@ -1751,7 +1756,11 @@ public class Configuration {
} else {
// zipfile mode
if (mapZipFile == null) {
+ //#if polish.android
+ mapZipFile = new ZipFile(mapFileUrl);
+ //#else
mapZipFile = new ZipFile(mapFileUrl, -1);
+ //#endif
if (mapFileUrl.toLowerCase().endsWith(".apk")) {
zipFileIsApk = true;
} else {
diff --git a/src/de/ueller/gpsmid/routing/RouteSyntax.java b/src/de/ueller/gpsmid/routing/RouteSyntax.java
index 0b05843..171cb70 100644
--- a/src/de/ueller/gpsmid/routing/RouteSyntax.java
+++ b/src/de/ueller/gpsmid/routing/RouteSyntax.java
@@ -26,7 +26,12 @@ import de.ueller.gpsmid.data.Legend;
import de.ueller.gpsmid.mapdata.QueueReader;
import de.ueller.gpsmid.ui.Trace;
+//#if polish.android
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+//#else
import net.sourceforge.util.zip.ZipFile;
+//#endif
import de.enough.polish.util.Locale;
@@ -168,7 +173,11 @@ public class RouteSyntax {
} else {
// zip map
if (Configuration.mapZipFile == null) {
+ //#if polish.android
+ Configuration.mapZipFile = new ZipFile(Configuration.getMapUrl());
+ //#else
Configuration.mapZipFile = new ZipFile(Configuration.getMapUrl(), -1);
+ //#endif
}
if (Configuration.zipFileIsApk) {
syntaxDat = "assets/" + syntaxDat;
diff --git a/src/de/ueller/gpsmid/ui/NoiseMaker.java b/src/de/ueller/gpsmid/ui/NoiseMaker.java
index 3569045..b96ac3a 100644
--- a/src/de/ueller/gpsmid/ui/NoiseMaker.java
+++ b/src/de/ueller/gpsmid/ui/NoiseMaker.java
@@ -14,8 +14,13 @@ import de.ueller.gpsmid.routing.RouteInstructions;
import de.ueller.gpsmid.routing.RouteSyntax;
import de.ueller.util.Logger;
+//#if polish.android
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+//#else
import net.sourceforge.util.zip.ZipFile;
import net.sourceforge.util.zip.ZipEntry;
+//#endif
import java.io.DataInputStream;
import java.io.IOException;
@@ -190,7 +195,8 @@ public class NoiseMaker
ZipEntry ze = Configuration.mapZipFile.getEntry(prefix + soundFileWithS
// then open the zip file and position media player there for playing
FileInputStream fis = new FileInputStream(Configuration.getMapUrl().sub
- sPlayer.setDataSource(fis.getFD(), ze.getOffset(), ze.getSize());
+ // sPlayer.setDataSource(fis.getFD(), ze.getOffset(), ze.getSize());
+ sPlayer.setDataSource(fis.getFD());
}
}
sPlayer.prepare();
start at the change