Kaydet (Commit) 657e4fbf authored tarafından Andrzej J.R. Hunt's avatar Andrzej J.R. Hunt

Fix removal of stale servers in selector.

Change-Id: I95a378cade77a7e53ef6baa69a6e9223d13e1526
üst cb6d2ed2
...@@ -220,8 +220,6 @@ public class SelectorActivity extends SherlockActivity { ...@@ -220,8 +220,6 @@ public class SelectorActivity extends SherlockActivity {
// Bluetooth -- Remove old // Bluetooth -- Remove old
for (Entry<Server, View> aEntry : mBluetoothServers.entrySet()) { for (Entry<Server, View> aEntry : mBluetoothServers.entrySet()) {
if (!Arrays.asList(aServers).contains(aEntry.getKey())) { if (!Arrays.asList(aServers).contains(aEntry.getKey())) {
System.out.println("Removing view "
+ aEntry.getKey().getName());
mBluetoothServers.remove(aEntry.getKey()); mBluetoothServers.remove(aEntry.getKey());
mBluetoothList.removeView((View) aEntry.getValue() mBluetoothList.removeView((View) aEntry.getValue()
.getParent()); .getParent());
...@@ -230,8 +228,7 @@ public class SelectorActivity extends SherlockActivity { ...@@ -230,8 +228,7 @@ public class SelectorActivity extends SherlockActivity {
// Network -- Remove old // Network -- Remove old
for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) { for (Entry<Server, View> aEntry : mNetworkServers.entrySet()) {
if (!Arrays.asList(aServers).contains(aEntry.getKey())) { if (!Arrays.asList(aServers).contains(aEntry.getKey())) {
System.out.println("Removing view"); mNetworkServers.remove(aEntry.getKey());
mNetworkServers.remove(aEntry.getKey().getName());
mNetworkList.removeView((View) aEntry.getValue() mNetworkList.removeView((View) aEntry.getValue()
.getParent()); .getParent());
} }
...@@ -262,8 +259,8 @@ public class SelectorActivity extends SherlockActivity { ...@@ -262,8 +259,8 @@ public class SelectorActivity extends SherlockActivity {
} }
} }
// Hide as necessary
// Hide as necessary
mBluetoothContainer mBluetoothContainer
.setVisibility((mBluetoothServers.size() != 0) ? View.VISIBLE .setVisibility((mBluetoothServers.size() != 0) ? View.VISIBLE
: View.GONE); : View.GONE);
......
...@@ -24,7 +24,7 @@ public class ServerFinder { ...@@ -24,7 +24,7 @@ public class ServerFinder {
private static final String CHARSET = "UTF-8"; private static final String CHARSET = "UTF-8";
private static final long SEARCH_INTERVAL = 1000 * 20; private static final long SEARCH_INTERVAL = 1000 * 15;
private DatagramSocket mSocket = null; private DatagramSocket mSocket = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment