auto-download android core zip file

This commit is contained in:
benfry
2009-12-06 14:47:02 +00:00
parent c4d32971bb
commit aa9aad6346
3 changed files with 38 additions and 5 deletions

View File

@@ -23,6 +23,7 @@ package processing.app.tools.android;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import javax.swing.JOptionPane;
//import java.util.ArrayList;
@@ -63,6 +64,11 @@ public class Android implements Tool {
static final String ADB_SOCKET_PORT = "29892";
static final String ANDROID_CORE_URL =
"http://dev.processing.org/android/core.zip";
static final String ANDROID_CORE_FILENAME =
"processing-android-core.zip";
public String getMenuTitle() {
return "Android Mode";
@@ -94,6 +100,10 @@ public class Android implements Tool {
editor.statusError("Could not load Android tools.");
return;
}
// Make sure that the processing.android.core.* classes are available
checkCore();
editor.setHandlers(new RunHandler(), new PresentHandler(),
new StopHandler(),
new ExportHandler(), new ExportAppHandler());
@@ -185,6 +195,22 @@ public class Android implements Tool {
*/
return true;
}
protected boolean checkCore() {
File target = new File(Base.getSketchbookFolder(), ANDROID_CORE_FILENAME);
if (!target.exists()) {
try {
URL url = new URL(ANDROID_CORE_URL);
PApplet.saveStream(target, url.openStream());
} catch (Exception e) {
Base.showWarning("Download Error",
"Could not download Android core.zip", e);
return false;
}
}
return true;
}
/**

View File

@@ -518,7 +518,10 @@ public class Build {
void writeLibs(File libsFolder) {
libsFolder.mkdirs();
InputStream input = getClass().getResourceAsStream("processing-core.zip");
//InputStream input = getClass().getResourceAsStream("processing-core.zip");
File file =
new File(Base.getSketchbookFolder(), Android.ANDROID_CORE_FILENAME);
InputStream input = PApplet.createInput(file);
PApplet.saveStream(new File(libsFolder, "processing-core.jar"), input);
}

View File

@@ -2,6 +2,14 @@
X fix ant.jar/ant-launcher.jar error in the windows/linux build scripts
X http://dev.processing.org/bugs/show_bug.cgi?id=1403
_ move build scripts to something better like ant
_ too much to maintain the multiple versions, too much code
_ http://dev.processing.org/bugs/show_bug.cgi?id=151
_ also update build/howto.txt (of course) because it says no ant
_ this would also mean requiring a java installation for building
_ so may as well move the jdk stuff outside of the build
_ http://ant.apache.org/manual/CoreTasks/get.html
_ lack of java.awt.Polygon import breaks the yellowtail example
_ just add a simple poly class? or don't use a poly?
@@ -1310,10 +1318,6 @@ _ drag and drop
_ including the number of items would be especially nice
_ implement automatic update
_ http://dev.processing.org/bugs/show_bug.cgi?id=374
_ move build scripts to something better like ant
_ too much to maintain the multiple versions, too much code
_ http://dev.processing.org/bugs/show_bug.cgi?id=151
_ also update build/howto.txt (of course) because it says no ant
_ need .pde document icons
_ need .psk file icon
_ need exported application icons