Skip to content

Commit dc372a8

Browse files
author
Chris Bellew
committed
Clear the list of clients the GDMReceiver has after they are sent off to the Activity so the next scan gets a fresh list.
1 parent 8dfde14 commit dc372a8

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

Voice Control For Plex/src/main/java/com/atomjack/vcfp/LocalScan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public void searchForPlexClients() {
106106
}
107107

108108
public void searchForPlexClients(boolean connectToClient) {
109-
Logger.d("searchForPlexClients()");
109+
Logger.d("[LocalScan] searchForPlexClients()");
110110
if(!VoiceControlForPlexApplication.isWifiConnected(context)) {
111111
VoiceControlForPlexApplication.showNoWifiDialog(context);
112112
return;

Voice Control For Plex/src/main/java/com/atomjack/vcfp/activities/ShortcutProviderActivity.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ protected void onCreate(Bundle savedInstanceState) {
5050
localScan = new LocalScan(this, ShortcutProviderActivity.class, new ScanHandler() {
5151
@Override
5252
public void onDeviceSelected(PlexDevice device, boolean _resume) {
53-
Logger.d("chose %s", device.name);
54-
if(device instanceof PlexServer) {
55-
server = (PlexServer)device;
56-
localScan.showPlexClients(true);
57-
} else if(device instanceof PlexClient) {
58-
client = (PlexClient)device;
59-
resume = _resume;
60-
Logger.d("checked: %s", resume);
61-
createShortcut(false);
62-
}
53+
if(device != null) {
54+
if (device instanceof PlexServer) {
55+
server = (PlexServer) device;
56+
localScan.showPlexClients(true);
57+
} else if (device instanceof PlexClient) {
58+
client = (PlexClient) device;
59+
resume = _resume;
60+
createShortcut(false);
61+
}
62+
}
6363
}
6464
});
6565

Voice Control For Plex/src/main/java/us/nineworlds/serenity/GDMReceiver.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public void onReceive(Context context, Intent intent) {
9191
Logger.d("Sending to activity");
9292
context.startActivity(i);
9393
}
94+
// Clear the list of clients so the next scan sends a reinitialized list.
95+
clients = new ArrayList<PlexClient>();
9496
} else if(intent.getAction().equals(ACTION_CANCEL)) {
9597
Logger.d("[GDMReceiver] cancel");
9698
cancel = true;

Voice Control For Plex/src/main/res/values/strings.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<resources>
1+
<resources
2+
xmlns:tools="http://schemas.android.com/tools"
3+
tools:ignore="MissingTranslation">
24
<string name="app_name">Voice Control for Plex</string>
35
<string name="action_settings">Settings</string>
46
<string name="ok">OK</string>

0 commit comments

Comments
 (0)