mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
implement delete of selected games with confirmation
This commit is contained in:
parent
e7a23afc4a
commit
ac229e4ae7
2 changed files with 23 additions and 0 deletions
|
@ -179,6 +179,9 @@
|
||||||
<string name="confirm_delete">Are you sure you want to delete this
|
<string name="confirm_delete">Are you sure you want to delete this
|
||||||
game?</string>
|
game?</string>
|
||||||
|
|
||||||
|
<string name="confirm_seldeletes">Are you sure you want to delete
|
||||||
|
all selected games? This action cannot be undone.</string>
|
||||||
|
|
||||||
<!-- Text of confirmation dialog posted when list_item_reset menu
|
<!-- Text of confirmation dialog posted when list_item_reset menu
|
||||||
is selected -->
|
is selected -->
|
||||||
<string name="confirm_reset">Are you sure you want to reset this
|
<string name="confirm_reset">Are you sure you want to reset this
|
||||||
|
|
|
@ -88,6 +88,7 @@ public class GamesList extends XWExpandableListActivity
|
||||||
private static final int SYNC_MENU_ACTION = 4;
|
private static final int SYNC_MENU_ACTION = 4;
|
||||||
private static final int NEW_FROM_ACTION = 5;
|
private static final int NEW_FROM_ACTION = 5;
|
||||||
private static final int DELETE_GROUP_ACTION = 6;
|
private static final int DELETE_GROUP_ACTION = 6;
|
||||||
|
private static final int DELETE_SELGAMES_ACTION = 7;
|
||||||
private static final int[] DEBUGITEMS = { R.id.gamel_menu_loaddb
|
private static final int[] DEBUGITEMS = { R.id.gamel_menu_loaddb
|
||||||
, R.id.gamel_menu_storedb
|
, R.id.gamel_menu_storedb
|
||||||
, R.id.gamel_menu_checkupdates
|
, R.id.gamel_menu_checkupdates
|
||||||
|
@ -587,6 +588,9 @@ public class GamesList extends XWExpandableListActivity
|
||||||
GameUtils.deleteGroup( this, m_groupid );
|
GameUtils.deleteGroup( this, m_groupid );
|
||||||
onContentChanged();
|
onContentChanged();
|
||||||
break;
|
break;
|
||||||
|
case DELETE_SELGAMES_ACTION:
|
||||||
|
deleteSelected();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Assert.fail();
|
Assert.fail();
|
||||||
}
|
}
|
||||||
|
@ -708,6 +712,11 @@ public class GamesList extends XWExpandableListActivity
|
||||||
showDialog( NEW_GROUP );
|
showDialog( NEW_GROUP );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case R.id.gamel_menu_delete:
|
||||||
|
showConfirmThen( R.string.confirm_seldeletes, R.string.button_delete,
|
||||||
|
DELETE_SELGAMES_ACTION );
|
||||||
|
break;
|
||||||
|
|
||||||
case R.id.gamel_menu_dicts:
|
case R.id.gamel_menu_dicts:
|
||||||
DictsActivity.start( this );
|
DictsActivity.start( this );
|
||||||
break;
|
break;
|
||||||
|
@ -1105,6 +1114,17 @@ public class GamesList extends XWExpandableListActivity
|
||||||
return dialog;
|
return dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void deleteSelected()
|
||||||
|
{
|
||||||
|
for ( Iterator<Long> iter = m_selected.iterator(); iter.hasNext(); ) {
|
||||||
|
long rowid = iter.next();
|
||||||
|
GameUtils.deleteGame( this, rowid, false );
|
||||||
|
}
|
||||||
|
m_selected.clear();
|
||||||
|
|
||||||
|
NetUtils.informOfDeaths( this );
|
||||||
|
}
|
||||||
|
|
||||||
private boolean makeNewNetGameIf()
|
private boolean makeNewNetGameIf()
|
||||||
{
|
{
|
||||||
boolean madeGame = null != m_netLaunchInfo;
|
boolean madeGame = null != m_netLaunchInfo;
|
||||||
|
|
Loading…
Reference in a new issue