fix logic error in permissions callback

Somehow I forgot what params were and decided that array's length needed
to match another's.
This commit is contained in:
Eric House 2019-01-21 20:44:16 -08:00
parent 06fe5894b9
commit 506ddc8f7a

View file

@ -201,20 +201,18 @@ public class Perms23 {
}
builder.asyncQuery( m_delegate.getActivity(), new PermCbck() {
@Override
public void onPermissionResult( Map<Perm, Boolean> perms ) {
public void onPermissionResult( Map<Perm, Boolean> permsMap ) {
if ( Action.SKIP_CALLBACK != m_action ) {
Set<Perm> keys = perms.keySet();
// We need all the sought perms to have been granted
boolean allGood = keys.size() == m_params.length;
for ( Iterator<Perm> iter = keys.iterator();
allGood && iter.hasNext(); ) {
if ( !perms.get(iter.next()) ) {
allGood = false;
}
boolean allGranted = true;
Iterator<Perm> iter = permsMap.keySet().iterator();
while ( allGranted && iter.hasNext() ) {
Perm perm = iter.next();
allGranted = allGranted && permsMap.get( perm );
}
if ( allGood ) {
if ( allGranted ) {
m_delegate.onPosButton( m_action, m_params );
} else {
m_delegate.onNegButton( m_action, m_params );