mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
fix removal of unpaired device
Two uses of remove() were passing different info. So pass the other one from the other use.
This commit is contained in:
parent
1019271c94
commit
a5b98c483c
1 changed files with 17 additions and 22 deletions
|
@ -351,31 +351,26 @@ public class BTInviteDelegate extends InviteDelegate
|
|||
private static void removeNotPaired( Persisted prs )
|
||||
{
|
||||
Log.d( TAG, "removeNotPaired()" );
|
||||
BluetoothAdapter adapter = BTUtils.getAdapterIf();
|
||||
if ( null != adapter ) {
|
||||
Set<BluetoothDevice> pairedDevs = BTUtils.getCandidates();
|
||||
Set<String> paired = new HashSet<>();
|
||||
for ( BluetoothDevice dev : pairedDevs ) {
|
||||
Log.d( TAG, "removeNotPaired(): paired dev: %s", dev.getName() );
|
||||
paired.add( dev.getName() );
|
||||
}
|
||||
Set<BluetoothDevice> pairedDevs = BTUtils.getCandidates();
|
||||
Set<String> paired = new HashSet<>();
|
||||
for ( BluetoothDevice dev : pairedDevs ) {
|
||||
Log.d( TAG, "removeNotPaired(): paired dev: %s", dev.getName() );
|
||||
paired.add( dev.getName() );
|
||||
}
|
||||
|
||||
Set<String> toRemove = new HashSet<>();
|
||||
for ( TwoStringPair pair : prs.pairs ) {
|
||||
String name = pair.str2;
|
||||
if ( ! paired.contains( name ) ) {
|
||||
Log.d( TAG, "%s no longer paired; removing", name );
|
||||
toRemove.add( name );
|
||||
} else {
|
||||
Log.d( TAG, "%s STILL paired", name );
|
||||
}
|
||||
Set<String> toRemove = new HashSet<>();
|
||||
for ( TwoStringPair pair : prs.pairs ) {
|
||||
String name = pair.str2;
|
||||
if ( ! paired.contains( name ) ) {
|
||||
Log.d( TAG, "%s no longer paired; removing", name );
|
||||
toRemove.add( pair.getDev() );
|
||||
} else {
|
||||
Log.d( TAG, "%s STILL paired", name );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! toRemove.isEmpty() ) {
|
||||
prs.remove( toRemove );
|
||||
}
|
||||
} else {
|
||||
Log.e( TAG, "removeNotPaired(): adapter null" );
|
||||
if ( ! toRemove.isEmpty() ) {
|
||||
prs.remove( toRemove );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue