Skip to content

Commit af0e6fc

Browse files
committed
hi-dpi handling for SDK selection dialog
1 parent fc7a1ac commit af0e6fc

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

src/processing/mode/android/AndroidSDK.java

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
import processing.app.Messages;
2525
import processing.app.Platform;
2626
import processing.app.Preferences;
27-
import processing.app.Util;
2827
import processing.app.exec.ProcessHelper;
2928
import processing.app.exec.ProcessResult;
29+
import processing.app.ui.Toolkit;
3030
import processing.core.PApplet;
3131

3232
import javax.swing.*;
@@ -51,6 +51,10 @@
5151
class AndroidSDK {
5252
public static boolean adbDisabled = false;
5353

54+
final static private int FONT_SIZE = Toolkit.zoom(11);
55+
final static private int TEXT_MARGIN = Toolkit.zoom(8);
56+
final static private int TEXT_WIDTH = Toolkit.zoom(300);
57+
5458
private final File folder;
5559
private final File tools;
5660
private final File platforms;
@@ -71,8 +75,8 @@ class AndroidSDK {
7175
private static final String MISSING_SDK_MESSAGE =
7276
"The Android SDK does not appear to be installed, " +
7377
"because the ANDROID_SDK variable is not set. " +
74-
"If it is installed, click Locate SDK path to select the " +
75-
"location of the SDK, or Download SDK to let " +
78+
"If it is installed, click \"Locate SDK path\" to select the " +
79+
"location of the SDK, or \"Download SDK\" to let " +
7680
"Processing download the SDK automatically.<br><br>" +
7781
"If you want to download the SDK manually, you can get "+
7882
"the command line tools from <a href=\"" + SDK_DOWNLOAD_URL + "\">here</a>. " +
@@ -85,8 +89,8 @@ class AndroidSDK {
8589
"The Android SDK appears to be installed, " +
8690
"however the SDK platform for API " + AndroidBuild.TARGET_SDK +
8791
" was not found. If it is available in a different location, " +
88-
"click Locate SDK path to select the " +
89-
"location of the alternative SDK, or Download SDK to let " +
92+
"click \"Locate SDK path\" to select the " +
93+
"location of the alternative SDK, or \"Download SDK\" to let " +
9094
"Processing download the SDK automatically.<br><br>" +
9195
"If you want to download the SDK manually, you can get "+
9296
"the command line tools from <a href=\"" + SDK_DOWNLOAD_URL + "\">here</a>. " +
@@ -183,20 +187,6 @@ public AndroidSDK(File folder) throws BadSDKException, IOException {
183187

184188
path = new File(javaHome, "bin").getCanonicalPath() + File.pathSeparator + path;
185189
Platform.setenv("PATH", path);
186-
187-
188-
189-
// Util.contentsToClassPath()
190-
// path = new File(tools, "lib").getCanonicalPath() + File.pathSeparator + path;
191-
192-
193-
// repository-
194-
// sdklib-
195-
// common-
196-
// commons-compress-
197-
// httpcore-
198-
// guava-
199-
200190

201191
checkDebugCertificate();
202192
}
@@ -244,7 +234,7 @@ protected void checkDebugCertificate() {
244234
// System.out.println("Nah, that won't expire until " + date); //timestamp);
245235
}
246236
} catch (ParseException pe) {
247-
System.err.println("The date " + timestamp + " could not be parsed.");
237+
System.err.println("The date “" + timestamp + "� could not be parsed.");
248238
System.err.println("Please report this as a bug so we can fix it.");
249239
}
250240
}
@@ -441,8 +431,10 @@ static public int showLocateDialog(Frame editor) {
441431
// How to show a option dialog containing clickable links:
442432
// http://stackoverflow.com/questions/8348063/clickable-links-in-joptionpane
443433
String htmlString = "<html> " +
444-
"<head> <style type=\"text/css\">"+
445-
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px; width: 300px }"+
434+
"<head> <style type=\"text/css\">" +
435+
"p { font: " + FONT_SIZE + "pt \"Lucida Grande\"; " +
436+
"margin: " + TEXT_MARGIN + "px; " +
437+
"width: " + TEXT_WIDTH + "px }" +
446438
"</style> </head>";
447439
String title = "";
448440
if (SDK_LOAD_ERROR == MISSING_SDK) {
@@ -486,7 +478,9 @@ static public int showDownloadSysImageDialog(Frame editor, boolean wear) {
486478
String msg = wear ? ANDROID_SYS_IMAGE_WEAR_SECONDARY : ANDROID_SYS_IMAGE_SECONDARY;
487479
String htmlString = "<html> " +
488480
"<head> <style type=\"text/css\">"+
489-
"p { font: 11pt \"Lucida Grande\"; margin-top: 8px; width: 300px }"+
481+
"p { font: " + FONT_SIZE + "pt \"Lucida Grande\"; " +
482+
"margin: " + TEXT_MARGIN + "px; " +
483+
"width: " + TEXT_WIDTH + "px }" +
490484
"</style> </head>" + "<body> <p>" + msg + "</p> </body> </html>";
491485
JEditorPane pane = new JEditorPane("text/html", htmlString);
492486
pane.addHyperlinkListener(new HyperlinkListener() {

0 commit comments

Comments
 (0)