cleanup: remove duplicate methods

Conflicts:
	xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java
	xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesListActivity.java
This commit is contained in:
Eric House 2014-08-09 07:20:00 -07:00
parent 91e2edecf4
commit 409085dd25
6 changed files with 11 additions and 60 deletions

View file

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

View file

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

View file

@ -55,60 +55,11 @@ public class GamesListActivity extends XWListActivity {
m_dlgt.onNewIntent( intent ); m_dlgt.onNewIntent( intent );
} }
public static void onGameDictDownload( Context context, Intent intent ) //////////////////////////////////////////////////////////////////////
// GamesListDelegator interface
//////////////////////////////////////////////////////////////////////
public void launchGame( long rowID, boolean invited )
{ {
intent.setClass( context, GamesListActivity.class ); GameUtils.launchGame( this, rowID, invited );
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 ); SMSService.onGameDictDownload( context, intent );
break; break;
case OWNER_RELAY: case OWNER_RELAY:
GamesListActivity.onGameDictDownload( context, intent ); GamesListDelegate.onGameDictDownload( context, intent );
break; break;
default: default:
DbgUtils.logf( "unexpected OWNER" ); DbgUtils.logf( "unexpected OWNER" );

View file

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

View file

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