diff --git a/build.gradle b/build.gradle
index 449637d0..a957961c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -136,6 +136,9 @@ task dist {
FileUtils.copyDirectory(file("mode/languages"),
file("${root}/languages"))
+ FileUtils.copyDirectory(file("mode/resources"),
+ file("${root}/resources"))
+
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/tool"),
file("${root}/tools/SDKUpdater/tool"))
FileUtils.copyDirectory(file("mode/tools/SDKUpdater/lib"),
diff --git a/mode/.classpath b/mode/.classpath
index 11fedf28..3242dff6 100644
--- a/mode/.classpath
+++ b/mode/.classpath
@@ -6,12 +6,19 @@
-
+
+
+
+
+
+
+
+
diff --git a/mode/.project b/mode/.project
index 45eaa1fa..a1e217da 100644
--- a/mode/.project
+++ b/mode/.project
@@ -1,6 +1,6 @@
- mode
+ android-mode
diff --git a/mode/.settings/org.eclipse.buildship.core.prefs b/mode/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 00000000..e8895216
--- /dev/null
+++ b/mode/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,2 @@
+connection.project.dir=
+eclipse.preferences.version=1
diff --git a/mode/.settings/org.eclipse.jdt.core.prefs b/mode/.settings/org.eclipse.jdt.core.prefs
index 6558ab78..0fee6a9c 100644
--- a/mode/.settings/org.eclipse.jdt.core.prefs
+++ b/mode/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=17
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=17
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/mode/libraries/vr/build.gradle b/mode/libraries/vr/build.gradle
index d130e486..55a20e0a 100644
--- a/mode/libraries/vr/build.gradle
+++ b/mode/libraries/vr/build.gradle
@@ -8,8 +8,13 @@ plugins {
dependencies {
compileOnly name: "android"
compileOnly "org.p5android:processing-core:${modeVersion}"
- implementationAar "com.google.vr:sdk-audio:${gvrVersion}"
- implementationAar "com.google.vr:sdk-base:${gvrVersion}"
+
+// commenting due to issue #718
+// implementationAar "com.google.vr:sdk-audio:${gvrVersion}"
+// implementationAar "com.google.vr:sdk-base:${gvrVersion}"
+
+// fix for Issue #718
+ implementationAar fileTree(dir: "libs", include: ["*.aar"])
}
task sourceJar(type: Jar, dependsOn: classes) {
@@ -53,7 +58,7 @@ compileJava.doFirst {
libFolder.mkdirs()
for (String fn : deps) {
Files.copy(file("${rootDir}/build/libs/" + fn).toPath(),
- file("library/" + fn).toPath(), REPLACE_EXISTING);
+ file("library/" + fn).toPath(), REPLACE_EXISTING);
}
}
@@ -61,27 +66,27 @@ build.doLast {
// Copying vr jar to library folder
File vrJar = file("library/vr.jar")
vrJar.mkdirs();
-
+
// Need to check the existance of the files before using as the files
// will get generated only if Task ':mode:libraries:vr:jar' is not being skipped
// Task ':mode:libraries:vr:jar' will be skipped if source files are unchanged or jar task is UP-TO-DATE
-
+
if (file("$buildDir/libs/vr.jar").exists()) {
Files.copy(file("$buildDir/libs/vr.jar").toPath(),
- vrJar.toPath(), REPLACE_EXISTING);
+ vrJar.toPath(), REPLACE_EXISTING);
}
// Renaming artifacts for maven publishing
if (file("$buildDir/libs/vr.jar").exists()) {
Files.move(file("$buildDir/libs/vr.jar").toPath(),
- file("$buildDir/libs/processing-vr-${vrLibVersion}.jar").toPath(), REPLACE_EXISTING);
+ file("$buildDir/libs/processing-vr-${vrLibVersion}.jar").toPath(), REPLACE_EXISTING);
}
if (file("$buildDir/libs/vr-sources.jar").exists()) {
Files.move(file("$buildDir/libs/vr-sources.jar").toPath(),
- file("$buildDir/libs/processing-vr-${vrLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
+ file("$buildDir/libs/processing-vr-${vrLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
}
if (file("$buildDir/libs/vr.jar.MD5").exists()) {
Files.move(file("$buildDir/libs/vr.jar.MD5").toPath(),
- file("$buildDir/libs/processing-vr-${vrLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
+ file("$buildDir/libs/processing-vr-${vrLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
}
}
diff --git a/mode/libraries/vr/libs/sdk-audio-1.180.0.aar b/mode/libraries/vr/libs/sdk-audio-1.180.0.aar
new file mode 100644
index 00000000..007485cf
Binary files /dev/null and b/mode/libraries/vr/libs/sdk-audio-1.180.0.aar differ
diff --git a/mode/libraries/vr/libs/sdk-base-1.180.0.aar b/mode/libraries/vr/libs/sdk-base-1.180.0.aar
new file mode 100644
index 00000000..e9047d22
Binary files /dev/null and b/mode/libraries/vr/libs/sdk-base-1.180.0.aar differ
diff --git a/mode/libraries/vr/libs/sdk-common-1.180.0.aar b/mode/libraries/vr/libs/sdk-common-1.180.0.aar
new file mode 100644
index 00000000..7ba5cff9
Binary files /dev/null and b/mode/libraries/vr/libs/sdk-common-1.180.0.aar differ
diff --git a/mode/mode.properties b/mode/mode.properties
index 48e82d68..6e39e251 100644
--- a/mode/mode.properties
+++ b/mode/mode.properties
@@ -4,8 +4,8 @@ url = http://android.processing.org
sentence = This mode lets you use Processing to create Android apps
paragraph =
imports=processing.mode.java.JavaMode
-version = 406
-prettyVersion = 4.5.0b2
+version = 407
+prettyVersion = 4.5.0b3
minRevision = 1283
maxRevision = 0
diff --git a/mode/resources/device-art-resources/device-art.xml b/mode/resources/device-art-resources/device-art.xml
new file mode 100644
index 00000000..b67fa203
--- /dev/null
+++ b/mode/resources/device-art-resources/device-art.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mode/resources/device-art-resources/pixel_3/layout b/mode/resources/device-art-resources/pixel_3/layout
new file mode 100644
index 00000000..4615fb58
--- /dev/null
+++ b/mode/resources/device-art-resources/pixel_3/layout
@@ -0,0 +1,38 @@
+parts {
+ device {
+ display {
+ width 1080
+ height 2160
+ x 0
+ y 0
+ }
+ }
+ portrait {
+ background {
+ image port_back.webp
+ }
+ foreground {
+ mask round_corners.webp
+ }
+ onion {
+ image port_fore.webp
+ }
+ }
+}
+layouts {
+ portrait {
+ width 1194
+ height 2532
+ event EV_SW:0:1
+ part1 {
+ name portrait
+ x 0
+ y 0
+ }
+ part2 {
+ name device
+ x 54
+ y 196
+ }
+ }
+}
diff --git a/mode/resources/device-art-resources/pixel_3/port_back.webp b/mode/resources/device-art-resources/pixel_3/port_back.webp
new file mode 100644
index 00000000..6037b796
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_3/port_back.webp differ
diff --git a/mode/resources/device-art-resources/pixel_3/round_corners.webp b/mode/resources/device-art-resources/pixel_3/round_corners.webp
new file mode 100644
index 00000000..9dad9033
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_3/round_corners.webp differ
diff --git a/mode/resources/device-art-resources/pixel_6/back.webp b/mode/resources/device-art-resources/pixel_6/back.webp
new file mode 100644
index 00000000..a4125680
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_6/back.webp differ
diff --git a/mode/resources/device-art-resources/pixel_6/layout b/mode/resources/device-art-resources/pixel_6/layout
new file mode 100644
index 00000000..ae638d34
--- /dev/null
+++ b/mode/resources/device-art-resources/pixel_6/layout
@@ -0,0 +1,36 @@
+parts {
+ device {
+ display {
+ width 1080
+ height 2400
+ x 0
+ y 0
+ }
+ }
+ portrait {
+ background {
+ image back.webp
+ }
+ foreground {
+ mask mask.webp
+ cutout hole
+ }
+ }
+}
+layouts {
+ portrait {
+ width 1209
+ height 2553
+ event EV_SW:0:1
+ part1 {
+ name portrait
+ x 0
+ y 0
+ }
+ part2 {
+ name device
+ x 60
+ y 69
+ }
+ }
+}
diff --git a/mode/resources/device-art-resources/pixel_6/mask.webp b/mode/resources/device-art-resources/pixel_6/mask.webp
new file mode 100644
index 00000000..c658b192
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_6/mask.webp differ
diff --git a/mode/resources/device-art-resources/pixel_c/land_back.webp b/mode/resources/device-art-resources/pixel_c/land_back.webp
new file mode 100644
index 00000000..4cec5287
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_c/land_back.webp differ
diff --git a/mode/resources/device-art-resources/pixel_c/land_fore.webp b/mode/resources/device-art-resources/pixel_c/land_fore.webp
new file mode 100644
index 00000000..66a0b9df
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_c/land_fore.webp differ
diff --git a/mode/resources/device-art-resources/pixel_c/land_shadow.webp b/mode/resources/device-art-resources/pixel_c/land_shadow.webp
new file mode 100644
index 00000000..15acd867
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_c/land_shadow.webp differ
diff --git a/mode/resources/device-art-resources/pixel_c/layout b/mode/resources/device-art-resources/pixel_c/layout
new file mode 100644
index 00000000..7378ba8c
--- /dev/null
+++ b/mode/resources/device-art-resources/pixel_c/layout
@@ -0,0 +1,59 @@
+parts {
+ device {
+ display {
+ width 1800
+ height 2560
+ x 0
+ y 0
+ }
+ }
+ portrait {
+ background {
+ image port_back.webp
+ }
+ onion {
+ image port_fore.webp
+ }
+ }
+ landscape {
+ background {
+ image land_back.webp
+ }
+ onion {
+ image land_fore.webp
+ }
+ }
+}
+layouts {
+ portrait {
+ width 2307
+ height 2971
+ event EV_SW:0:1
+ part1 {
+ name portrait
+ x 0
+ y 0
+ }
+ part2 {
+ name device
+ x 259
+ y 181
+ }
+ }
+ landscape {
+ width 3096
+ height 2215
+ event EV_SW:0:0
+ part1 {
+ name landscape
+ x 0
+ y 0
+ }
+ part2 {
+ name device
+ x 269
+ y 1988
+ rotation 3
+ }
+ }
+}
diff --git a/mode/resources/device-art-resources/pixel_c/port_back.webp b/mode/resources/device-art-resources/pixel_c/port_back.webp
new file mode 100644
index 00000000..ee9e3eae
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_c/port_back.webp differ
diff --git a/mode/resources/device-art-resources/pixel_c/port_fore.webp b/mode/resources/device-art-resources/pixel_c/port_fore.webp
new file mode 100644
index 00000000..f2e6b7ca
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_c/port_fore.webp differ
diff --git a/mode/resources/device-art-resources/pixel_c/port_shadow.webp b/mode/resources/device-art-resources/pixel_c/port_shadow.webp
new file mode 100644
index 00000000..e7c1e74b
Binary files /dev/null and b/mode/resources/device-art-resources/pixel_c/port_shadow.webp differ
diff --git a/mode/resources/device-art-resources/wearos_small_round/device_bezel.png b/mode/resources/device-art-resources/wearos_small_round/device_bezel.png
new file mode 100644
index 00000000..5eccf08c
Binary files /dev/null and b/mode/resources/device-art-resources/wearos_small_round/device_bezel.png differ
diff --git a/mode/resources/device-art-resources/wearos_small_round/hardware.ini b/mode/resources/device-art-resources/wearos_small_round/hardware.ini
new file mode 100644
index 00000000..3f8ab78b
--- /dev/null
+++ b/mode/resources/device-art-resources/wearos_small_round/hardware.ini
@@ -0,0 +1,3 @@
+# skin-specific hardware values
+hw.rotaryInput=yes
+hw.sensors.heart_rate=yes
diff --git a/mode/resources/device-art-resources/wearos_small_round/layout b/mode/resources/device-art-resources/wearos_small_round/layout
new file mode 100644
index 00000000..6c45bac2
--- /dev/null
+++ b/mode/resources/device-art-resources/wearos_small_round/layout
@@ -0,0 +1,46 @@
+parts {
+ portrait {
+ background {
+ image device_bezel.png
+ }
+ }
+
+ device {
+ display {
+ width 384
+ height 384
+ x 0
+ y 0
+ }
+ }
+}
+
+layouts {
+ portrait {
+ width 456
+ height 456
+ color 0x1f1f1f
+ event EV_SW:0:1
+
+ part1 {
+ name portrait
+ x 0
+ y 0
+ }
+
+ part2 {
+ name device
+ x 36
+ y 36
+ }
+ }
+}
+
+keyboard {
+ charmap qwerty2
+}
+
+network {
+ speed full
+ delay none
+}
diff --git a/mode/resources/device-art-resources/wearos_square/device_bezel.png b/mode/resources/device-art-resources/wearos_square/device_bezel.png
new file mode 100644
index 00000000..01c5cc14
Binary files /dev/null and b/mode/resources/device-art-resources/wearos_square/device_bezel.png differ
diff --git a/mode/resources/device-art-resources/wearos_square/hardware.ini b/mode/resources/device-art-resources/wearos_square/hardware.ini
new file mode 100644
index 00000000..3f8ab78b
--- /dev/null
+++ b/mode/resources/device-art-resources/wearos_square/hardware.ini
@@ -0,0 +1,3 @@
+# skin-specific hardware values
+hw.rotaryInput=yes
+hw.sensors.heart_rate=yes
diff --git a/mode/resources/device-art-resources/wearos_square/layout b/mode/resources/device-art-resources/wearos_square/layout
new file mode 100644
index 00000000..d1f9278d
--- /dev/null
+++ b/mode/resources/device-art-resources/wearos_square/layout
@@ -0,0 +1,46 @@
+parts {
+ portrait {
+ background {
+ image device_bezel.png
+ }
+ }
+
+ device {
+ display {
+ width 360
+ height 360
+ x 0
+ y 0
+ }
+ }
+}
+
+layouts {
+ portrait {
+ width 432
+ height 432
+ color 0x1f1f1f
+ event EV_SW:0:1
+
+ part1 {
+ name portrait
+ x 18
+ y 18
+ }
+
+ part2 {
+ name device
+ x 36
+ y 36
+ }
+ }
+}
+
+keyboard {
+ charmap qwerty2
+}
+
+network {
+ speed full
+ delay none
+}
diff --git a/mode/src/processing/mode/android/AVD.java b/mode/src/processing/mode/android/AVD.java
index dae862ae..47bf632f 100644
--- a/mode/src/processing/mode/android/AVD.java
+++ b/mode/src/processing/mode/android/AVD.java
@@ -24,7 +24,6 @@
import processing.app.Base;
import processing.app.Platform;
import processing.app.Preferences;
-import processing.app.exec.LineProcessor;
import processing.app.exec.StreamPump;
import processing.core.PApplet;
@@ -46,16 +45,14 @@ public class AVD {
public final static String DEFAULT_WEAR_PORT = "5576";
private static final String GETTING_START_TUT_URL =
- "http://android.processing.org/tutorials/getting_started/index.html";
-
- static final String DEFAULT_SDCARD_SIZE = "64M";
-
- static final String DEVICE_DEFINITION = "Nexus One";
- static final String DEVICE_SKIN = "480x800";
-
- static final String DEVICE_WEAR_DEFINITION = "wear_square_280_280dpi";
- static final String DEVICE_WEAR_SKIN = "280x280";
-
+ "http://android.processing.org/tutorials/getting_started/index.html";
+
+ static final String DEVICE_DEFINITION = "pixel_6";
+ static final String DEVICE_SKIN = "pixel_6";
+
+ static final String DEVICE_WEAR_DEFINITION = "wearos_square";
+ static final String DEVICE_WEAR_SKIN = "wearos_square";
+
/** Name of this avd. */
protected String name;
@@ -137,9 +134,9 @@ static public String getPreferredPort(boolean wear) {
static protected String getPreferredTag(boolean wear, String abi) {
if (wear) {
return "android-wear";
- } else if (abi.contains("arm")) {
- // The ARM images are located in the default folder.
- return "default";
+// } else if (abi.contains("arm")) {
+// // The ARM images are located in the default folder. No, apparently ARM images are in google_apis too
+// return "default";
} else {
return "google_apis";
}
@@ -298,10 +295,10 @@ protected void getImages(final ArrayList images, final AndroidSDK sdk,
"create", "avd",
"-n", "dummy",
"-k", "dummy"
- };
-
- // Dummy avdmanager creation command to get the list of installed images
- // TODO : Find a better way to get the list of installed images
+ };
+
+ // Dummy avdmanager creation command to get the list of installed images,
+ // so far this is the only method available get that list.
ProcessBuilder pb = new ProcessBuilder(cmd);
if (Base.DEBUG) {
@@ -315,23 +312,21 @@ protected void getImages(final ArrayList images, final AndroidSDK sdk,
try {
process = pb.start();
+ StringWriter outWriter = new StringWriter();
+ new StreamPump(process.getInputStream(), "out: ").addTarget(outWriter).start();
+ process.waitFor();
- StreamPump output = new StreamPump(process.getInputStream(), "out: ");
- output.addTarget(new LineProcessor() {
- @Override
- public void processLine(String line) {
-// System.out.println("dummy output ---> " + line);
- if (images != null &&
- line.contains(";" + imagePlatform) &&
- line.contains(";" + imageTag) &&
- line.contains(";" + imageAbi)) {
+ String[] lines = PApplet.split(outWriter.toString(), '\n');
+ for (String line : lines) {
+ if (images != null &&
+ line.contains(";" + imagePlatform) &&
+ line.contains(";" + imageTag) &&
+ line.contains(";" + imageAbi)) {
// System.out.println(" added image!");
- images.add(line);
- }
+ images.add(line);
}
- }).start();
+ }
- process.waitFor();
} catch (final InterruptedException ie) {
ie.printStackTrace();
} finally {
@@ -357,6 +352,16 @@ protected String getSdkId() throws IOException {
return "null";
}
+ protected void copyDeviceSkins(final AndroidSDK sdk, final AndroidMode mode) {
+ File skinsFolder = new File(sdk.getFolder(), "skins");
+ if (!skinsFolder.exists()) {
+ // The skins in this folder come from Android Studio, on Mac they are in the folder:
+ // /Applications/Android Studio.app/Contents/plugins/android/resources/device-art-resources
+ // Apparently the skins are not available as a SDK download.
+ File artFolder = new File(mode.getResourcesFolder(), "device-art-resources");
+ AndroidUtil.copyDir(artFolder, skinsFolder);
+ }
+ }
protected boolean create(final AndroidSDK sdk) throws IOException {
File sketchbookFolder = processing.app.Base.getSketchbookFolder();
@@ -370,10 +375,10 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
"create", "avd",
"-n", name,
"-k", getSdkId(),
- "-c", DEFAULT_SDCARD_SIZE,
- "-d", device,
"-p", avdPath.getAbsolutePath(),
- "-f"
+ "-d", device,
+ "--skin", skin,
+ "--force"
};
ProcessBuilder pb = new ProcessBuilder(cmd);
@@ -383,9 +388,8 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
}
// avdmanager create avd -n "Wear-Processing-0254" -k "system-images;android-25;google_apis;x86" -c 64M
-
// Set the list to null so that exists() will check again
- avdList = null;
+// avdList = null;
Map env = pb.environment();
env.clear();
@@ -396,13 +400,13 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
process = pb.start();
// Passes 'no' to "Do you wish to create a custom hardware profile [no]"
- OutputStream os = process.getOutputStream();
- PrintWriter pw = new PrintWriter(new OutputStreamWriter(os));
- pw.println("no");
- pw.flush();
- pw.close();
- os.flush();
- os.close();
+// OutputStream os = process.getOutputStream();
+// PrintWriter pw = new PrintWriter(new OutputStreamWriter(os));
+// pw.println("no");
+// pw.flush();
+// pw.close();
+// os.flush();
+// os.close();
StringWriter outWriter = new StringWriter();
new StreamPump(process.getInputStream(), "out: ").addTarget(outWriter).start();
@@ -411,13 +415,13 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
if (process.exitValue() == 0) {
// Add skin to AVD's config file
- File configFile = new File(avdPath, "config.ini");
- if (configFile.exists()) {
- try (PrintWriter output = new PrintWriter(new FileWriter(configFile.getAbsolutePath(), true))) {
- output.printf("%s\r\n", "skin.name=" + skin);
- }
- catch (Exception e) {}
- }
+// File configFile = new File(avdPath, "config.ini");
+// if (configFile.exists()) {
+// try (PrintWriter output = new PrintWriter(new FileWriter(configFile.getAbsolutePath(), true))) {
+// output.printf("%s\r\n", "skin.name=" + skin);
+// }
+// catch (Exception e) {}
+// }
return true;
}
@@ -431,7 +435,6 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
AndroidMode.getTextString("android_avd.error.cannot_create_avd_body", AndroidBuild.TARGET_SDK));
}
System.err.println(outWriter.toString());
- //System.err.println(createAvdResult);
} catch (final InterruptedException ie) {
ie.printStackTrace();
} finally {
@@ -460,13 +463,14 @@ static public boolean ensureProperAVD(final Frame window, final AndroidMode mode
// ABI again.
AVD other = wear ? phoneAVD : watchAVD;
boolean ask = !other.hasImages(sdk);
- boolean res = AndroidSDK.locateSysImage(window, mode, wear, ask);
+ boolean res = AndroidSDK.requestSysImage(window, mode, wear, ask);
if (!res) {
return false;
} else {
avd.refreshImages(sdk);
}
}
+ avd.copyDeviceSkins(sdk, mode);
if (avd.create(sdk)) {
return true;
}
diff --git a/mode/src/processing/mode/android/AndroidMode.java b/mode/src/processing/mode/android/AndroidMode.java
index b456bfc6..6d35f855 100644
--- a/mode/src/processing/mode/android/AndroidMode.java
+++ b/mode/src/processing/mode/android/AndroidMode.java
@@ -188,7 +188,12 @@ public void checkSDK(Editor editor) {
public AndroidSDK getSDK() {
return sdk;
}
-
+
+
+ public File getResourcesFolder() {
+ return new File(getFolder(), "resources");
+ }
+
public String getModeJar() {
String modePath = new File(getFolder(), "mode").getAbsolutePath();
diff --git a/mode/src/processing/mode/android/AndroidSDK.java b/mode/src/processing/mode/android/AndroidSDK.java
index 07509944..18b988ed 100644
--- a/mode/src/processing/mode/android/AndroidSDK.java
+++ b/mode/src/processing/mode/android/AndroidSDK.java
@@ -522,8 +522,8 @@ static public AndroidSDK locate(final Frame window, final AndroidMode androidMod
}
}
- static public boolean locateSysImage(final Frame window,
- final AndroidMode androidMode, final boolean wear, final boolean ask)
+ static public boolean requestSysImage(final Frame window,
+ final AndroidMode androidMode, final boolean wear, final boolean ask)
throws BadSDKException, CancelException, IOException {
final int result = showDownloadSysImageDialog(window, wear);
if (result == JOptionPane.YES_OPTION) {
diff --git a/mode/src/processing/mode/android/AndroidUtil.java b/mode/src/processing/mode/android/AndroidUtil.java
index 80772baf..f73e86db 100644
--- a/mode/src/processing/mode/android/AndroidUtil.java
+++ b/mode/src/processing/mode/android/AndroidUtil.java
@@ -33,7 +33,12 @@
import java.util.zip.ZipFile;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
-
+import java.nio.file.Paths;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.FileVisitResult;
+import java.nio.file.attribute.BasicFileAttributes;
+
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
@@ -306,4 +311,37 @@ static public void moveDir(File from, File to) {
ex.printStackTrace();
}
}
+
+ static public void copyDir(File from, File to) {
+ final Path source = Paths.get(from.toURI());
+ final Path target = Paths.get(to.toURI());
+
+ SimpleFileVisitor copyVisitor = new SimpleFileVisitor() {
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
+ Path resolve = target.resolve(source.relativize(dir));
+ if (Files.notExists(resolve)) Files.createDirectories(resolve);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ Path resolve = target.resolve(source.relativize(file));
+ Files.copy(file, resolve, StandardCopyOption.REPLACE_EXISTING);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) {
+ System.err.format("Unable to copy: %s: %s%n", file, exc);
+ return FileVisitResult.CONTINUE;
+ }
+ };
+
+ try {
+ Files.walkFileTree(source, copyVisitor);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/mode/src/processing/mode/android/SDKDownloader.java b/mode/src/processing/mode/android/SDKDownloader.java
index 65561403..58397611 100644
--- a/mode/src/processing/mode/android/SDKDownloader.java
+++ b/mode/src/processing/mode/android/SDKDownloader.java
@@ -63,8 +63,8 @@ public class SDKDownloader extends JDialog implements PropertyChangeListener {
private static final String REPOSITORY_URL = "https://dl.google.com/android/repository/";
private static final String HAXM_URL = "https://dl.google.com/android/repository/extras/intel/";
- private static final String REPOSITORY_LIST = "repository2-1.xml";
- private static final String ADDON_LIST = "addon2-1.xml";
+ private static final String REPOSITORY_LIST = "repository2-3.xml";
+ private static final String ADDON_LIST = "addon2-3.xml";
public static final boolean DOWNLOAD_EMU_WITH_SDK = false;
diff --git a/mode/src/processing/mode/android/SysImageDownloader.java b/mode/src/processing/mode/android/SysImageDownloader.java
index 330cb618..0b626fca 100644
--- a/mode/src/processing/mode/android/SysImageDownloader.java
+++ b/mode/src/processing/mode/android/SysImageDownloader.java
@@ -61,10 +61,10 @@ public class SysImageDownloader extends JDialog implements PropertyChangeListene
private static final String SYS_IMAGES_ARM_URL = "https://dl.google.com/android/repository/sys-img/android/";
private static final String SYS_IMAGES_PHONE_URL = "https://dl.google.com/android/repository/sys-img/google_apis/";
- private static final String SYS_IMAGES_PHONE_LIST = "sys-img2-1.xml";
+ private static final String SYS_IMAGES_PHONE_LIST = "sys-img2-3.xml";
private static final String SYS_IMAGES_WEAR_URL = "https://dl.google.com/android/repository/sys-img/android-wear/";
- private static final String SYS_IMAGES_WEAR_LIST = "sys-img2-1.xml";
+ private static final String SYS_IMAGES_WEAR_LIST = "sys-img2-3.xml";
private static final String EMULATOR_GUIDE_URL =
"https://developer.android.com/studio/run/emulator-acceleration.html";
diff --git a/mode/tools/SDKUpdater/.classpath b/mode/tools/SDKUpdater/.classpath
index c1ab8ca2..e79c28a0 100644
--- a/mode/tools/SDKUpdater/.classpath
+++ b/mode/tools/SDKUpdater/.classpath
@@ -6,9 +6,16 @@
-
-
+
+
+
+
+
+
+
+
+
diff --git a/mode/tools/SDKUpdater/.project b/mode/tools/SDKUpdater/.project
index 62e8abd8..4dc71227 100644
--- a/mode/tools/SDKUpdater/.project
+++ b/mode/tools/SDKUpdater/.project
@@ -1,6 +1,6 @@
- SDKUpdater
+ android-mode-sdkupdater
diff --git a/mode/tools/SDKUpdater/.settings/org.eclipse.buildship.core.prefs b/mode/tools/SDKUpdater/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 00000000..e8895216
--- /dev/null
+++ b/mode/tools/SDKUpdater/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,2 @@
+connection.project.dir=
+eclipse.preferences.version=1
diff --git a/mode/tools/SDKUpdater/build.gradle b/mode/tools/SDKUpdater/build.gradle
index 107c6c81..a47fffbb 100644
--- a/mode/tools/SDKUpdater/build.gradle
+++ b/mode/tools/SDKUpdater/build.gradle
@@ -12,21 +12,28 @@ dependencies {
implementationCopy group: "com.android.tools", name: "sdklib", version: "${toolsLibVersion}"
implementationCopy group: "com.android.tools", name: "repository", version: "${toolsLibVersion}"
+ implementationCopy group: "com.android.tools", name: "common", version: "${toolsLibVersion}"
}
// This task copies the gradle tooling jar into the mode folder
task copyToLib(type: Copy) {
from configurations.implementationCopy.files {
- include '**/annotations-*'
- include '**/common-*'
- include '**/dvlib-*'
- include '**/gson-*'
- include '**/guava-*'
- include '**/httpcore-*'
- include '**/kotlin-stdlib-*'
- include '**/layoutlib-api-*'
- include '**/repository-*'
- include '**/sdklib-*'
+
+ include '**/common-*jar'
+ include '**/commons-compress-*jar'
+ include '**/guava-*jar'
+ include '**/httpcore-*jar'
+ include '**/istack-*jar'
+ include '**/jakarta.activation-api-*jar'
+ include '**/jakarta.xml.bind-api-*jar'
+ include '**/jaxb-runtime-*jar'
+ include '**/kotlin-stdlib-1*jar'
+ include '**/shared-*jar'
+ include '**/protos-*jar'
+ include '**/protob*jar'
+ include '**/sdklib-*jar'
+ include '**/repository-*jar'
+
}
into "lib"
}
diff --git a/mode/tools/SDKUpdater/src/processing/mode/android/tools/SDKUpdater.java b/mode/tools/SDKUpdater/src/processing/mode/android/tools/SDKUpdater.java
index b58ee8b3..685b6716 100644
--- a/mode/tools/SDKUpdater/src/processing/mode/android/tools/SDKUpdater.java
+++ b/mode/tools/SDKUpdater/src/processing/mode/android/tools/SDKUpdater.java
@@ -4,7 +4,7 @@
Part of the Processing project - http://processing.org
Copyright (c) 2017 The Processing Foundation
-
+
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.
@@ -23,13 +23,12 @@
import com.android.repository.api.*;
import com.android.repository.impl.meta.RepositoryPackages;
-import com.android.repository.io.FileOpUtils;
-import com.android.repository.io.impl.FileSystemFileOp;
import com.android.repository.util.InstallerUtil;
import com.android.sdklib.repository.AndroidSdkHandler;
import com.android.sdklib.repository.installer.SdkInstallerUtil;
import com.android.sdklib.repository.legacy.LegacyDownloader;
import com.android.sdklib.tool.sdkmanager.SdkManagerCli;
+import com.android.prefs.AndroidLocationsSingleton;
import processing.app.Base;
import processing.app.Preferences;
@@ -59,22 +58,22 @@
@SuppressWarnings("serial")
public class SDKUpdater extends JFrame implements PropertyChangeListener, Tool {
- final static private int NUM_ROWS = 10;
+ final static private int NUM_ROWS = 10;
final static private int COL_WIDTH = Toolkit.zoom(220);
-
+
final static private int BORDER = Toolkit.zoom(13);
final static private int GAP = Toolkit.zoom(13);
final static private int INSET = Toolkit.zoom(1);
- final static private int BUTTON_WIDTH = Toolkit.zoom(75);
+ final static private int BUTTON_WIDTH = Toolkit.zoom(85);
final static private int BUTTON_HEIGHT = Toolkit.zoom(25);
-
-// private final Vector columns = new Vector<>(Arrays.asList(
-// AndroidMode.getTextString("sdk_updater.name_column"),
+
+ // private final Vector columns = new Vector<>(Arrays.asList(
+// AndroidMode.getTextString("sdk_updater.name_column"),
// AndroidMode.getTextString("sdk_updater.version_column"),
-// AndroidMode.getTextString("sdk_updater.available_column")));
+// AndroidMode.getTextString("sdk_updater.available_column")));
private final Vector columns = new Vector<>(Arrays.asList(
- "Package name", "Installed version", "Available update" ));
-
+ "Package name", "Installed version", "Available update" ));
+
private static final String PROPERTY_CHANGE_QUERY = "query";
private File sdkFolder;
@@ -84,72 +83,77 @@ public class SDKUpdater extends JFrame implements PropertyChangeListener, Tool {
private boolean downloadTaskRunning;
private Vector> packageList;
- private DefaultTableModel packageTable;
+ private DefaultTableModel packageTable;
private int numUpdates;
private JProgressBar progressBar;
private JLabel status;
+ private JLabel statusSecondary;
private JButton actionButton;
private JTable table;
-
+
@Override
public void init(Base base) {
createLayout(base.getActiveEditor() == null);
}
-
+
@Override
public void run() {
setVisible(true);
String path = Preferences.get("android.sdk.path");
- sdkFolder = new File(path);
+ sdkFolder = new File(path);
queryTask = new QueryTask();
queryTask.addPropertyChangeListener(this);
queryTask.execute();
// status.setText(AndroidMode.getTextString("sdk_updater.query_message"));
- status.setText("Querying packages...");
+ status.setText("Querying packages...");
+ statusSecondary.setText("");
}
-
-
+
+
@Override
- public String getMenuTitle() {
+ public String getMenuTitle() {
// return AndroidMode.getTextString("menu.android.sdk_updater");
return "SDK Updater";
}
-
-
+
+
@Override
public void propertyChange(PropertyChangeEvent evt) {
switch (evt.getPropertyName()) {
- case PROPERTY_CHANGE_QUERY:
- progressBar.setIndeterminate(false);
- if (numUpdates == 0) {
- actionButton.setEnabled(false);
-// status.setText(AndroidMode.getTextString("sdk_updater.no_updates_message"));
- status.setText("No updates available");
- } else {
- actionButton.setEnabled(true);
- if (numUpdates == 1) {
+ case PROPERTY_CHANGE_QUERY:
+ progressBar.setIndeterminate(false);
+ if (numUpdates == 0) {
+ actionButton.setEnabled(false);
+// status.setText(AndroidMode.getTextString("sdk_updater.no_updates_message"));
+ status.setText("No updates available");
+ statusSecondary.setText("");
+ } else {
+ actionButton.setEnabled(true);
+ if (numUpdates == 1) {
// status.setText(AndroidMode.getTextString("sdk_updater.one_updates_message"));
- status.setText("1 update found!");
- } else {
+ status.setText("1 update found!");
+ statusSecondary.setText("");
+ } else {
// status.setText(AndroidMode.getTextString("sdk_updater.many_updates_message", numUpdates));
- status.setText(numUpdates + " updates found!");
- }
- }
- break;
+ status.setText(numUpdates + " updates found!");
+ statusSecondary.setText("");
+ }
+ }
+ break;
}
}
class QueryTask extends SwingWorker