cleanup: remove duplicate methods

This commit is contained in:
Eric House 2014-08-09 07:20:00 -07:00
parent b7db0125ba
commit 20509d8449
8 changed files with 14 additions and 67 deletions

View file

@ -971,7 +971,7 @@ public class BTService extends XWService {
private void postNotification( int gameID, int title, String body,
long rowid )
{
Intent intent = GamesListActivity.makeGameIDIntent( this, gameID );
Intent intent = GamesListDelegate.makeGameIDIntent( this, gameID );
Utils.postNotification( this, intent, R.string.new_btmove_title,
body, (int)rowid );
}

View file

@ -2258,7 +2258,7 @@ public class BoardDelegate extends DelegateBase
private void doRematch()
{
Intent intent = GamesListActivity.makeRematchIntent( m_activity, m_gi, m_rowid );
Intent intent = GamesListDelegate.makeRematchIntent( m_activity, m_gi, m_rowid );
if ( null != intent ) {
startActivity( intent );
m_delegator.finish();

View file

@ -40,7 +40,7 @@ public class DispatchNotify extends Activity {
Uri data = getIntent().getData();
if ( null != data ) { // relay invite redirected URL case
GamesListActivity.openGame( this, data );
GamesListDelegate.openGame( this, data );
}
finish();

View file

@ -724,10 +724,14 @@ public class GameUtils {
public static void launchGame( Activity activity, long rowid,
boolean invited )
{
Intent intent = new Intent( activity, BoardActivity.class );
Bundle extras = makeLaunchExtras( rowid, invited );
intent.putExtras( extras );
activity.startActivity( intent );
if ( activity instanceof FragActivity ) {
FragActivity.addFragment( new BoardFrag(), extras );
} else {
Intent intent = new Intent( activity, BoardActivity.class );
intent.putExtras( extras );
activity.startActivity( intent );
}
}
public static void launchGame( Activity activity, long rowid )

View file

@ -62,61 +62,4 @@ public class GamesListActivity extends XWListActivity implements GamesListDelega
{
GameUtils.launchGame( this, rowID, invited );
}
public static void onGameDictDownload( Context context, Intent intent )
{
intent.setClass( context, GamesListActivity.class );
context.startActivity( intent );
}
private static Intent makeSelfIntent( Context context )
{
Intent intent = new Intent( context, GamesListActivity.class );
intent.setFlags( Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK );
return intent;
}
public static Intent makeRowidIntent( Context context, long rowid )
{
Intent intent = makeSelfIntent( context );
intent.putExtra( ROWID_EXTRA, rowid );
return intent;
}
public static Intent makeGameIDIntent( Context context, int gameID )
{
Intent intent = makeSelfIntent( context );
intent.putExtra( GAMEID_EXTRA, gameID );
return intent;
}
public static Intent makeRematchIntent( Context context, CurGameInfo gi,
long rowid )
{
Intent intent = null;
if ( CurGameInfo.DeviceRole.SERVER_STANDALONE == gi.serverRole ) {
intent = makeSelfIntent( context )
.putExtra( REMATCH_ROWID_EXTRA, rowid );
} else {
Utils.notImpl( context );
}
return intent;
}
public static Intent makeAlertIntent( Context context, String msg )
{
Intent intent = makeSelfIntent( context );
intent.putExtra( ALERT_MSG, msg );
return intent;
}
public static void openGame( Context context, Uri data )
{
Intent intent = makeSelfIntent( context );
intent.setData( data );
context.startActivity( intent );
}
}

View file

@ -172,7 +172,7 @@ public class MultiService {
SMSService.onGameDictDownload( context, intent );
break;
case OWNER_RELAY:
GamesListActivity.onGameDictDownload( context, intent );
GamesListDelegate.onGameDictDownload( context, intent );
break;
default:
DbgUtils.logf( "unexpected OWNER" );

View file

@ -379,7 +379,7 @@ public class RelayService extends XWService
private void setupNotification( long rowid )
{
Intent intent = GamesListActivity.makeRowidIntent( this, rowid );
Intent intent = GamesListDelegate.makeRowidIntent( this, rowid );
String msg = LocUtils.getString( this, R.string.notify_body_fmt,
GameUtils.getName( this, rowid ) );
Utils.postNotification( this, intent, R.string.notify_title,
@ -580,7 +580,7 @@ public class RelayService extends XWService
break;
case XWPDEV_ALERT:
str = getVLIString( dis );
Intent intent = GamesListActivity.makeAlertIntent( this, str );
Intent intent = GamesListDelegate.makeAlertIntent( this, str );
Utils.postNotification( this, intent,
R.string.relay_alert_title,
str, str.hashCode() );

View file

@ -789,7 +789,7 @@ public class SMSService extends XWService {
private void postNotification( int gameID, int title, String body,
long rowid )
{
Intent intent = GamesListActivity.makeGameIDIntent( this, gameID );
Intent intent = GamesListDelegate.makeGameIDIntent( this, gameID );
Utils.postNotification( this, intent, title, body, (int)rowid );
}