query before loading saved games too

This commit is contained in:
Eric House 2016-12-10 14:03:25 -08:00
parent a3ccce00fa
commit bec5ad82c0

View file

@ -1482,7 +1482,6 @@ public class GamesListDelegate extends ListDelegateBase
String msg; String msg;
int itemID = item.getItemId(); int itemID = item.getItemId();
boolean handled = true; boolean handled = true;
boolean changeContent = false;
int groupPos = getSelGroupPos(); int groupPos = getSelGroupPos();
long groupID = DBUtils.GROUPID_UNSPEC; long groupID = DBUtils.GROUPID_UNSPEC;
if ( 0 <= groupPos ) { if ( 0 <= groupPos ) {
@ -1560,10 +1559,19 @@ public class GamesListDelegate extends ListDelegateBase
break; break;
case R.id.games_menu_loaddb: case R.id.games_menu_loaddb:
DBUtils.loadDB( m_activity ); Perms23.doWithPermission( m_activity, Perms23.Perm.STORAGE,
XWPrefs.clearGroupPositions( m_activity ); new Perms23.PermCbck() {
mkListAdapter(); public void onPermissionResult( Perms23.Perm perm,
changeContent = true; boolean granted )
{
Assert.assertTrue( Perms23.Perm.STORAGE == perm );
if ( granted ) {
DBUtils.loadDB( m_activity );
XWPrefs.clearGroupPositions( m_activity );
mkListAdapter();
}
}
} );
break; break;
case R.id.games_menu_storedb: case R.id.games_menu_storedb:
Perms23.doWithPermission( m_activity, Perms23.Perm.STORAGE, Perms23.doWithPermission( m_activity, Perms23.Perm.STORAGE,
@ -1571,6 +1579,7 @@ public class GamesListDelegate extends ListDelegateBase
public void onPermissionResult( Perms23.Perm perm, public void onPermissionResult( Perms23.Perm perm,
boolean granted ) boolean granted )
{ {
Assert.assertTrue( Perms23.Perm.STORAGE == perm );
if ( granted ) { if ( granted ) {
DBUtils.saveDB( m_activity ); DBUtils.saveDB( m_activity );
showToast( R.string.db_store_done ); showToast( R.string.db_store_done );
@ -1584,10 +1593,6 @@ public class GamesListDelegate extends ListDelegateBase
|| handleSelGroupsItem( itemID, getSelGroupIDs() ); || handleSelGroupsItem( itemID, getSelGroupIDs() );
} }
if ( changeContent ) {
mkListAdapter();
}
return handled;// || super.onOptionsItemSelected( item ); return handled;// || super.onOptionsItemSelected( item );
} }