fix broken device deletion; refresh time-last-seen

I was comparing the wrong strings and so broke deleting known BT
devices. And wanted to see how often since I'd seen them updated, though
every 10 seconds is still 10 seconds.
This commit is contained in:
Eric House 2020-10-07 19:06:33 -07:00
parent af7f776118
commit 284e7eb85a
2 changed files with 21 additions and 4 deletions

View file

@ -99,7 +99,7 @@ public class BTInviteDelegate extends InviteDelegate {
for ( Iterator<TwoStringPair> iter = pairs.iterator();
iter.hasNext(); ) {
TwoStringPair pair = iter.next();
if ( TextUtils.equals( pair.str2, dev ) ) {
if ( TextUtils.equals( pair.getDev(), dev ) ) {
iter.remove();
break;
}
@ -173,7 +173,7 @@ public class BTInviteDelegate extends InviteDelegate {
if ( sPersistedRef[0].empty() ) {
scan();
} else {
updateList( sPersistedRef[0].pairs );
updateListIn( 0 );
}
}
@ -283,7 +283,7 @@ public class BTInviteDelegate extends InviteDelegate {
sPersistedRef[0].add( dev.getAddress(), dev.getName() );
store( m_activity );
updateList( sPersistedRef[0].pairs );
updateList();
tryEnable();
}
@ -356,6 +356,22 @@ public class BTInviteDelegate extends InviteDelegate {
}
}
private void updateListIn( final long inSecs )
{
m_handler.postDelayed( new Runnable() {
@Override
public void run() {
updateList();
updateListIn( 10 );
}
}, inSecs * 1000 );
}
private void updateList()
{
updateList( sPersistedRef[0].pairs );
}
private synchronized static void load( Context context )
{
if ( null == sPersistedRef[0] ) {
@ -394,7 +410,7 @@ public class BTInviteDelegate extends InviteDelegate {
store( m_activity );
clearChecked();
updateList( sPersistedRef[0].pairs );
updateList();
tryEnable();
break;
default:

View file

@ -224,6 +224,7 @@ abstract class InviteDelegate extends DelegateBase
////////////////////////////////////////
// View.OnClickListener
////////////////////////////////////////
@Override
public void onClick( View view )
{
if ( m_inviteButton == view ) {