Skip to content

Emulator Support and Improvements - Ready To Merge #706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion mode/languages/mode.properties
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,15 @@ android_mode.warn.cannot_load_sdk_title = Bad news...
android_mode.warn.cannot_load_sdk_body = The Android SDK could not be loaded.\nThe Android Mode will be disabled.
android_mode.info.cannot_open_sdk_path = "Android SDK path couldn't be opened.";
android_mode.error.cannot_create_avd = "Could not create a virtual device for the emulator.";
android_mode.error.emulator_installation_failed = "Encountered Issues with the emulator installation. Result Code is non-zero";
android_mode.dialog.no_devices_found_title = No devices found!
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.
android_mode.status.no_devices_found = No devices found.
android_mode.status.starting_project_build = Starting build...
android_mode.status.building_project = Building Android project...
android_mode.status.project_build_failed = Build failed.
android_mode.status.downloading_emulator = Downloading Emulator...
android_mode.status.downloading_emulator_successful = Emulator installation was successful.

# ---------------------------------------
# Android Preprocessor
Expand Down Expand Up @@ -256,7 +259,7 @@ keystore_manager.country_code_label = Country code (XX):
# Manifest

manifest.warn.cannot_handle_file_title = Error handling %s
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.";
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.";

# ---------------------------------------
# Permissions
Expand Down
2 changes: 1 addition & 1 deletion mode/src/processing/mode/android/AndroidEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public boolean handleSaveAs() {

public JMenu buildFileMenu() {
String exportPackageTitle = AndroidToolbar.getTitle(AndroidToolbar.EXPORT_PACKAGE);
JMenuItem exportPackage = Toolkit.newJMenuItemExt(exportPackageTitle);
JMenuItem exportPackage = Toolkit.newJMenuItemShift(exportPackageTitle,'T');
exportPackage.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
handleExportPackage();
Expand Down
12 changes: 10 additions & 2 deletions mode/src/processing/mode/android/AndroidMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,16 @@ public void handleRunEmulator(Sketch sketch, AndroidEditor editor,
build.build("debug", "");

if (sdk.getEmulatorTool() == null) {
System.out.println("Try to download the emulator using the SDK Manager...");
sdk.downloadEmuOnDemand();
// System.out.println("Try to download the emulator using the SDK Manager...");
listener.statusNotice(AndroidMode.getTextString("android_mode.status.downloading_emulator"));
boolean emulatorInstallationSucceded = sdk.downloadEmuOnDemand();
if (!emulatorInstallationSucceded) {
SketchException emulatorInstallationErrorException = new SketchException(AndroidMode.getTextString("android_mode.error.emulator_installation_failed"));
emulatorInstallationErrorException.hideStackTrace();
throw emulatorInstallationErrorException;
} else {
System.out.println(AndroidMode.getTextString("android_mode.status.downloading_emulator_successful"));
}
}

boolean avd = AVD.ensureProperAVD(editor, this, sdk, build.isWear());
Expand Down
8 changes: 4 additions & 4 deletions mode/src/processing/mode/android/RedirectStreamHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


public class RedirectStreamHandler extends Thread {
// Streams to redirect from and to
// Streams Redirection- from and to
private final InputStream input;
private final PrintWriter output;

Expand All @@ -24,11 +24,11 @@ public void run() {
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
String line;
while ((line = reader.readLine()) != null) {
// print to output line by line
output.println(line);
}
} catch (IOException ioe) {
// OK to ignore...
System.out.println("Level.WARNING____I/O Redirection failure: "+ ioe.toString());
} catch (IOException ioException) {
System.out.println("I/O Redirection failure: "+ ioException.toString());
}
}
}