11package processing .mode .android ;
22
33import processing .app .Base ;
4+ import processing .app .Messages ;
45import processing .app .exec .ProcessHelper ;
56import processing .app .exec .ProcessResult ;
67import processing .core .PApplet ;
@@ -29,7 +30,7 @@ public class AVD {
2930 "This could mean that the Android tools need to be updated,<br>" +
3031 "or that the Processing AVD should be deleted (it will<br>" +
3132 "automatically re-created the next time you run Processing).<br>" +
32- "Open the Android SDK Manager (underneath the Android menu)<br>" +
33+ "Open the Android SDK Manager (underneath the Android menu)<br>" +
3334 "to check for any errors." ;
3435
3536 static private final String AVD_TARGET_PRIMARY =
@@ -53,7 +54,7 @@ public class AVD {
5354
5455 private Map <String , String > preferredAbi = new HashMap <>(30 );
5556 private static List <String > abiList = new ArrayList <>();
56-
57+
5758 /** Default virtual device used by Processing. */
5859 static public final AVD defaultAVD =
5960 new AVD ("Processing-0" + Base .getRevision (),
@@ -63,10 +64,10 @@ public class AVD {
6364 public AVD (final String name , final String target ) {
6465 this .name = name ;
6566 this .target = target ;
66-
67+
6768 initializeAbiList ();
6869 }
69-
70+
7071 private void initializeAbiList () {
7172 if (abiList .size () == 0 ) {
7273 //The order in this list determines the preference of one abi over the other
@@ -131,9 +132,9 @@ protected boolean exists(final AndroidSDK sdk) throws IOException {
131132 }
132133
133134
134- /**
135- * Return true if a member of the renowned and prestigious
136- * "The following Android Virtual Devices could not be loaded:" club.
135+ /**
136+ * Return true if a member of the renowned and prestigious
137+ * "The following Android Virtual Devices could not be loaded:" club.
137138 * (Prestigious may also not be the right word.)
138139 */
139140 protected boolean badness () {
@@ -147,12 +148,12 @@ protected boolean badness() {
147148
148149
149150 protected boolean create (final AndroidSDK sdk ) throws IOException {
150-
151+
151152 final String [] list_abi = {
152153 sdk .getAndroidToolPath (),
153154 "list" , "targets"
154155 };
155-
156+
156157 ProcessHelper p = new ProcessHelper (list_abi );
157158 try {
158159 final ProcessResult abiListResult = p .execute ();
@@ -163,11 +164,11 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
163164 if (m != null ) {
164165 api = m [1 ];
165166 }
166-
167+
167168 m = PApplet .match (line , "Tag\\ /ABIs\\ s:\\ sdefault\\ /(\\ S+)" );
168169 if (m != null ) {
169170 abi = m [1 ];
170-
171+
171172 if (api != null && abi != null ) {
172173 if (preferredAbi .get (api ) == null ) {
173174 preferredAbi .put (api , abi );
@@ -180,15 +181,15 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
180181 }
181182 }
182183 } catch (InterruptedException e ) {}
183-
184+
184185 if (preferredAbi .get (AndroidBuild .sdkVersion ) == null ) {
185186 return false ;
186187 }
187-
188+
188189 final String [] params = {
189190 sdk .getAndroidToolPath (),
190191 "create" , "avd" ,
191- "-n" , name ,
192+ "-n" , name ,
192193 "-t" , target ,
193194 "-c" , DEFAULT_SDCARD_SIZE ,
194195 "-s" , DEFAULT_SKIN ,
@@ -209,12 +210,12 @@ protected boolean create(final AndroidSDK sdk) throws IOException {
209210 }
210211 if (createAvdResult .toString ().contains ("Target id is not valid" )) {
211212 // They didn't install the Google APIs
212- Base .showWarningTiered ("Android Error" , AVD_TARGET_PRIMARY , AVD_TARGET_SECONDARY , null );
213+ Messages .showWarningTiered ("Android Error" , AVD_TARGET_PRIMARY , AVD_TARGET_SECONDARY , null );
213214// throw new IOException("Missing required SDK components");
214215 } else {
215216 // Just generally not working
216217// Base.showWarning("Android Error", AVD_CREATE_ERROR, null);
217- Base .showWarningTiered ("Android Error" , AVD_CREATE_PRIMARY , AVD_CREATE_SECONDARY , null );
218+ Messages .showWarningTiered ("Android Error" , AVD_CREATE_PRIMARY , AVD_CREATE_SECONDARY , null );
218219 System .out .println (createAvdResult );
219220// throw new IOException("Error creating the AVD");
220221 }
@@ -234,7 +235,7 @@ static public boolean ensureProperAVD(final AndroidSDK sdk) {
234235// if (badList.contains(defaultAVD)) {
235236 if (defaultAVD .badness ()) {
236237// Base.showWarning("Android Error", AVD_CANNOT_LOAD, null);
237- Base .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
238+ Messages .showWarningTiered ("Android Error" , AVD_LOAD_PRIMARY , AVD_LOAD_SECONDARY , null );
238239 return false ;
239240 }
240241 if (defaultAVD .create (sdk )) {
@@ -243,8 +244,9 @@ static public boolean ensureProperAVD(final AndroidSDK sdk) {
243244 }
244245 } catch (final Exception e ) {
245246// Base.showWarning("Android Error", AVD_CREATE_ERROR, e);
246- Base .showWarningTiered ("Android Error" , AVD_CREATE_PRIMARY ,
247- String .format (AVD_CREATE_SECONDARY , AndroidBuild .sdkVersion ), null );
247+ Messages .showWarningTiered ("Android Error" , AVD_CREATE_PRIMARY ,
248+ String .format (AVD_CREATE_SECONDARY ,
249+ AndroidBuild .sdkVersion ), null );
248250 }
249251 return false ;
250252 }
0 commit comments