4
4
import java .util .Map ;
5
5
import java .util .concurrent .ConcurrentHashMap ;
6
6
7
- import org .simpleframework .xml .Serializer ;
8
- import org .simpleframework .xml .core .Persister ;
9
-
10
7
import us .nineworlds .serenity .GDMReceiver ;
11
8
import android .app .Activity ;
12
9
import android .app .AlertDialog ;
13
10
import android .app .Dialog ;
14
11
import android .content .BroadcastReceiver ;
15
- import android .content .Context ;
16
12
import android .content .DialogInterface ;
17
13
import android .content .Intent ;
18
14
import android .content .IntentFilter ;
19
15
import android .content .SharedPreferences ;
20
- import android .content .res .Resources .NotFoundException ;
21
16
import android .net .Uri ;
22
17
import android .os .Bundle ;
23
18
import android .support .v4 .content .LocalBroadcastManager ;
@@ -47,8 +42,7 @@ public class MainActivity extends Activity {
47
42
public final static String BUGSENSE_APIKEY = "879458d0" ;
48
43
49
44
private BroadcastReceiver gdmReceiver = new GDMReceiver ();
50
- private Activity mCurrentActivity = null ;
51
-
45
+
52
46
private Dialog searchDialog = null ;
53
47
private Dialog serverSelectDialog = null ;
54
48
@@ -57,8 +51,6 @@ public class MainActivity extends Activity {
57
51
58
52
private Map <String , PlexClient > m_clients = new HashMap <String , PlexClient >();
59
53
60
- private static Serializer serial = new Persister ();
61
-
62
54
private SharedPreferences mPrefs ;
63
55
private SharedPreferences .Editor mPrefsEditor ;
64
56
@@ -69,16 +61,16 @@ public class MainActivity extends Activity {
69
61
protected void onCreate (Bundle savedInstanceState ) {
70
62
super .onCreate (savedInstanceState );
71
63
72
- // BugSenseHandler.initAndStartSession(MainActivity.this, BUGSENSE_APIKEY);
64
+ BugSenseHandler .initAndStartSession (MainActivity .this , BUGSENSE_APIKEY );
73
65
74
66
75
67
mPrefs = getSharedPreferences (PREFS , MODE_PRIVATE );
76
68
mPrefsEditor = mPrefs .edit ();
77
69
Gson gson = new Gson ();
78
70
79
71
setContentView (R .layout .main );
80
- this .server = ( PlexServer ) gson .fromJson (mPrefs .getString ("Server" , "" ), PlexServer .class );
81
- this .client = ( PlexClient ) gson .fromJson (mPrefs .getString ("Client" , "" ), PlexClient .class );
72
+ this .server = gson .fromJson (mPrefs .getString ("Server" , "" ), PlexServer .class );
73
+ this .client = gson .fromJson (mPrefs .getString ("Client" , "" ), PlexClient .class );
82
74
83
75
initMainWithServer ();
84
76
}
@@ -138,8 +130,8 @@ public void onItemClick(AdapterView<?> adapter, View view, int position,
138
130
searchForPlexServers ();
139
131
} else if (holder .tag .equals ("client" )) {
140
132
getClients ();
141
- } else if (holder .tag .equals ("feedback" )) {
142
- selectFeedback ();
133
+ // } else if(holder.tag.equals("feedback")) {
134
+ // selectFeedback();
143
135
}
144
136
}
145
137
});
@@ -155,14 +147,7 @@ public void settingRowHelpButtonClicked(View v) {
155
147
helpDialog = new AlertDialog .Builder (MainActivity .this );
156
148
}
157
149
helpDialog .setTitle (R .string .app_name );
158
- /*
159
- AlertDialog.Builder alertDialog = new AlertDialog.Builder(MainActivity.this)
160
- .setTitle(R.string.app_name)
161
- .setMessage(R.string.about_text);
162
150
163
- alertDialog.show();
164
- */
165
-
166
151
if (helpButtonClicked .equals ("server" )) {
167
152
helpDialog .setMessage (R .string .help_server );
168
153
} else if (helpButtonClicked .equals ("client" )) {
@@ -265,13 +250,11 @@ public void onSuccess(MediaContainer clientMC)
265
250
{
266
251
serversScanned ++;
267
252
// Exclude non-Plex Home Theater clients (pre 1.0.7)
268
- // List<PlexClient> clients = new ArrayList<PlexClient>();
269
253
Logger .d ("clientMC size: %d" , clientMC .clients .size ());
270
254
for (int i =0 ;i <clientMC .clients .size ();i ++) {
271
255
float version = clientMC .clients .get (i ).getNumericVersion ();
272
256
Logger .d ("Version: %f" , version );
273
257
if ((version >= 1.07 || !clientMC .clients .get (i ).getProduct ().equals ("Plex Home Theater" )) && !m_clients .containsKey (clientMC .clients .get (i ).getName ())) {
274
- // m_clients.add(clientMC.clients.get(i));
275
258
m_clients .put (clientMC .clients .get (i ).getName (), clientMC .clients .get (i ));
276
259
}
277
260
}
@@ -379,19 +362,6 @@ private void scanForClients() {
379
362
startService (mServiceIntent );
380
363
}
381
364
382
- private static MediaContainer getMediaContainer (String response ) {
383
- MediaContainer mediaContainer = new MediaContainer ();
384
-
385
- try {
386
- mediaContainer = serial .read (MediaContainer .class , response );
387
- } catch (NotFoundException e ) {
388
- e .printStackTrace ();
389
- } catch (Exception e ) {
390
- e .printStackTrace ();
391
- }
392
- return mediaContainer ;
393
- }
394
-
395
365
private void getClients (MediaContainer mc ) {
396
366
if (mc != null ) {
397
367
this .server .setMachineIdentifier (mc .getMachineIdentifier ());
@@ -487,23 +457,6 @@ private void saveSettings() {
487
457
mPrefsEditor .commit ();
488
458
}
489
459
490
- public void onReceive (Context context , Intent intent ) {
491
- String message = "Broadcast intent detected " + intent .getAction ();
492
- Logger .d (message );
493
- }
494
-
495
- public void onFinishedSearch () {
496
- Logger .d ("done with search" );
497
- }
498
-
499
- public Activity getCurrentActivity (){
500
- return mCurrentActivity ;
501
- }
502
-
503
- public void setCurrentActivity (MainActivity mCurrentActivity ){
504
- this .mCurrentActivity = mCurrentActivity ;
505
- }
506
-
507
460
@ Override
508
461
public boolean onCreateOptionsMenu (Menu menu ) {
509
462
// Inflate the menu; this adds items to the action bar if it is present.
0 commit comments