mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
on ICS+, onPrepareOptionsMenu can get called several times while
adjusting selections, so just bail when they're in an incomplete state.
This commit is contained in:
parent
b7edbf14a4
commit
7a4d3093a1
1 changed files with 55 additions and 48 deletions
|
@ -617,10 +617,15 @@ public class GamesList extends XWExpandableListActivity
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu( Menu menu )
|
public boolean onPrepareOptionsMenu( Menu menu )
|
||||||
{
|
{
|
||||||
|
boolean show;
|
||||||
|
|
||||||
int nGamesSelected = m_selectedGames.size();
|
int nGamesSelected = m_selectedGames.size();
|
||||||
int nGroupsSelected = m_selectedGroups.size();
|
int nGroupsSelected = m_selectedGroups.size();
|
||||||
|
if ( 0 < nGamesSelected && 0 < nGroupsSelected ) {
|
||||||
|
DbgUtils.logf( "onPrepareOptionsMenu: incomplete so bailing" );
|
||||||
|
show = false;
|
||||||
|
} else {
|
||||||
boolean nothingSelected = 0 == (nGroupsSelected + nGamesSelected);
|
boolean nothingSelected = 0 == (nGroupsSelected + nGamesSelected);
|
||||||
Assert.assertTrue( 0 == nGamesSelected || 0 == nGroupsSelected );
|
|
||||||
|
|
||||||
boolean visible = XWPrefs.getDebugEnabled( this );
|
boolean visible = XWPrefs.getDebugEnabled( this );
|
||||||
for ( int id : DEBUGITEMS ) {
|
for ( int id : DEBUGITEMS ) {
|
||||||
|
@ -676,7 +681,9 @@ public class GamesList extends XWExpandableListActivity
|
||||||
Utils.setItemVisible( menu, R.id.list_item_move, 1 == nGamesSelected );
|
Utils.setItemVisible( menu, R.id.list_item_move, 1 == nGamesSelected );
|
||||||
Utils.setItemVisible( menu, R.id.list_item_reset, 1 == nGamesSelected );
|
Utils.setItemVisible( menu, R.id.list_item_reset, 1 == nGamesSelected );
|
||||||
|
|
||||||
return super.onPrepareOptionsMenu( menu );
|
show = super.onPrepareOptionsMenu( menu );
|
||||||
|
}
|
||||||
|
return show;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onOptionsItemSelected( MenuItem item )
|
public boolean onOptionsItemSelected( MenuItem item )
|
||||||
|
|
Loading…
Reference in a new issue