move methods toward better encapsualtion (no behavior change)

This commit is contained in:
Eric House 2012-12-03 08:03:00 -08:00
parent ad606cdec0
commit c041792f83
6 changed files with 24 additions and 24 deletions

View file

@ -45,6 +45,14 @@ public class BTInviteActivity extends InviteActivity
private boolean m_firstScan; private boolean m_firstScan;
private int m_checkCount; private int m_checkCount;
public static void launchForResult( Activity activity, int nMissing,
int requestCode )
{
Intent intent = new Intent( activity, BTInviteActivity.class );
intent.putExtra( INTENT_KEY_NMISSING, nMissing );
activity.startActivityForResult( intent, requestCode );
}
@Override @Override
protected void onCreate( Bundle savedInstanceState ) protected void onCreate( Bundle savedInstanceState )
{ {

View file

@ -847,12 +847,12 @@ public class BoardActivity extends XWActivity
doSyncMenuitem(); doSyncMenuitem();
break; break;
case BT_PICK_ACTION: case BT_PICK_ACTION:
GameUtils.launchBTInviter( this, m_nMissingPlayers, BTInviteActivity.launchForResult( this, m_nMissingPlayers,
BT_INVITE_RESULT ); BT_INVITE_RESULT );
break; break;
case SMS_PICK_ACTION: case SMS_PICK_ACTION:
GameUtils.launchSMSInviter( this, m_nMissingPlayers, SMSInviteActivity.launchForResult( this, m_nMissingPlayers,
SMS_INVITE_RESULT ); SMS_INVITE_RESULT );
break; break;
case SMS_CONFIG_ACTION: case SMS_CONFIG_ACTION:
Utils.launchSettings( this ); Utils.launchSettings( this );

View file

@ -508,22 +508,6 @@ public class GameUtils {
nPlayersH, null, gameID, isHost ); nPlayersH, null, gameID, isHost );
} }
public static void launchBTInviter( Activity activity, int nMissing,
int requestCode )
{
Intent intent = new Intent( activity, BTInviteActivity.class );
intent.putExtra( BTInviteActivity.INTENT_KEY_NMISSING, nMissing );
activity.startActivityForResult( intent, requestCode );
}
public static void launchSMSInviter( Activity activity, int nMissing,
int requestCode )
{
Intent intent = new Intent( activity, SMSInviteActivity.class );
intent.putExtra( SMSInviteActivity.INTENT_KEY_NMISSING, nMissing );
activity.startActivityForResult( intent, requestCode );
}
public static void launchInviteActivity( Context context, public static void launchInviteActivity( Context context,
boolean choseEmail, boolean choseEmail,
String room, String inviteID, String room, String inviteID,

View file

@ -43,7 +43,7 @@ abstract class InviteActivity extends XWListActivity
implements View.OnClickListener { implements View.OnClickListener {
public static final String DEVS = "DEVS"; public static final String DEVS = "DEVS";
public static final String INTENT_KEY_NMISSING = "NMISSING"; protected static final String INTENT_KEY_NMISSING = "NMISSING";
protected int m_nMissing; protected int m_nMissing;
protected Button m_okButton; protected Button m_okButton;

View file

@ -357,7 +357,7 @@ public class NewGameActivity extends XWActivity {
intent.putExtra( GameUtils.INTENT_FORRESULT_ROWID, true ); intent.putExtra( GameUtils.INTENT_FORRESULT_ROWID, true );
startActivityForResult( intent, CONFIG_FOR_BT ); startActivityForResult( intent, CONFIG_FOR_BT );
} else { } else {
GameUtils.launchBTInviter( this, 1, INVITE_FOR_BT ); BTInviteActivity.launchForResult( this, 1, INVITE_FOR_BT );
} }
} }
@ -378,7 +378,7 @@ public class NewGameActivity extends XWActivity {
intent.putExtra( GameUtils.INTENT_FORRESULT_ROWID, true ); intent.putExtra( GameUtils.INTENT_FORRESULT_ROWID, true );
startActivityForResult( intent, CONFIG_FOR_SMS ); startActivityForResult( intent, CONFIG_FOR_SMS );
} else { } else {
GameUtils.launchSMSInviter( this, 1, INVITE_FOR_SMS ); SMSInviteActivity.launchForResult( this, 1, INVITE_FOR_SMS );
} }
} }

View file

@ -32,9 +32,9 @@ import android.os.Bundle;
import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds; import android.provider.ContactsContract.CommonDataKinds;
import android.provider.ContactsContract; import android.provider.ContactsContract;
import android.text.method.DialerKeyListener;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.text.method.DialerKeyListener;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.CompoundButton; import android.widget.CompoundButton;
@ -64,6 +64,14 @@ public class SMSInviteActivity extends InviteActivity {
private String m_pendingNumber; private String m_pendingNumber;
private boolean m_immobileConfirmed; private boolean m_immobileConfirmed;
public static void launchForResult( Activity activity, int nMissing,
int requestCode )
{
Intent intent = new Intent( activity, SMSInviteActivity.class );
intent.putExtra( INTENT_KEY_NMISSING, nMissing );
activity.startActivityForResult( intent, requestCode );
}
@Override @Override
protected void onCreate( Bundle savedInstanceState ) protected void onCreate( Bundle savedInstanceState )
{ {