21
21
import android .net .Uri ;
22
22
import android .os .Bundle ;
23
23
import android .support .v4 .content .LocalBroadcastManager ;
24
- import android .util .Log ;
25
24
import android .view .Menu ;
26
25
import android .view .MenuItem ;
27
26
import android .view .View ;
@@ -133,7 +132,7 @@ private void initMainWithServer() {
133
132
public void onItemClick (AdapterView <?> adapter , View view , int position ,
134
133
long arg3 ) {
135
134
SettingHolder holder = (SettingHolder )view .getTag ();
136
- Log . v ( TAG , "Clicked " + holder .tag );
135
+ Logger . d ( "Clicked %s" , holder .tag );
137
136
if (holder .tag .equals ("server" )) {
138
137
searchForPlexServers ();
139
138
} else if (holder .tag .equals ("client" )) {
@@ -145,7 +144,7 @@ public void onItemClick(AdapterView<?> adapter, View view, int position,
145
144
});
146
145
147
146
CheckBox resumeCheckbox = (CheckBox )findViewById (R .id .resumeCheckbox );
148
- Log . v ( TAG , "checkbox: " + resumeCheckbox );
147
+ Logger . d ( "Checkbox: %s" , resumeCheckbox );
149
148
resumeCheckbox .setChecked (mPrefs .getBoolean ("resume" , false ));
150
149
}
151
150
@@ -221,15 +220,15 @@ private void searchForPlexServers() {
221
220
222
221
@ Override
223
222
public void onNewIntent (Intent intent ) {
224
- Log . v ( TAG , "ON NEW INTENT IN MAINACTIVITY" );
223
+ Logger . d ( "ON NEW INTENT IN MAINACTIVITY" );
225
224
String from = intent .getStringExtra ("FROM" );
226
- Log . v ( TAG , "From: " + from );
225
+ Logger . d ( "From: %s" , from );
227
226
if (from == null ) {
228
227
} else if (from .equals ("GDMReceiver" )) {
229
- Log . v ( TAG , "Origin: " + intent .getStringExtra ("ORIGIN" ));
228
+ Logger . d ( "Origin: " + intent .getStringExtra ("ORIGIN" ));
230
229
String origin = intent .getStringExtra ("ORIGIN" ) == null ? "" : intent .getStringExtra ("ORIGIN" );
231
230
if (origin .equals ("MainActivity" )) {
232
- Log . v ( TAG , "Got " + VoiceControlForPlexApplication .getPlexMediaServers ().size () + " servers" );
231
+ Logger . d ( "Got " + VoiceControlForPlexApplication .getPlexMediaServers ().size () + " servers" );
233
232
if (VoiceControlForPlexApplication .getPlexMediaServers ().size () > 0 ) {
234
233
showPlexServers ();
235
234
} else {
@@ -254,17 +253,16 @@ public void onClick(DialogInterface dialog, int id) {
254
253
255
254
private void scanServersForClients () {
256
255
ConcurrentHashMap <String , PlexServer > servers = VoiceControlForPlexApplication .getPlexMediaServers ();
257
- Log . v ( TAG , "ScanServersForClients, number of servers = " + servers .size ());
256
+ Logger . d ( "ScanServersForClients, number of servers = " + servers .size ());
258
257
serversScanned = 0 ;
259
258
for (PlexServer thisServer : servers .values ()) {
260
- Log . v ( TAG , "ScanServersForClients server: " + thisServer );
259
+ Logger . d ( "ScanServersForClients server: %s" , thisServer . getName () );
261
260
try {
262
261
AsyncHttpClient httpClient = new AsyncHttpClient ();
263
262
httpClient .get (thisServer .getClientsURL (), new AsyncHttpResponseHandler () {
264
263
@ Override
265
264
public void onSuccess (String response ) {
266
265
serversScanned ++;
267
- // Log.v(TAG, "HTTP REQUEST: " + response);
268
266
MediaContainer clientMC = new MediaContainer ();
269
267
270
268
try {
@@ -278,7 +276,7 @@ public void onSuccess(String response) {
278
276
List <PlexClient > clients = new ArrayList <PlexClient >();
279
277
for (int i =0 ;i <clientMC .clients .size ();i ++) {
280
278
float version = clientMC .clients .get (i ).getNumericVersion ();
281
- Log . v ( MainActivity . TAG , "Version: " + version );
279
+ Logger . d ( "Version: %f" , version );
282
280
if (version >= 1.07 || !clientMC .clients .get (i ).getProduct ().equals ("Plex Home Theater" )) {
283
281
clients .add (clientMC .clients .get (i ));
284
282
}
@@ -297,7 +295,7 @@ public void onClick(DialogInterface dialog, int id) {
297
295
AlertDialog d = builder .create ();
298
296
d .show ();
299
297
} else {
300
- Log . v ( TAG , "Clients: " + clients .size ());
298
+ Logger . d ( "Clients: " + clients .size ());
301
299
if (serversScanned == VoiceControlForPlexApplication .getPlexMediaServers ().size ()) {
302
300
showPlexClients (clients );
303
301
}
@@ -306,13 +304,13 @@ public void onClick(DialogInterface dialog, int id) {
306
304
});
307
305
308
306
} catch (Exception e ) {
309
- Log .e (TAG , "Exception getting clients: " + e .toString ());
307
+ Logger .e ("Exception getting clients: " + e .toString ());
310
308
}
311
309
}
312
310
}
313
311
314
312
private void showPlexServers () {
315
- Log . v ( TAG , "servers: " + VoiceControlForPlexApplication .getPlexMediaServers ().size ());
313
+ Logger . d ( "servers: " + VoiceControlForPlexApplication .getPlexMediaServers ().size ());
316
314
searchDialog .dismiss ();
317
315
if (serverSelectDialog == null ) {
318
316
serverSelectDialog = new Dialog (this );
@@ -332,7 +330,7 @@ private void showPlexServers() {
332
330
@ Override
333
331
public void onItemClick (AdapterView <?> parentAdapter , View view , int position ,
334
332
long id ) {
335
- Log . v ( TAG , "Clicked position " + position );
333
+ Logger . d ( "Clicked position %d" , position );
336
334
PlexServer s = (PlexServer )parentAdapter .getItemAtPosition (position );
337
335
serverSelectDialog .dismiss ();
338
336
setServer (s );
@@ -342,7 +340,7 @@ public void onItemClick(AdapterView<?> parentAdapter, View view, int position,
342
340
}
343
341
344
342
private void setServer (PlexServer server ) {
345
- Log . v ( TAG , "Setting Server " + server .getName ());
343
+ Logger . d ( "Setting Server %s" , server .getName ());
346
344
if (server .getAddress ().equals ("" )) {
347
345
this .server = null ;
348
346
saveSettings ();
@@ -357,7 +355,7 @@ private void setServer(PlexServer server) {
357
355
httpClient .get (server .getBaseURL (), new AsyncHttpResponseHandler () {
358
356
@ Override
359
357
public void onSuccess (String response ) {
360
- Log . v ( TAG , "HTTP REQUEST: " + response );
358
+ Logger . d ( "HTTP REQUEST: %s" , response );
361
359
MediaContainer mc = new MediaContainer ();
362
360
try {
363
361
mc = serial .read (MediaContainer .class , response );
@@ -366,13 +364,13 @@ public void onSuccess(String response) {
366
364
} catch (Exception e ) {
367
365
e .printStackTrace ();
368
366
}
369
- Log . v ( TAG , "Machine id: " + mc .getMachineIdentifier ());
367
+ Logger . d ( "Machine id: " + mc .getMachineIdentifier ());
370
368
getClients (mc );
371
369
}
372
370
});
373
371
374
372
} catch (Exception e ) {
375
- Log .e (TAG , "Exception getting clients: " + e .toString ());
373
+ Logger .e ("Exception getting clients: " + e .toString ());
376
374
}
377
375
} else {
378
376
this .server = server ;
@@ -422,7 +420,7 @@ private void getClients(MediaContainer mc) {
422
420
httpClient .get (server .getClientsURL (), new AsyncHttpResponseHandler () {
423
421
@ Override
424
422
public void onSuccess (String response ) {
425
- // Log.v(TAG, "HTTP REQUEST: " + response);
423
+ // Logger.d( "HTTP REQUEST: %s", response);
426
424
MediaContainer clientMC = new MediaContainer ();
427
425
428
426
try {
@@ -436,7 +434,7 @@ public void onSuccess(String response) {
436
434
List <PlexClient > clients = new ArrayList <PlexClient >();
437
435
for (int i =0 ;i <clientMC .clients .size ();i ++) {
438
436
float version = clientMC .clients .get (i ).getNumericVersion ();
439
- Log . v ( MainActivity . TAG , "Version: " + version );
437
+ Logger . d ( "Version: %f" , version );
440
438
if (version >= 1.07 ) {
441
439
clients .add (clientMC .clients .get (i ));
442
440
}
@@ -455,15 +453,15 @@ public void onClick(DialogInterface dialog, int id) {
455
453
AlertDialog d = builder .create ();
456
454
d .show ();
457
455
} else {
458
- Log . v ( TAG , "Clients: " + clients .size ());
456
+ Logger . d ( "Clients: " + clients .size ());
459
457
460
458
showPlexClients (clients );
461
459
}
462
460
}
463
461
});
464
462
465
463
} catch (Exception e ) {
466
- Log .e (TAG , "Exception getting clients: " + e .toString ());
464
+ Logger .e ("Exception getting clients: " + e .toString ());
467
465
}
468
466
}
469
467
@@ -494,7 +492,7 @@ public void onItemClick(AdapterView<?> parentAdapter, View view, int position,
494
492
495
493
private void setClient (PlexClient client ) {
496
494
this .client = client ;
497
- Log . v ( TAG , "Selected client: " + client .getName ());
495
+ Logger . d ( "Selected client: " + client .getName ());
498
496
saveSettings ();
499
497
initMainWithServer ();
500
498
}
@@ -509,11 +507,11 @@ private void saveSettings() {
509
507
510
508
public void onReceive (Context context , Intent intent ) {
511
509
String message = "Broadcast intent detected " + intent .getAction ();
512
- Log . v ( TAG , message );
510
+ Logger . d ( message );
513
511
}
514
512
515
513
public void onFinishedSearch () {
516
- Log . v ( TAG , "done with search" );
514
+ Logger . d ( "done with search" );
517
515
}
518
516
519
517
public Activity getCurrentActivity (){
0 commit comments