order games within group the same way all games used to be ordered,

and get rid of the old all-games-listing code since it's no longer
used.
This commit is contained in:
Eric House 2012-12-27 20:50:37 -08:00
parent a6586b6131
commit fb575949ac
3 changed files with 5 additions and 47 deletions

View file

@ -784,35 +784,6 @@ public class DBUtils {
notifyListeners( lock.getRowid(), true );
}
public static long[] gamesList( Context context )
{
long[] result;
synchronized( DBUtils.class ) {
if ( null == s_cachedRowIDs ) {
initDB( context );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
String[] columns = { ROW_ID };
String orderBy = DBHelper.CREATE_TIME + " DESC";
Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM,
columns, null, null, null,
null, orderBy );
int count = cursor.getCount();
s_cachedRowIDs = new long[count];
int index = cursor.getColumnIndex( ROW_ID );
for ( int ii = 0; cursor.moveToNext(); ++ii ) {
s_cachedRowIDs[ii] = cursor.getLong( index );
}
cursor.close();
db.close();
}
}
result = s_cachedRowIDs;
}
return result;
}
private static void clearRowIDsCache()
{
synchronized( DBUtils.class ) {
@ -995,12 +966,13 @@ public class DBUtils {
String selection = String.format( "%s=%d", DBHelper.GROUPID, groupID );
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
String orderBy = DBHelper.CREATE_TIME + " DESC";
Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns,
selection, // selection
null, // args
null, // groupBy
null, // having
ROW_ID //orderby
orderBy
);
int index = cursor.getColumnIndex( ROW_ID );
result = new long[ cursor.getCount() ];

View file

@ -516,13 +516,6 @@ public class GameUtils {
return allHere;
}
public static boolean gameDictsHere( Context context, int indx,
String[][] name, int[] lang )
{
long rowid = DBUtils.gamesList( context )[indx];
return gameDictsHere( context, rowid, name, lang );
}
public static String newName( Context context )
{
return "untitled";

View file

@ -80,10 +80,9 @@ public class GamesList extends XWExpandableListActivity
private static final int NEW_NET_GAME_ACTION = 1;
private static final int RESET_GAME_ACTION = 2;
private static final int DELETE_GAME_ACTION = 3;
private static final int DELETE_ALL_ACTION = 4;
private static final int SYNC_MENU_ACTION = 5;
private static final int NEW_FROM_ACTION = 6;
private static final int DELETE_GROUP_ACTION = 7;
private static final int SYNC_MENU_ACTION = 4;
private static final int NEW_FROM_ACTION = 5;
private static final int DELETE_GROUP_ACTION = 6;
private static final int[] DEBUGITEMS = { R.id.gamel_menu_loaddb
, R.id.gamel_menu_storedb
, R.id.gamel_menu_checkupdates
@ -542,12 +541,6 @@ public class GamesList extends XWExpandableListActivity
case DELETE_GAME_ACTION:
GameUtils.deleteGame( this, m_rowid, true );
break;
case DELETE_ALL_ACTION:
long[] games = DBUtils.gamesList( this );
for ( int ii = games.length - 1; ii >= 0; --ii ) {
GameUtils.deleteGame( this, games[ii], ii == 0 );
}
break;
case SYNC_MENU_ACTION:
doSyncMenuitem();
break;