add non-mobile number if user confirms

Fix logic error that didn't proceed with the number-add in the
non-mobile case.
This commit is contained in:
Eric House 2019-03-07 08:39:20 -08:00
parent a561899021
commit a91c0e2cbf

View file

@ -60,7 +60,6 @@ public class SMSInviteDelegate extends InviteDelegate {
private static final String INTENT_KEY_MEANS = "means"; private static final String INTENT_KEY_MEANS = "means";
private ArrayList<PhoneRec> m_phoneRecs; private ArrayList<PhoneRec> m_phoneRecs;
private boolean m_immobileConfirmed;
private Activity m_activity; private Activity m_activity;
private InviteMeans mMeans; private InviteMeans mMeans;
@ -179,11 +178,7 @@ public class SMSInviteDelegate extends InviteDelegate {
String name String name
= ((EditText)getNumView.findViewById(R.id.name_field)) = ((EditText)getNumView.findViewById(R.id.name_field))
.getText().toString(); .getText().toString();
makeConfirmThenBuilder( R.string.warn_unlimited, postSMSCostWarning( number, name );
Action.POST_WARNING_ACTION )
.setPosButton( R.string.button_yes )
.setParams( number, name )
.show();
} }
} }
}; };
@ -230,7 +225,7 @@ public class SMSInviteDelegate extends InviteDelegate {
clearSelectedImpl(); clearSelectedImpl();
break; break;
case USE_IMMOBILE_ACTION: case USE_IMMOBILE_ACTION:
m_immobileConfirmed = true; postSMSCostWarning( (String)params[0], (String)params[1] );
break; break;
case POST_WARNING_ACTION: case POST_WARNING_ACTION:
PhoneRec rec = new PhoneRec( (String)params[1], PhoneRec rec = new PhoneRec( (String)params[1],
@ -246,33 +241,6 @@ public class SMSInviteDelegate extends InviteDelegate {
return handled; return handled;
} }
@Override
public boolean onNegButton( Action action, final Object[] params )
{
boolean handled = true;
switch ( action ) {
case USE_IMMOBILE_ACTION:
if ( m_immobileConfirmed ) {
// Putting up a new alert from inside another's handler
// confuses things. So post instead.
post( new Runnable() {
@Override
public void run() {
makeConfirmThenBuilder( R.string.warn_unlimited,
Action.POST_WARNING_ACTION )
.setPosButton( R.string.button_yes )
.setParams( params )
.show();
}
} );
}
break;
default:
handled = super.onNegButton( action, params );
}
return handled;
}
private void addPhoneNumbers( Intent intent ) private void addPhoneNumbers( Intent intent )
{ {
Uri data = intent.getData(); Uri data = intent.getData();
@ -298,23 +266,34 @@ public class SMSInviteDelegate extends InviteDelegate {
int type = cursor.getInt( cursor. int type = cursor.getInt( cursor.
getColumnIndex( Phone.TYPE ) ); getColumnIndex( Phone.TYPE ) );
DlgDelegate.ConfirmThenBuilder builder;
if ( Phone.TYPE_MOBILE == type ) { if ( Phone.TYPE_MOBILE == type ) {
builder = makeConfirmThenBuilder( R.string.warn_unlimited, postSMSCostWarning( number, name );
Action.POST_WARNING_ACTION );
} else { } else {
m_immobileConfirmed = false; postConfirmMobile( number, name );
String msg = getString( R.string.warn_nomobile_fmt,
number, name );
builder = makeConfirmThenBuilder( msg, Action.USE_IMMOBILE_ACTION );
} }
builder.setPosButton( R.string.button_yes )
.setParams( number, name )
.show();
} }
} }
} // addPhoneNumbers } // addPhoneNumbers
private void postSMSCostWarning( String number, String name )
{
makeConfirmThenBuilder( R.string.warn_unlimited,
Action.POST_WARNING_ACTION )
.setPosButton( R.string.button_yes )
.setParams( number, name )
.show();
}
private void postConfirmMobile( String number, String name )
{
String msg = getString( R.string.warn_nomobile_fmt,
number, name );
makeConfirmThenBuilder( msg, Action.USE_IMMOBILE_ACTION )
.setPosButton( R.string.button_yes )
.setParams( number, name )
.show();
}
private void rebuildList( boolean checkIfAll ) private void rebuildList( boolean checkIfAll )
{ {
Collections.sort( m_phoneRecs, new Comparator<PhoneRec>() { Collections.sort( m_phoneRecs, new Comparator<PhoneRec>() {