Skip to content

Commit fdb05b0

Browse files
committed
Merge remote-tracking branch 'origin/master' into fragment
Conflicts: src/processing/mode/android/AndroidBuild.java
2 parents bbc5af9 + 9a98747 commit fdb05b0

File tree

8 files changed

+110
-65
lines changed

8 files changed

+110
-65
lines changed

build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<!--
3737
classpath="../core/library/core.jar; lib/ant.jar; lib/ant-launcher.jar; lib/antlr.jar; lib/apple.jar; lib/jdt-core.jar; lib/jna.jar; lib/org-netbeans-swing-outline.jar;lib/com.ibm.icu_4.4.2.v20110823.jar;lib/jdi.jar;lib/jdimodel.jar;lib/org.eclipse.osgi_3.8.1.v20120830-144521.jar"
3838
-->
39-
<javac source="1.6"
40-
target="1.6"
39+
<javac source="1.7"
40+
target="1.7"
4141
destdir="bin"
4242
encoding="UTF-8"
4343
includeAntRuntime="false"

core/src/processing/data/Table.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,35 +1855,35 @@ public void insertRow(int insert, Object[] columnData) {
18551855
case INT: {
18561856
int[] intTemp = new int[rowCount+1];
18571857
System.arraycopy(columns[col], 0, intTemp, 0, insert);
1858-
System.arraycopy(columns[col], insert, intTemp, insert+1, (rowCount - insert) + 1);
1858+
System.arraycopy(columns[col], insert, intTemp, insert+1, rowCount - insert);
18591859
columns[col] = intTemp;
18601860
break;
18611861
}
18621862
case LONG: {
18631863
long[] longTemp = new long[rowCount+1];
18641864
System.arraycopy(columns[col], 0, longTemp, 0, insert);
1865-
System.arraycopy(columns[col], insert, longTemp, insert+1, (rowCount - insert) + 1);
1865+
System.arraycopy(columns[col], insert, longTemp, insert+1, rowCount - insert);
18661866
columns[col] = longTemp;
18671867
break;
18681868
}
18691869
case FLOAT: {
18701870
float[] floatTemp = new float[rowCount+1];
18711871
System.arraycopy(columns[col], 0, floatTemp, 0, insert);
1872-
System.arraycopy(columns[col], insert, floatTemp, insert+1, (rowCount - insert) + 1);
1872+
System.arraycopy(columns[col], insert, floatTemp, insert+1, rowCount - insert);
18731873
columns[col] = floatTemp;
18741874
break;
18751875
}
18761876
case DOUBLE: {
18771877
double[] doubleTemp = new double[rowCount+1];
18781878
System.arraycopy(columns[col], 0, doubleTemp, 0, insert);
1879-
System.arraycopy(columns[col], insert, doubleTemp, insert+1, (rowCount - insert) + 1);
1879+
System.arraycopy(columns[col], insert, doubleTemp, insert+1, rowCount - insert);
18801880
columns[col] = doubleTemp;
18811881
break;
18821882
}
18831883
case STRING: {
18841884
String[] stringTemp = new String[rowCount+1];
18851885
System.arraycopy(columns[col], 0, stringTemp, 0, insert);
1886-
System.arraycopy(columns[col], insert, stringTemp, insert+1, (rowCount - insert) + 1);
1886+
System.arraycopy(columns[col], insert, stringTemp, insert+1, rowCount - insert);
18871887
columns[col] = stringTemp;
18881888
break;
18891889
}

core/src/processing/opengl/PGLES.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ protected void registerListeners() { }
136136
protected void getGL(PGL pgl) {
137137
PGLES pgles = (PGLES)pgl;
138138
this.gl = pgles.gl;
139+
setThread(pgles.glThread);
139140
}
140141

141142

@@ -213,6 +214,7 @@ public void onSurfaceCreated(GL10 igl, EGLConfig config) {
213214
gl = igl;
214215
context = ((EGL10)EGLContext.getEGL()).eglGetCurrentContext();
215216
glContext = context.hashCode();
217+
glThread = Thread.currentThread();
216218

217219
if (!hasFBOs()) {
218220
throw new RuntimeException(MISSING_FBO_ERROR);

mode.properties

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ authorList = [The Processing Foundation](http://android.processing.org/)
33
url = https://github.com/processing/processing-android
44
sentence = Create projects with Processing for Android devices
55
paragraph = This version of the Android Mode is for Processing 3.0a11+
6-
version = 238
7-
prettyVersion = 3.1
8-
minRevision = 238
6+
imports=processing.mode.java.JavaMode
7+
version = 239
8+
prettyVersion = 3alpha
9+
minRevision = 237
910
maxRevision = 0

src/processing/mode/android/AVD.java

Lines changed: 69 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class AVD {
1717
static private final String AVD_CREATE_SECONDARY =
1818
"The default Android emulator could not be set up. Make sure<br>" +
1919
"that the Android SDK is installed properly, and that the<br>" +
20-
"Android and Google APIs are installed for level " + AndroidBuild.sdkVersion + ".<br>" +
20+
"Android and Google APIs are installed for level %s.<br>" +
2121
"(Between you and me, occasionally, this error is a red herring,<br>" +
2222
"and your sketch may be launching shortly.)";
2323

@@ -45,56 +45,99 @@ public class AVD {
4545
/** "android-7" or "Google Inc.:Google APIs:7" */
4646
protected String target;
4747

48-
/** x86, x86_64 or armeabi-v7a **/
48+
/** x86, x86_64 or armeabi **/
4949
protected String abi;
5050

51+
protected VirtualDevice virtualDevice;
52+
5153
public static final String PREF_KEY_ABI = "android.sdk.abi";
52-
public static final String[] ABI = {"armeabi-v7a", "x86", "x86_64"};
54+
public static final String[] ABI = {"armeabi", "x86", "x86_64"};
5355

5456
/** Default virtual device used by Processing. */
5557
static public AVD defaultAVD;
5658
// "Google Inc.:Google APIs:" + AndroidBuild.sdkVersion);
5759

58-
static ArrayList<String> avdList;
59-
static ArrayList<String> badList;
60-
// static ArrayList<String> skinList;
60+
static ArrayList<VirtualDevice> avdList;
61+
static ArrayList<VirtualDevice> badList;
62+
63+
64+
private static class VirtualDevice {
65+
public String name;
66+
public String target;
67+
public String abi;
68+
public VirtualDevice(String name, String target, String abi) {
69+
this.name = name;
70+
this.target = target;
71+
this.abi = abi;
72+
}
6173

74+
@Override
75+
public boolean equals(Object o) {
76+
VirtualDevice device = (VirtualDevice) o;
77+
if (device.name.equals(name) && device.target.equals(target)
78+
&& device.abi.equals(abi)) {
79+
return true;
80+
}
81+
return false;
82+
}
83+
}
84+
6285

6386
public AVD(String name, String target, String abi) {
6487
this.name = name;
6588
this.target = target;
6689
this.abi = abi;
90+
virtualDevice = new VirtualDevice(name, target, abi);
6791
}
6892

6993

7094
static protected void list(final AndroidSDK sdk) throws IOException {
7195
try {
72-
avdList = new ArrayList<String>();
73-
badList = new ArrayList<String>();
96+
avdList = new ArrayList<VirtualDevice>();
97+
badList = new ArrayList<VirtualDevice>();
7498
ProcessResult listResult =
7599
new ProcessHelper(sdk.getAndroidToolPath(), "list", "avds").execute();
76100
if (listResult.succeeded()) {
77101
boolean badness = false;
102+
String mTarget = null;
103+
String mAbi = null;
104+
String mName = null;
78105
for (String line : listResult) {
79106
String[] m = PApplet.match(line, "\\s+Name\\:\\s+(\\S+)");
80107
if (m != null) {
108+
mName = m[1];
109+
continue;
110+
}
111+
112+
m = PApplet.match(line, "API\\slevel\\s([0-9]+)");
113+
if (m != null) {
114+
mTarget = m[1];
115+
continue;
116+
}
117+
118+
m = PApplet.match(line, "\\s+Tag\\/ABI\\:\\s\\S+\\/(\\S+)");
119+
if (m != null) {
120+
mAbi = m[1];
121+
}
122+
123+
if (mName != null && mTarget != null && mAbi != null) {
124+
VirtualDevice mVirtualDevice = new VirtualDevice(mName, mTarget, mAbi);
125+
mTarget = null;
126+
mAbi = null;
81127
if (!badness) {
82-
// System.out.println("good: " + m[1]);
83-
avdList.add(m[1]);
128+
avdList.add(mVirtualDevice);
84129
} else {
85-
// System.out.println("bad: " + m[1]);
86-
badList.add(m[1]);
130+
badList.add(mVirtualDevice);
87131
}
88-
// } else {
89-
// System.out.println("nope: " + line);
90132
}
133+
91134
// "The following Android Virtual Devices could not be loaded:"
92135
if (line.contains("could not be loaded:")) {
93136
// System.out.println("starting the bad list");
94137
// System.err.println("Could not list AVDs:");
95138
// System.err.println(listResult);
96139
badness = true;
97-
// break;
140+
break;
98141
}
99142
}
100143
} else {
@@ -109,15 +152,9 @@ protected boolean exists(final AndroidSDK sdk) throws IOException {
109152
if (avdList == null) {
110153
list(sdk);
111154
}
112-
for (String avd : avdList) {
113-
if (Base.DEBUG) {
114-
System.out.println("AVD.exists() checking for " + name + " against " + avd);
115-
}
116-
if (avd.equals(name)) {
117-
return true;
118-
}
119-
}
120-
return false;
155+
virtualDevice.target = AndroidBuild.sdkVersion;
156+
virtualDevice.abi = abi;
157+
return avdList.contains(virtualDevice);
121158
}
122159

123160

@@ -127,12 +164,7 @@ protected boolean exists(final AndroidSDK sdk) throws IOException {
127164
* (Prestigious may also not be the right word.)
128165
*/
129166
protected boolean badness() {
130-
for (String avd : badList) {
131-
if (avd.equals(name)) {
132-
return true;
133-
}
134-
}
135-
return false;
167+
return badList.contains(virtualDevice);
136168
}
137169

138170

@@ -165,7 +197,8 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
165197
} else {
166198
// Just generally not working
167199
// Base.showWarning("Android Error", AVD_CREATE_ERROR, null);
168-
Base.showWarningTiered("Android Error", AVD_CREATE_PRIMARY, AVD_CREATE_SECONDARY, null);
200+
Base.showWarningTiered("Android Error", AVD_CREATE_PRIMARY,
201+
String.format(AVD_CREATE_SECONDARY, AndroidBuild.sdkVersion), null);
169202
System.out.println(createAvdResult);
170203
// throw new IOException("Error creating the AVD");
171204
}
@@ -178,7 +211,8 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
178211

179212
static public boolean ensureProperAVD(final AndroidSDK sdk, final String abi) {
180213
try {
181-
defaultAVD = new AVD("Processing-0" + Base.getRevision(),
214+
defaultAVD = new AVD("Processing-0" + Base.getRevision() + "-" + AndroidBuild.sdkVersion +
215+
"-" + abi,
182216
"android-" + AndroidBuild.sdkVersion, abi);
183217
if (defaultAVD.exists(sdk)) {
184218
// System.out.println("the avd exists");
@@ -195,8 +229,10 @@ static public boolean ensureProperAVD(final AndroidSDK sdk, final String abi) {
195229
return true;
196230
}
197231
} catch (final Exception e) {
232+
e.printStackTrace();
198233
// Base.showWarning("Android Error", AVD_CREATE_ERROR, e);
199-
Base.showWarningTiered("Android Error", AVD_CREATE_PRIMARY, AVD_CREATE_SECONDARY, null);
234+
Base.showWarningTiered("Android Error", AVD_CREATE_PRIMARY,
235+
String.format(AVD_CREATE_SECONDARY, AndroidBuild.sdkVersion), null);
200236
}
201237
System.out.println("at bottom of ensure proper");
202238
return false;

0 commit comments

Comments
 (0)