mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +01:00
fix unnecessary crashes launching prefs activity
This commit is contained in:
parent
d0b64f8f51
commit
5bb707fc57
1 changed files with 42 additions and 39 deletions
|
@ -1751,48 +1751,49 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
|
|
||||||
private boolean handleSelGroupsItem( int itemID, long[] groupIDs )
|
private boolean handleSelGroupsItem( int itemID, long[] groupIDs )
|
||||||
{
|
{
|
||||||
boolean handled = true;
|
boolean handled = 0 < groupIDs.length;
|
||||||
String msg;
|
if ( handled ) {
|
||||||
Assert.assertTrue( 0 < groupIDs.length );
|
String msg;
|
||||||
long groupID = groupIDs[0];
|
long groupID = groupIDs[0];
|
||||||
switch( itemID ) {
|
switch( itemID ) {
|
||||||
case R.id.games_group_delete:
|
case R.id.games_group_delete:
|
||||||
long dftGroup = XWPrefs.getDefaultNewGameGroup( m_activity );
|
long dftGroup = XWPrefs.getDefaultNewGameGroup( m_activity );
|
||||||
if ( m_selGroupIDs.contains( dftGroup ) ) {
|
if ( m_selGroupIDs.contains( dftGroup ) ) {
|
||||||
msg = getString( R.string.cannot_delete_default_group_fmt,
|
msg = getString( R.string.cannot_delete_default_group_fmt,
|
||||||
m_adapter.groupName( dftGroup ) );
|
m_adapter.groupName( dftGroup ) );
|
||||||
showOKOnlyDialog( msg );
|
showOKOnlyDialog( msg );
|
||||||
} else {
|
} else {
|
||||||
Assert.assertTrue( 0 < groupIDs.length );
|
Assert.assertTrue( 0 < groupIDs.length );
|
||||||
msg = getQuantityString( R.plurals.groups_confirm_del_fmt,
|
msg = getQuantityString( R.plurals.groups_confirm_del_fmt,
|
||||||
groupIDs.length, groupIDs.length );
|
groupIDs.length, groupIDs.length );
|
||||||
|
|
||||||
int nGames = 0;
|
int nGames = 0;
|
||||||
for ( long tmp : groupIDs ) {
|
for ( long tmp : groupIDs ) {
|
||||||
nGames += m_adapter.getChildrenCount( tmp );
|
nGames += m_adapter.getChildrenCount( tmp );
|
||||||
|
}
|
||||||
|
if ( 0 < nGames ) {
|
||||||
|
msg += getQuantityString( R.plurals.groups_confirm_del_games_fmt,
|
||||||
|
nGames, nGames );
|
||||||
|
}
|
||||||
|
showConfirmThen( msg, Action.DELETE_GROUPS, groupIDs );
|
||||||
}
|
}
|
||||||
if ( 0 < nGames ) {
|
break;
|
||||||
msg += getQuantityString( R.plurals.groups_confirm_del_games_fmt,
|
case R.id.games_group_default:
|
||||||
nGames, nGames );
|
XWPrefs.setDefaultNewGameGroup( m_activity, groupID );
|
||||||
}
|
break;
|
||||||
showConfirmThen( msg, Action.DELETE_GROUPS, groupIDs );
|
case R.id.games_group_rename:
|
||||||
|
m_groupid = groupID;
|
||||||
|
showDialog( DlgID.RENAME_GROUP );
|
||||||
|
break;
|
||||||
|
case R.id.games_group_moveup:
|
||||||
|
moveGroup( groupID, true );
|
||||||
|
break;
|
||||||
|
case R.id.games_group_movedown:
|
||||||
|
moveGroup( groupID, false );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
handled = false;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case R.id.games_group_default:
|
|
||||||
XWPrefs.setDefaultNewGameGroup( m_activity, groupID );
|
|
||||||
break;
|
|
||||||
case R.id.games_group_rename:
|
|
||||||
m_groupid = groupID;
|
|
||||||
showDialog( DlgID.RENAME_GROUP );
|
|
||||||
break;
|
|
||||||
case R.id.games_group_moveup:
|
|
||||||
moveGroup( groupID, true );
|
|
||||||
break;
|
|
||||||
case R.id.games_group_movedown:
|
|
||||||
moveGroup( groupID, false );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
handled = false;
|
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
@ -1901,6 +1902,8 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
missingLang );
|
missingLang );
|
||||||
} catch ( GameUtils.NoSuchGameException nsge ) {
|
} catch ( GameUtils.NoSuchGameException nsge ) {
|
||||||
hasDicts = true; // irrelevant question
|
hasDicts = true; // irrelevant question
|
||||||
|
} catch ( GameLock.GameLockedException gle ) {
|
||||||
|
hasDicts = true; // irrelevant question
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !hasDicts ) {
|
if ( !hasDicts ) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue