From 6ea692d4301b052f4deeb6d1b6554451c7779484 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 12 Apr 2012 23:04:08 -0700 Subject: [PATCH] use showConfirmThen() for non-mobile numbers --- .../android/XWords4/res/values/strings.xml | 2 +- .../android/xw4/SMSInviteActivity.java | 33 +++++++------------ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/xwords4/android/XWords4/res/values/strings.xml b/xwords4/android/XWords4/res/values/strings.xml index 56110b84b..083f9c0de 100644 --- a/xwords4/android/XWords4/res/values/strings.xml +++ b/xwords4/android/XWords4/res/values/strings.xml @@ -1911,7 +1911,7 @@ (Entered manually) The number %1$s for %2$s is not - marked as mobile. + a \"mobile\" number. Import anyway? Use anyway Phone list is empty. Use the \"Import contact\" button to add people you want to diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteActivity.java index 03d6803b3..110f9f56c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/SMSInviteActivity.java @@ -51,12 +51,12 @@ import org.eehouse.android.xw4.jni.CommonPrefs; public class SMSInviteActivity extends InviteActivity { private static final int GET_CONTACT = 1; - private static final int CONFIRM_NON_MOBILE = DlgDelegate.DIALOG_LAST + 1; - private static final int GET_NUMBER = DlgDelegate.DIALOG_LAST + 2; + private static final int GET_NUMBER = DlgDelegate.DIALOG_LAST + 1; private static final String SAVE_NAME = "SAVE_NAME"; private static final String SAVE_NUMBER = "SAVE_NUMBER"; private static final int CLEAR_ACTION = 1; + private static final int USE_IMMOBILE_ACTION = 2; private ArrayList m_phoneRecs; private SMSPhonesAdapter m_adapter; @@ -122,22 +122,6 @@ public class SMSInviteActivity extends InviteActivity { if ( null == dialog ) { DialogInterface.OnClickListener lstnr; switch( id ) { - case CONFIRM_NON_MOBILE: - lstnr = new DialogInterface.OnClickListener() { - public void onClick( DialogInterface dlg, int item ) { - addChecked( new PhoneRec( m_pendingName, - m_pendingNumber ) ); - saveAndRebuild(); - } - }; - String msg = Utils.format( this, R.string.warn_nomobilef, - m_pendingNumber, m_pendingName ); - dialog = new AlertDialog.Builder( this ) - .setMessage( msg ) - .setPositiveButton( R.string.button_ok, null ) - .setNegativeButton( R.string.button_use, lstnr ) - .create(); - break; case GET_NUMBER: final GameNamer namerView = (GameNamer)Utils.inflate( this, R.layout.rename_game ); @@ -210,6 +194,10 @@ public class SMSInviteActivity extends InviteActivity { case CLEAR_ACTION: clearSelectedImpl(); break; + case USE_IMMOBILE_ACTION: + addChecked( new PhoneRec( m_pendingName, m_pendingNumber ) ); + saveAndRebuild(); + break; } } } @@ -237,9 +225,8 @@ public class SMSInviteActivity extends InviteActivity { Phone.TYPE }, null, null, null ); if ( cursor.moveToFirst() ) { - String name = ""; - int len_before = m_phoneRecs.size(); - name = cursor.getString( cursor.getColumnIndex( Phone.DISPLAY_NAME)); + String name = + cursor.getString( cursor.getColumnIndex( Phone.DISPLAY_NAME)); String number = cursor.getString( cursor.getColumnIndex( Phone.NUMBER ) ); @@ -250,7 +237,9 @@ public class SMSInviteActivity extends InviteActivity { } else { m_pendingName = name; m_pendingNumber = number; - showDialog( CONFIRM_NON_MOBILE ); + String msg = Utils.format( this, R.string.warn_nomobilef, + number, name ); + showConfirmThen( msg, R.string.button_yes, USE_IMMOBILE_ACTION ); } cursor.close(); }