From 0a5e891d5e88d816acff37e3b53928b930eaca1b Mon Sep 17 00:00:00 2001 From: Eric House Date: Wed, 23 Oct 2013 19:29:32 -0700 Subject: [PATCH] for deletes, don't clear selection until after it's confirmed and finished. --- .../src/org/eehouse/android/xw4/GameListAdapter.java | 6 ++++-- .../XWords4/src/org/eehouse/android/xw4/GamesList.java | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java index 1db9ca408..3401492cf 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java @@ -400,8 +400,10 @@ public class GameListAdapter implements ExpandableListAdapter { for ( Iteratoriter = groupids.iterator(); iter.hasNext(); ) { int pos = getGroupPosition( iter.next() ); - GameListGroup group = getGroupItemFor( pos ); - group.setSelected( false ); + if ( 0 <= pos ) { // still exists? + GameListGroup group = getGroupItemFor( pos ); + group.setSelected( false ); + } } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java index e55298dcc..5f6170f03 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -605,6 +605,7 @@ public class GamesList extends XWExpandableListActivity for ( long groupID : groupIDs ) { GameUtils.deleteGroup( this, groupID ); } + clearSelections(); onContentChanged(); break; case DELETE_GAMES: @@ -752,6 +753,7 @@ public class GamesList extends XWExpandableListActivity break; case R.id.gamel_menu_delete: + keepSels = true; String msg = Utils.format( this, R.string.confirm_seldeletesf, selRowIDs.length ); showConfirmThen( msg, R.string.button_delete, @@ -831,6 +833,7 @@ public class GamesList extends XWExpandableListActivity // Group menus case R.id.list_group_delete: + keepSels = true; if ( m_selGroupIDs .contains( XWPrefs.getDefaultNewGameGroup( this ) ) ) { showOKOnlyDialog( R.string.cannot_delete_default_group ); @@ -854,6 +857,7 @@ public class GamesList extends XWExpandableListActivity break; case R.id.list_group_default: XWPrefs.setDefaultNewGameGroup( this, groupID ); + keepSels = true; break; case R.id.list_group_rename: m_groupid = groupID; @@ -1155,6 +1159,7 @@ public class GamesList extends XWExpandableListActivity } NetUtils.informOfDeaths( this ); + clearSelections(); } private boolean makeNewNetGameIf()