remove unnecessary parameter

This commit is contained in:
Eric House 2017-08-01 22:03:47 -07:00
parent c927dbef54
commit 62dd6c12f7
6 changed files with 16 additions and 22 deletions

View file

@ -711,7 +711,7 @@ public class BoardDelegate extends DelegateBase
{ {
Perms23.tryGetPerms( this, Perm.READ_PHONE_STATE, Perms23.tryGetPerms( this, Perm.READ_PHONE_STATE,
R.string.phone_state_rationale, R.string.phone_state_rationale,
Action.ASKED_PHONE_STATE, this, info ); Action.ASKED_PHONE_STATE, info );
} }
private void showInviteChoicesThen( Object[] params ) private void showInviteChoicesThen( Object[] params )
@ -1183,7 +1183,7 @@ public class BoardDelegate extends DelegateBase
break; break;
case SMS: case SMS:
Perms23.tryGetPerms( this, Perm.SEND_SMS, R.string.sms_invite_rationale, Perms23.tryGetPerms( this, Perm.SEND_SMS, R.string.sms_invite_rationale,
Action.INVITE_SMS, this, m_mySIS.nMissing, info ); Action.INVITE_SMS, m_mySIS.nMissing, info );
break; break;
case RELAY: case RELAY:
RelayInviteDelegate.launchForResult( m_activity, m_mySIS.nMissing, RelayInviteDelegate.launchForResult( m_activity, m_mySIS.nMissing,

View file

@ -110,7 +110,7 @@ public class DelegateBase implements DlgClickNotify,
protected void tryGetPerms( Perms23.Perm perm, int rationale, protected void tryGetPerms( Perms23.Perm perm, int rationale,
Action action, Object... params ) Action action, Object... params )
{ {
Perms23.tryGetPerms( this, perm, rationale, action, this, params ); Perms23.tryGetPerms( this, perm, rationale, action, params );
} }
// Fragments only // Fragments only

View file

@ -780,7 +780,7 @@ public class GameConfigDelegate extends DelegateBase
if ( null == SMSService.getPhoneInfo( m_activity ) ) { if ( null == SMSService.getPhoneInfo( m_activity ) ) {
Perms23.tryGetPerms( this, Perms23.Perm.READ_PHONE_STATE, Perms23.tryGetPerms( this, Perms23.Perm.READ_PHONE_STATE,
R.string.phone_state_rationale, R.string.phone_state_rationale,
Action.ASKED_PHONE_STATE, this ); Action.ASKED_PHONE_STATE );
} else { } else {
showDialogFragment( DlgID.CHANGE_CONN, m_conTypes ); showDialogFragment( DlgID.CHANGE_CONN, m_conTypes );
} }

View file

@ -1592,9 +1592,8 @@ public class GamesListDelegate extends ListDelegateBase
case R.id.games_menu_loaddb: case R.id.games_menu_loaddb:
case R.id.games_menu_storedb: case R.id.games_menu_storedb:
Perms23.tryGetPerms( this, Perm.STORAGE, Perms23.tryGetPerms( this, Perm.STORAGE, null,
null, Action.STORAGE_CONFIRMED, Action.STORAGE_CONFIRMED, itemID );
this, itemID );
break; break;
default: default:
@ -2170,8 +2169,7 @@ public class GamesListDelegate extends ListDelegateBase
String msg = getString( R.string.phone_lookup_rationale ) String msg = getString( R.string.phone_lookup_rationale )
+ "\n\n" + getString( id ); + "\n\n" + getString( id );
Perms23.tryGetPerms( this, Perm.READ_PHONE_STATE, msg, Perms23.tryGetPerms( this, Perm.READ_PHONE_STATE, msg,
Action.ASKED_PHONE_STATE, this, Action.ASKED_PHONE_STATE, gameName, addrs );
gameName, addrs );
} }
} }
} }

View file

@ -151,18 +151,15 @@ public class Perms23 {
private Action m_action; private Action m_action;
private Perm m_perm; private Perm m_perm;
private DelegateBase m_delegate; private DelegateBase m_delegate;
private DlgClickNotify m_cbck;
private String m_rationaleMsg; private String m_rationaleMsg;
private Object[] m_params; private Object[] m_params;
public QueryInfo( DelegateBase delegate, Action action, public QueryInfo( DelegateBase delegate, Action action,
Perm perm, String msg, Perm perm, String msg, Object[] params ) {
DlgClickNotify cbck, Object[] params ) {
m_delegate = delegate; m_delegate = delegate;
m_action = action; m_action = action;
m_perm = perm; m_perm = perm;
m_rationaleMsg = msg; m_rationaleMsg = msg;
m_cbck = cbck;
m_params = params; m_params = params;
} }
@ -186,9 +183,9 @@ public class Perms23 {
public void onPermissionResult( Map<Perm, Boolean> perms ) { public void onPermissionResult( Map<Perm, Boolean> perms ) {
if ( Action.SKIP_CALLBACK != m_action ) { if ( Action.SKIP_CALLBACK != m_action ) {
if ( perms.get( m_perm ) ) { if ( perms.get( m_perm ) ) {
m_cbck.onPosButton( m_action, m_params ); m_delegate.onPosButton( m_action, m_params );
} else { } else {
m_cbck.onNegButton( m_action, m_params ); m_delegate.onNegButton( m_action, m_params );
} }
} }
} }
@ -204,7 +201,7 @@ public class Perms23 {
if ( positive ) { if ( positive ) {
doIt( false ); doIt( false );
} else { } else {
m_cbck.onNegButton( m_action, m_params ); m_delegate.onNegButton( m_action, m_params );
} }
} }
} ); } );
@ -224,21 +221,20 @@ public class Perms23 {
* either positive or negative, the former if permission granted. * either positive or negative, the former if permission granted.
*/ */
public static void tryGetPerms( DelegateBase delegate, Perm perm, int rationaleId, public static void tryGetPerms( DelegateBase delegate, Perm perm, int rationaleId,
final Action action, final DlgClickNotify cbck, final Action action, Object... params )
Object... params )
{ {
// Log.d( TAG, "tryGetPerms(%s)", perm.toString() ); // Log.d( TAG, "tryGetPerms(%s)", perm.toString() );
Context context = XWApp.getContext(); Context context = XWApp.getContext();
String msg = LocUtils.getString( context, rationaleId ); String msg = LocUtils.getString( context, rationaleId );
tryGetPerms( delegate, perm, msg, action, cbck, params ); tryGetPerms( delegate, perm, msg, action, params );
} }
public static void tryGetPerms( DelegateBase delegate, Perm perm, public static void tryGetPerms( DelegateBase delegate, Perm perm,
String rationaleMsg, final Action action, String rationaleMsg, final Action action,
final DlgClickNotify cbck, Object... params ) Object... params )
{ {
// Log.d( TAG, "tryGetPerms(%s)", perm.toString() ); // Log.d( TAG, "tryGetPerms(%s)", perm.toString() );
new QueryInfo( delegate, action, perm, rationaleMsg, cbck, params ) new QueryInfo( delegate, action, perm, rationaleMsg, params )
.doIt( true ); .doIt( true );
} }

View file

@ -352,7 +352,7 @@ public class SMSInviteDelegate extends InviteDelegate {
// regardless of the answers given. So SKIP_CALLBACK. // regardless of the answers given. So SKIP_CALLBACK.
Perms23.tryGetPerms( this, Perm.READ_CONTACTS, Perms23.tryGetPerms( this, Perm.READ_CONTACTS,
R.string.contacts_rationale, R.string.contacts_rationale,
Action.SKIP_CALLBACK, this ); Action.SKIP_CALLBACK );
} }
private class PhoneRec implements InviterItem { private class PhoneRec implements InviterItem {