From f75318e9d07ea78ce56bfa68fc79f78656073dab Mon Sep 17 00:00:00 2001 From: Andy2 Date: Mon, 21 Feb 2011 19:47:00 -0800 Subject: [PATCH] rename method and add variant then remove duplicated code. No behavior change. --- .../src/org/eehouse/android/xw4/GameConfig.java | 2 +- .../src/org/eehouse/android/xw4/GameUtils.java | 5 +++++ .../src/org/eehouse/android/xw4/GamesList.java | 13 ++----------- .../org/eehouse/android/xw4/RelayGameActivity.java | 2 +- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java index 20d272066..034b5805b 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java @@ -898,7 +898,7 @@ public class GameConfig extends XWActivity private void launchGame() { if ( m_notNetworkedGame || m_car.ip_relay_invite.length() > 0 ) { - GameUtils.launchGame( this, m_path ); + GameUtils.launchGameAndFinish( this, m_path ); } else { showOKOnlyDialog( R.string.no_empty_rooms ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index 4609f24d9..da433756b 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -392,6 +392,11 @@ public class GameUtils { Intent intent = new Intent( Intent.ACTION_EDIT, uri, activity, BoardActivity.class ); activity.startActivity( intent ); + } + + public static void launchGameAndFinish( Activity activity, String path ) + { + launchGame( activity, path ); activity.finish(); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java index a62bcae8d..421f4ccfa 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -406,7 +406,7 @@ public class GamesList extends XWListActivity GameUtils.doConfig( this, path, clazz ); } else { if ( checkWarnNoDict( path ) ) { - startForPath( path ); + GameUtils.launchGame( this, path ); } } m_invalPath = path; @@ -540,15 +540,6 @@ public class GamesList extends XWListActivity } } - private void startForPath( String path ) - { - File file = new File( path ); - Uri uri = Uri.fromFile( file ); - Intent intent = new Intent( Intent.ACTION_EDIT, uri, - this, BoardActivity.class ); - startActivity( intent ); - } - // Launch the first of these for which there's a dictionary // present. private void startFirstHasDict( Intent intent ) @@ -560,7 +551,7 @@ public class GamesList extends XWListActivity for ( String relayID : relayIDs ) { String path = DBUtils.getPathFor( this, relayID ); if ( GameUtils.gameDictHere( this, path ) ) { - startForPath( path ); + GameUtils.launchGame( this, path ); break; } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayGameActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayGameActivity.java index 303d5dcbf..702b3dc90 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayGameActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/RelayGameActivity.java @@ -94,7 +94,7 @@ public class RelayGameActivity extends XWActivity showOKOnlyDialog( R.string.no_empty_rooms ); } else { saveRoomAndName( room ); - GameUtils.launchGame( this, m_path ); + GameUtils.launchGameAndFinish( this, m_path ); } } else if ( view == m_configButton ) { saveRoomAndName( room );