mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-29 10:26:36 +01:00
use tryGetPerms to replace a bunch of Perms23 crud -- again 2
This commit is contained in:
parent
734549668c
commit
e842e1a744
2 changed files with 16 additions and 28 deletions
|
@ -121,7 +121,7 @@ public class DlgDelegate {
|
||||||
SL_CLEAR_ACTION,
|
SL_CLEAR_ACTION,
|
||||||
SL_COPY_ACTION,
|
SL_COPY_ACTION,
|
||||||
|
|
||||||
// DwnldDelegate
|
// DwnldDelegate && GamesListDelegate
|
||||||
STORAGE_CONFIRMED,
|
STORAGE_CONFIRMED,
|
||||||
|
|
||||||
// clasify me
|
// clasify me
|
||||||
|
|
|
@ -1330,6 +1330,18 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
rematchWithNameAndPerm( true, params );
|
rematchWithNameAndPerm( true, params );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case STORAGE_CONFIRMED:
|
||||||
|
int id = (Integer)params[0];
|
||||||
|
if ( R.id.games_menu_loaddb == id ) {
|
||||||
|
DBUtils.loadDB( m_activity );
|
||||||
|
XWPrefs.clearGroupPositions( m_activity );
|
||||||
|
mkListAdapter();
|
||||||
|
} else if ( R.id.games_menu_storedb == id ) {
|
||||||
|
DBUtils.saveDB( m_activity );
|
||||||
|
showToast( R.string.db_store_done );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
super.onPosButton( action, params );
|
super.onPosButton( action, params );
|
||||||
}
|
}
|
||||||
|
@ -1592,34 +1604,10 @@ public class GamesListDelegate extends ListDelegateBase
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R.id.games_menu_loaddb:
|
case R.id.games_menu_loaddb:
|
||||||
new Perms23.Builder( Perm.STORAGE )
|
|
||||||
.asyncQuery( m_activity, new Perms23.PermCbck() {
|
|
||||||
@Override
|
|
||||||
public void onPermissionResult( Map<Perm,
|
|
||||||
Boolean> granted )
|
|
||||||
{
|
|
||||||
Assert.assertTrue( granted.containsKey(Perm.STORAGE) );
|
|
||||||
if ( granted.get(Perm.STORAGE) ) {
|
|
||||||
DBUtils.loadDB( m_activity );
|
|
||||||
XWPrefs.clearGroupPositions( m_activity );
|
|
||||||
mkListAdapter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
break;
|
|
||||||
case R.id.games_menu_storedb:
|
case R.id.games_menu_storedb:
|
||||||
new Perms23.Builder( Perm.STORAGE )
|
Perms23.tryGetPerms( this, Perm.STORAGE,
|
||||||
.asyncQuery( m_activity, new Perms23.PermCbck() {
|
null, Action.STORAGE_CONFIRMED,
|
||||||
@Override
|
this, itemID );
|
||||||
public void onPermissionResult( Map<Perm, Boolean> granted )
|
|
||||||
{
|
|
||||||
Assert.assertTrue( granted.containsKey( Perm.STORAGE ) );
|
|
||||||
if ( granted.get( Perm.STORAGE ) ) {
|
|
||||||
DBUtils.saveDB( m_activity );
|
|
||||||
showToast( R.string.db_store_done );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue