mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
don't move selected games via context menu
Both ways of invoking move-to-group were working on the set of selected games. Instead pass what's meant to be operated on as a parameter.
This commit is contained in:
parent
0f8e55a260
commit
b5ff337381
1 changed files with 15 additions and 9 deletions
|
@ -103,8 +103,8 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
|
|
||||||
private static class MySIS implements Serializable {
|
private static class MySIS implements Serializable {
|
||||||
public MySIS(){
|
public MySIS(){
|
||||||
selGames = new HashSet<Long>();
|
selGames = new HashSet<>();
|
||||||
selGroupIDs = new HashSet<Long>();
|
selGroupIDs = new HashSet<>();
|
||||||
}
|
}
|
||||||
int groupSelItem;
|
int groupSelItem;
|
||||||
boolean nextIsSolo;
|
boolean nextIsSolo;
|
||||||
|
@ -781,6 +781,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANGE_GROUP:
|
case CHANGE_GROUP:
|
||||||
|
final long[] games = (long[])params[0];
|
||||||
dialog = makeAlertBuilder()
|
dialog = makeAlertBuilder()
|
||||||
.setTitle( R.string.change_group )
|
.setTitle( R.string.change_group )
|
||||||
.setSingleChoiceItems( m_adapter.groupNames(),
|
.setSingleChoiceItems( m_adapter.groupNames(),
|
||||||
|
@ -800,7 +801,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
long gid = m_adapter
|
long gid = m_adapter
|
||||||
.getGroupIDFor( m_mySIS
|
.getGroupIDFor( m_mySIS
|
||||||
.groupSelItem );
|
.groupSelItem );
|
||||||
moveSelGamesTo( gid );
|
moveSelGamesTo( games, gid );
|
||||||
}
|
}
|
||||||
} )
|
} )
|
||||||
.setNeutralButton( R.string.button_newgroup,
|
.setNeutralButton( R.string.button_newgroup,
|
||||||
|
@ -1070,15 +1071,18 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveSelGamesTo( long gid )
|
private void moveSelGamesTo( long[] games, long gid )
|
||||||
{
|
{
|
||||||
for ( long rowid : m_mySIS.selGames ) {
|
boolean destOpen = DBUtils.getGroups( m_activity ).get( gid ).m_expanded;
|
||||||
|
for ( long rowid : games ) {
|
||||||
DBUtils.moveGame( m_activity, rowid, gid );
|
DBUtils.moveGame( m_activity, rowid, gid );
|
||||||
|
if ( !destOpen ) {
|
||||||
|
m_mySIS.selGames.remove( rowid );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invalidate if there could have been change
|
// Invalidate if there could have been change
|
||||||
if ( ! DBUtils.getGroups( m_activity ).get( gid ).m_expanded ) {
|
if ( ! destOpen ) {
|
||||||
m_mySIS.selGames.clear();
|
|
||||||
invalidateOptionsMenuIf();
|
invalidateOptionsMenuIf();
|
||||||
setTitle();
|
setTitle();
|
||||||
}
|
}
|
||||||
|
@ -1808,7 +1812,7 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
|
|
||||||
case R.id.games_game_move:
|
case R.id.games_game_move:
|
||||||
m_mySIS.groupSelItem = -1;
|
m_mySIS.groupSelItem = -1;
|
||||||
showDialogFragment( DlgID.CHANGE_GROUP );
|
showDialogFragment( DlgID.CHANGE_GROUP, selRowIDs );
|
||||||
break;
|
break;
|
||||||
case R.id.games_game_new_from:
|
case R.id.games_game_new_from:
|
||||||
dropSels = true; // will select the new game instead
|
dropSels = true; // will select the new game instead
|
||||||
|
@ -2377,7 +2381,9 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
{
|
{
|
||||||
if ( m_mySIS.moveAfterNewGroup ) {
|
if ( m_mySIS.moveAfterNewGroup ) {
|
||||||
m_mySIS.moveAfterNewGroup = false;
|
m_mySIS.moveAfterNewGroup = false;
|
||||||
showDialogFragment( DlgID.CHANGE_GROUP );
|
Long[] games = m_mySIS.selGames
|
||||||
|
.toArray( new Long[m_mySIS.selGames.size()] );
|
||||||
|
showDialogFragment( DlgID.CHANGE_GROUP, (Object)games );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue