diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 542da713c..dff4f3f33 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -1108,7 +1108,7 @@ public class BoardActivity extends XWActivity m_jniThread.handle( JNICmd.CMD_START ); if ( !CommonPrefs.getHideTitleBar( this ) ) { - setTitle( DBUtils.getName( this, m_rowid ) ); + setTitle( GameUtils.getName( this, m_rowid ) ); } m_toolbar = new Toolbar( this ); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatActivity.java index d07ba1025..3f5c8163d 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/ChatActivity.java @@ -65,7 +65,7 @@ public class ChatActivity extends XWActivity implements View.OnClickListener { ((Button)findViewById( R.id.send_button )).setOnClickListener( this ); String fmt = getString( R.string.chat_titlef ); - setTitle( String.format( fmt, DBUtils.getName( this, m_rowid ) ) ); + setTitle( String.format( fmt, GameUtils.getName( this, m_rowid ) ) ); } @Override diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBHelper.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBHelper.java index 97af39e5e..a201c49da 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBHelper.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBHelper.java @@ -31,7 +31,6 @@ public class DBHelper extends SQLiteOpenHelper { private static final String DB_NAME = "xwdb"; private static final int DB_VERSION = 9; - public static final String FILE_NAME = "FILE_NAME"; public static final String GAME_NAME = "GAME_NAME"; public static final String NUM_MOVES = "NUM_MOVES"; public static final String TURN = "TURN"; @@ -71,7 +70,6 @@ public class DBHelper extends SQLiteOpenHelper { private void onCreateSum( SQLiteDatabase db ) { db.execSQL( "CREATE TABLE " + TABLE_NAME_SUM + " (" - + FILE_NAME + " TEXT PRIMARY KEY," + GAME_NAME + " TEXT," + NUM_MOVES + " INTEGER," + TURN + " INTEGER," diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java index 730c5c88a..02a3fcbce 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/DBUtils.java @@ -601,21 +601,13 @@ public class DBUtils { synchronized( s_dbHelper ) { SQLiteDatabase db = s_dbHelper.getReadableDatabase(); - String[] columns = { DBHelper.FILE_NAME, DBHelper.GAME_NAME }; + String[] columns = { DBHelper.GAME_NAME }; String selection = String.format( ROW_ID_FMT, rowid ); Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns, selection, null, null, null, null ); if ( 1 == cursor.getCount() && cursor.moveToFirst() ) { result = cursor.getString( cursor .getColumnIndex(DBHelper.GAME_NAME)); - if ( null == result || 0 == result.length() ) { - result = cursor.getString( cursor - .getColumnIndex(DBHelper.FILE_NAME)); - if ( null == result || 0 == result.length() ) { - String fmt = context.getString( R.string.gamef ); - result = String.format( fmt, rowid ); - } - } } cursor.close(); db.close(); 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 8f07ea351..89103b680 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameConfig.java @@ -974,7 +974,7 @@ public class GameConfig extends XWActivity String fmt = getString( m_notNetworkedGame ? R.string.title_game_configf : R.string.title_gamenet_configf ); - setTitle( String.format( fmt, DBUtils.getName( this, m_rowid ) ) ); + setTitle( String.format( fmt, GameUtils.getName( this, m_rowid ) ) ); } } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java index 8cca30958..0978608a4 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameListAdapter.java @@ -78,7 +78,7 @@ public class GameListAdapter extends XWListAdapter { if ( hideTitle ) { view.setVisibility( View.GONE ); } else { - String name = DBUtils.getName( m_context, m_rowid ); + String name = GameUtils.getName( m_context, m_rowid ); String format = m_context.getString( R.string.str_game_namef ); String lang = @@ -172,7 +172,7 @@ public class GameListAdapter extends XWListAdapter { if ( hideTitle ) { view.setVisibility( View.GONE ); } else { - String text = DBUtils.getName( m_context, rowid ); + String text = GameUtils.getName( m_context, rowid ); view.setText( text ); } 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 c5116fea7..d19206608 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -286,6 +286,16 @@ public class GameUtils { } } + public static String getName( Context context, long rowid ) + { + String result = DBUtils.getName( context, rowid ); + if ( null == result || 0 == result.length() ) { + String fmt = context.getString( R.string.gamef ); + result = String.format( fmt, rowid ); + } + return result; + } + public static void loadMakeGame( Context context, int gamePtr, CurGameInfo gi, GameLock lock ) { 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 2395c0727..689c375f0 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GamesList.java @@ -227,7 +227,7 @@ public class GamesList extends XWListActivity { switch( id ) { case RENAME_GAME: - String name = DBUtils.getName( this, m_rowid ); + String name = GameUtils.getName( this, m_rowid ); EditText txt = (EditText)dialog.findViewById( R.id.name_edit ); txt.setText( name ); break;