mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
moving classes around
This commit is contained in:
@@ -129,6 +129,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
Runnable runHandler;
|
||||
Runnable presentHandler;
|
||||
Runnable stopHandler;
|
||||
Runnable exportHandler;
|
||||
Runnable exportAppHandler;
|
||||
|
||||
@@ -1160,9 +1161,11 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
|
||||
public void setHandlers(Runnable runHandler, Runnable presentHandler,
|
||||
Runnable stopHandler,
|
||||
Runnable exportHandler, Runnable exportAppHandler) {
|
||||
this.runHandler = runHandler;
|
||||
this.presentHandler = presentHandler;
|
||||
this.stopHandler = stopHandler;
|
||||
this.exportHandler = exportHandler;
|
||||
this.exportAppHandler = exportAppHandler;
|
||||
}
|
||||
@@ -1171,6 +1174,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
public void resetHandlers() {
|
||||
runHandler = new DefaultRunHandler();
|
||||
presentHandler = new DefaultPresentHandler();
|
||||
stopHandler = new DefaultStopHandler();
|
||||
exportHandler = new DefaultExportHandler();
|
||||
exportAppHandler = new DefaultExportAppHandler();
|
||||
}
|
||||
@@ -1648,6 +1652,17 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DefaultStopHandler implements Runnable {
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
} catch (Exception e) {
|
||||
statusError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -1685,8 +1700,10 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
|
||||
/**
|
||||
* Called by Runner to notify that the sketch has stopped running.
|
||||
* Tools should not call this function, use handleStop() instead.
|
||||
* Deactivate the Run button. This is called by Runner to notify that the
|
||||
* sketch has stopped running, usually in response to an error (or maybe
|
||||
* the sketch completing and exiting?) Tools should not call this function.
|
||||
* To initiate a "stop" action, call handleStop() instead.
|
||||
*/
|
||||
public void internalRunnerClosed() {
|
||||
running = false;
|
||||
|
||||
@@ -61,8 +61,9 @@ public class Android implements Tool {
|
||||
checkPath();
|
||||
boolean success = Device.checkDefaults();
|
||||
if (success) {
|
||||
editor.setHandlers(new RunHandler(this), new PresentHandler(this),
|
||||
new ExportHandler(this), new ExportAppHandler(this));
|
||||
editor.setHandlers(new RunHandler(), new PresentHandler(),
|
||||
new StopHandler(),
|
||||
new ExportHandler(), new ExportAppHandler());
|
||||
build = new Build(editor);
|
||||
editor.statusNotice("Done loading Android tools.");
|
||||
} else {
|
||||
@@ -141,21 +142,29 @@ public class Android implements Tool {
|
||||
|
||||
// launch emulator because it's not running yet
|
||||
try {
|
||||
if (emulatorProcess != null) {
|
||||
// see if it's done yet
|
||||
try {
|
||||
int result = emulatorProcess.exitValue();
|
||||
emulatorProcess.destroy();
|
||||
|
||||
} catch (IllegalThreadStateException itse) {
|
||||
// not done yet
|
||||
}
|
||||
|
||||
//if (emulatorProcess.)
|
||||
}
|
||||
|
||||
editor.statusNotice("Starting new Android emulator.");
|
||||
emulatorProcess = Runtime.getRuntime().exec(new String[] {
|
||||
String[] cmd = new String[] {
|
||||
"emulator",
|
||||
"-avd", getDefaultDevice(),
|
||||
"-port", portString,
|
||||
"-logcat", "'*:i'",
|
||||
"-no-boot-anim"
|
||||
});
|
||||
System.out.println(PApplet.join(new String[] {
|
||||
"emulator",
|
||||
"-avd", getDefaultDevice(),
|
||||
"-port", portString,
|
||||
"-logcat", "'*:i'",
|
||||
"-no-boot-anim"
|
||||
}, " "));
|
||||
};
|
||||
emulatorProcess = Runtime.getRuntime().exec(cmd);
|
||||
System.out.println(PApplet.join(cmd, " "));
|
||||
// make sure that the streams are drained properly
|
||||
new StreamRedirectThread("android-emulator-out",
|
||||
emulatorProcess.getInputStream(), System.out).start();
|
||||
@@ -228,9 +237,6 @@ public class Android implements Tool {
|
||||
//System.out.println("ant build complete " + success);
|
||||
if (!success) return;
|
||||
|
||||
// // if no emulator is running, start an emulator
|
||||
// String name = findEmulator();
|
||||
|
||||
success = installSketch(device);
|
||||
if (!success) return;
|
||||
|
||||
@@ -251,6 +257,7 @@ public class Android implements Tool {
|
||||
String[] cmd = new String[] {
|
||||
"adb",
|
||||
"-s", device,
|
||||
"wait-for-device",
|
||||
"install", "-r", // safe to always use -r switch
|
||||
build.getPathForAPK("debug")
|
||||
};
|
||||
@@ -340,4 +347,41 @@ public class Android implements Tool {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
class RunHandler implements Runnable {
|
||||
public void run() {
|
||||
installAndRun("debug", findEmulator());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class PresentHandler implements Runnable {
|
||||
public void run() {
|
||||
String device = findDevice();
|
||||
if (device == null) {
|
||||
editor.statusError("No device found.");
|
||||
} else {
|
||||
installAndRun("debug", device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class StopHandler implements Runnable {
|
||||
public void run() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ExportHandler implements Runnable {
|
||||
public void run() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ExportAppHandler implements Runnable {
|
||||
public void run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2009 Ben Fry and Casey Reas
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app.tools.android;
|
||||
|
||||
|
||||
public class ExportAppHandler implements Runnable {
|
||||
Android parent;
|
||||
|
||||
|
||||
public ExportAppHandler(Android parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2009 Ben Fry and Casey Reas
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app.tools.android;
|
||||
|
||||
|
||||
public class ExportHandler implements Runnable {
|
||||
Android parent;
|
||||
|
||||
|
||||
public ExportHandler(Android parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2009 Ben Fry and Casey Reas
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app.tools.android;
|
||||
|
||||
|
||||
public class PresentHandler implements Runnable {
|
||||
Android parent;
|
||||
|
||||
|
||||
public PresentHandler(Android parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
public void run() {
|
||||
String device = parent.findDevice();
|
||||
if (device == null) {
|
||||
parent.getEditor().statusError("No device found.");
|
||||
} else {
|
||||
parent.installAndRun("debug", device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2009 Ben Fry and Casey Reas
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.app.tools.android;
|
||||
|
||||
|
||||
public class RunHandler implements Runnable {
|
||||
Android parent;
|
||||
|
||||
|
||||
public RunHandler(Android parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
public void run() {
|
||||
parent.installAndRun("debug", parent.findEmulator());
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ X use xdg-open as launcher on linux
|
||||
X http://dev.processing.org/bugs/show_bug.cgi?id=1358
|
||||
X change to different class id for export and export-opengl
|
||||
|
||||
_ add warning message when not using a version of sun java w/ p5
|
||||
|
||||
_ write quicktime uncompressed (w/o qtjava)
|
||||
_ http://blog.hslu.ch/rawcoder/2008/06/21/writing-quicktime-movies-in-pure-java/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user