in invite dialog, confirm before deleting BT devices

This commit is contained in:
Eric House 2019-01-14 12:08:07 -08:00
parent 0da5d9dd28
commit 23e58524a1
3 changed files with 27 additions and 10 deletions

View file

@ -159,12 +159,11 @@ public class BTInviteDelegate extends InviteDelegate {
BTService.openBTSettings( m_activity ); BTService.openBTSettings( m_activity );
break; break;
case R.id.button_clear: case R.id.button_clear:
mPersisted.remove( getChecked() ); int count = getChecked().size();
store(); String msg = getQuantityString( R.plurals.confirm_clear_bt_fmt,
count, count )
clearChecked(); + getString( R.string.confirm_clear_bt_postscript );
updateListAdapter( mPersisted.pairs ); makeConfirmThenBuilder( msg, Action.CLEAR_ACTION ).show();
tryEnable();
break; break;
} }
} }
@ -323,6 +322,14 @@ public class BTInviteDelegate extends InviteDelegate {
case OPEN_BT_PREFS_ACTION: case OPEN_BT_PREFS_ACTION:
BTService.openBTSettings( m_activity ); BTService.openBTSettings( m_activity );
break; break;
case CLEAR_ACTION:
mPersisted.remove( getChecked() );
store();
clearChecked();
updateListAdapter( mPersisted.pairs );
tryEnable();
break;
default: default:
handled = super.onPosButton( action, params ); handled = super.onPosButton( action, params );
} }

View file

@ -196,12 +196,13 @@ public class RelayService extends JobIntentService
enqueueWork( context, intent ); enqueueWork( context, intent );
} }
// Must use the same lobID for all work enqueued for the same class // Must use the same jobID for all work enqueued for the same class
private final static int sJobID = RelayService.class.hashCode(); private final static int sJobID = RelayService.class.hashCode();
private static void enqueueWork( Context context, Intent intent ) private static void enqueueWork( Context context, Intent intent )
{ {
Log.d( TAG, "calling enqueueWork(cmd=%s)", cmdFrom( intent ) ); Log.d( TAG, "calling enqueueWork(id=%d, cmd=%s)", sJobID,
cmdFrom( intent ) );
enqueueWork( context, RelayService.class, sJobID, intent ); enqueueWork( context, RelayService.class, sJobID, intent );
} }

View file

@ -1871,8 +1871,9 @@
</plurals> </plurals>
<!-- Appended to above --> <!-- Appended to above -->
<string name="invite_bt_desc_postscript">\n\n(The list is of devices you\'ve <string name="invite_bt_desc_postscript">\n\n(The list is of
paired and on which CrossWords has been detected.)</string> paired devices on which CrossWords has been detected via a
scan.)</string>
<plurals name="bt_scan_progress_fmt"> <plurals name="bt_scan_progress_fmt">
<item quantity="one">Scanning for CrossWords</item> <item quantity="one">Scanning for CrossWords</item>
@ -1969,6 +1970,14 @@
<item quantity="other">Are you sure you want to delete the <item quantity="other">Are you sure you want to delete the
%1$d checked RelayID records?</item> %1$d checked RelayID records?</item>
</plurals> </plurals>
<plurals name="confirm_clear_bt_fmt">
<item quantity="one">Are you sure you want to forget the checked
device?</item>
<item quantity="other">Are you sure you want to forget %1$d
checked devices?</item>
</plurals>
<string name="confirm_clear_bt_postscript">\n\n(You can re-add devices
only when they are within BlueTooth range.)</string>
<!-- --> <!-- -->
<string name="summary_conn_sms_fmt">Game in play with %1$s</string> <string name="summary_conn_sms_fmt">Game in play with %1$s</string>