Remove 'all' as a Platform enum.

This will remove the 'all games' row on the TV view.
This commit is contained in:
Mike Harris 2017-09-27 11:16:48 -07:00
parent cc77a4963f
commit 3c3d0fa6f5
3 changed files with 5 additions and 13 deletions

View File

@ -70,9 +70,10 @@ public final class GameRowPresenter extends Presenter
backgroundId = R.drawable.tv_card_background_wii; backgroundId = R.drawable.tv_card_background_wii;
break; break;
case WIIWARE: case WIIWARE:
default: // This shouldn't happen, but set the default to WiiWare colors.
backgroundId = R.drawable.tv_card_background_wiiware; backgroundId = R.drawable.tv_card_background_wiiware;
break; break;
default:
throw new AssertionError("Not reachable.");
} }
Context context = holder.cardParent.getContext(); Context context = holder.cardParent.getContext();
Drawable background = ContextCompat.getDrawable(context, backgroundId); Drawable background = ContextCompat.getDrawable(context, backgroundId);

View File

@ -262,21 +262,13 @@ public final class GameDatabase extends SQLiteOpenHelper
{ {
Log.info("[GameDatabase] Reading games list..."); Log.info("[GameDatabase] Reading games list...");
String[] whereArgs = new String[]{Integer.toString(platform.toInt())};
// Only add a WHERE clause if we have a specific platform
String whereClause = null;
String[] whereArgs = null;
if (platform != Platform.ALL)
{
whereClause = KEY_GAME_PLATFORM + " = ?";
whereArgs = new String[]{Integer.toString(platform.toInt())};
}
SQLiteDatabase database = getReadableDatabase(); SQLiteDatabase database = getReadableDatabase();
Cursor resultCursor = database.query( Cursor resultCursor = database.query(
TABLE_NAME_GAMES, TABLE_NAME_GAMES,
null, null,
whereClause, KEY_GAME_PLATFORM + " = ?",
whereArgs, whereArgs,
null, null,
null, null,

View File

@ -5,8 +5,7 @@ public enum Platform
{ {
GAMECUBE(0, "GameCube Games"), GAMECUBE(0, "GameCube Games"),
WII(1, "Wii Games"), WII(1, "Wii Games"),
WIIWARE(2, "WiiWare Games"), WIIWARE(2, "WiiWare Games");
ALL(3, "All Games");
private final int value; private final int value;
private final String headerName; private final String headerName;