Skip to content

Commit 4adcf3d

Browse files
authored
Merge pull request #706 from rupeshkumar22/emulator_improvements
Emulator Support and Improvements - Ready To Merge
2 parents 8afa75b + a92de0d commit 4adcf3d

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

mode/languages/mode.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,15 @@ android_mode.warn.cannot_load_sdk_title = Bad news...
108108
android_mode.warn.cannot_load_sdk_body = The Android SDK could not be loaded.\nThe Android Mode will be disabled.
109109
android_mode.info.cannot_open_sdk_path = "Android SDK path couldn't be opened.";
110110
android_mode.error.cannot_create_avd = "Could not create a virtual device for the emulator.";
111+
android_mode.error.emulator_installation_failed = "Encountered Issues with the emulator installation. Result Code is non-zero";
111112
android_mode.dialog.no_devices_found_title = No devices found!
112113
android_mode.dialog.no_devices_found_body = Processing did not find any device where to run\nyour sketch on. Make sure that your handheld or\nwearable is properly connected to the computer\nand that USB or Bluetooth debugging is enabled.
113114
android_mode.status.no_devices_found = No devices found.
114115
android_mode.status.starting_project_build = Starting build...
115116
android_mode.status.building_project = Building Android project...
116117
android_mode.status.project_build_failed = Build failed.
118+
android_mode.status.downloading_emulator = Downloading Emulator...
119+
android_mode.status.downloading_emulator_successful = Emulator installation was successful.
117120

118121
# ---------------------------------------
119122
# Android Preprocessor
@@ -256,7 +259,7 @@ keystore_manager.country_code_label = Country code (XX):
256259
# Manifest
257260

258261
manifest.warn.cannot_handle_file_title = Error handling %s
259-
manifest.warn.cannot_handle_file_body = Errors occurred while reading or writing %s\nwhich means lots of things are likely to stop working properly.\nTo prevent losing any data, it's recommended that you use “Save As”\n"to save a separate copy of your sketch, and then restart Processing.";
262+
manifest.warn.cannot_handle_file_body = Errors occurred while reading or writing %s\nwhich means lots of things are likely to stop working properly.\nTo prevent losing any data, it's recommended that you use “Save As”\n"to save a separate copy of your sketch, and then restart Processing.";
260263

261264
# ---------------------------------------
262265
# Permissions

mode/src/processing/mode/android/AndroidEditor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public boolean handleSaveAs() {
124124

125125
public JMenu buildFileMenu() {
126126
String exportPackageTitle = AndroidToolbar.getTitle(AndroidToolbar.EXPORT_PACKAGE);
127-
JMenuItem exportPackage = Toolkit.newJMenuItemExt(exportPackageTitle);
127+
JMenuItem exportPackage = Toolkit.newJMenuItemShift(exportPackageTitle,'T');
128128
exportPackage.addActionListener(new ActionListener() {
129129
public void actionPerformed(ActionEvent e) {
130130
handleExportPackage();

mode/src/processing/mode/android/AndroidMode.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,16 @@ public void handleRunEmulator(Sketch sketch, AndroidEditor editor,
241241
build.build("debug", "");
242242

243243
if (sdk.getEmulatorTool() == null) {
244-
System.out.println("Try to download the emulator using the SDK Manager...");
245-
sdk.downloadEmuOnDemand();
244+
// System.out.println("Try to download the emulator using the SDK Manager...");
245+
listener.statusNotice(AndroidMode.getTextString("android_mode.status.downloading_emulator"));
246+
boolean emulatorInstallationSucceded = sdk.downloadEmuOnDemand();
247+
if (!emulatorInstallationSucceded) {
248+
SketchException emulatorInstallationErrorException = new SketchException(AndroidMode.getTextString("android_mode.error.emulator_installation_failed"));
249+
emulatorInstallationErrorException.hideStackTrace();
250+
throw emulatorInstallationErrorException;
251+
} else {
252+
System.out.println(AndroidMode.getTextString("android_mode.status.downloading_emulator_successful"));
253+
}
246254
}
247255

248256
boolean avd = AVD.ensureProperAVD(editor, this, sdk, build.isWear());

mode/src/processing/mode/android/RedirectStreamHandler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
public class RedirectStreamHandler extends Thread {
11-
// Streams to redirect from and to
11+
// Streams Redirection- from and to
1212
private final InputStream input;
1313
private final PrintWriter output;
1414

@@ -24,11 +24,11 @@ public void run() {
2424
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
2525
String line;
2626
while ((line = reader.readLine()) != null) {
27+
// print to output line by line
2728
output.println(line);
2829
}
29-
} catch (IOException ioe) {
30-
// OK to ignore...
31-
System.out.println("Level.WARNING____I/O Redirection failure: "+ ioe.toString());
30+
} catch (IOException ioException) {
31+
System.out.println("I/O Redirection failure: "+ ioException.toString());
3232
}
3333
}
3434
}

0 commit comments

Comments
 (0)