From 2a25a5fc2c069be32006302cf1db8a1d8f0b31ea Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Sun, 12 Feb 2012 10:56:29 -0500 Subject: [PATCH] Implemented Game Mode added implementation loading of game modes Change-Id: I0d92ed433577f3f7ec265eab4af8d328675b7d9b Signed-off-by: Ricky Barrette --- ExaltedDice/res/xml/settings.xml | 9 --- .../android/ExaltedDice/ExaltedDice.java | 61 +++++++++---------- .../android/ExaltedDice/GameListActivity.java | 7 ++- .../RollHistoryDatabaseAdapter.java | 16 ++++- .../android/ExaltedDice/Settings.java | 2 - 5 files changed, 50 insertions(+), 45 deletions(-) diff --git a/ExaltedDice/res/xml/settings.xml b/ExaltedDice/res/xml/settings.xml index e681892..58b7f87 100644 --- a/ExaltedDice/res/xml/settings.xml +++ b/ExaltedDice/res/xml/settings.xml @@ -6,11 +6,6 @@ android:key="roll_again" android:summary="@string/roll_again_summary" android:title="@string/roll_again" /> - - parent, View view, int position, long id) { - startActivity(new Intent(this, ExaltedDice.class).putExtra(ExaltedDice.KEY_GAME_NAME, mDb.getGameName(id +1)).putExtra(ExaltedDice.KEY_GAME_ID, id+1)); + startActivity(new Intent(this, ExaltedDice.class) + .putExtra(ExaltedDice.KEY_GAME_NAME, mDb.getGameName(id +1)) + .putExtra(ExaltedDice.KEY_GAME_ID, id+1) + .putExtra(ExaltedDice.KEY_GAME_MODE, mDb.getGameOptions(id+1).getAsString(Database.KEY_MODE))); } /** diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/RollHistoryDatabaseAdapter.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/RollHistoryDatabaseAdapter.java index 4db84ca..c157195 100644 --- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/RollHistoryDatabaseAdapter.java +++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/RollHistoryDatabaseAdapter.java @@ -28,6 +28,7 @@ public class RollHistoryDatabaseAdapter extends BaseAdapter { private LayoutInflater mInflater; private int mCount; private SharedPreferences mSettings; + private boolean isRollModEnabled = true; /** * Creates a new RollHistoryDatabaseAdapter @@ -92,7 +93,11 @@ public class RollHistoryDatabaseAdapter extends BaseAdapter { } ContentValues roll = getItem(position); - holder.mRoll.setText("Rolled: "+roll.getAsInteger(Database.KEY_NUMBER) + " "+roll.getAsString(Database.KEY_D_TYPE) +" "+ roll.getAsString(Database.KEY_MOD).replace("'", "")); + holder.mRoll.setText("Rolled: "+roll.getAsInteger(Database.KEY_NUMBER) + " "+roll.getAsString(Database.KEY_D_TYPE)); + + if(isRollModEnabled) + holder.mRoll.append(" "+ roll.getAsString(Database.KEY_MOD).replace("'", "")); + holder.mStats.setText(roll.getAsString(Database.KEY_LOG)); holder.mRolled.setText(roll.getAsString(Database.KEY_ROLLED)); @@ -129,4 +134,13 @@ public class RollHistoryDatabaseAdapter extends BaseAdapter { TextView mRolled; } + /** + * Sets the enabled state for displaying the roll mod + * @param isEnabled + * @author ricky barrette + */ + public void setRollModEnabled(boolean isEnabled) { + isRollModEnabled = isEnabled; + } + } \ No newline at end of file diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Settings.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Settings.java index 77313de..afde372 100644 --- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Settings.java +++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Settings.java @@ -31,9 +31,7 @@ public class Settings extends PreferenceActivity implements OnPreferenceClickLis private static final CharSequence EMAIL = "email"; public static final String KEY_ROLL_AGAIN = "roll_again"; - public static final String KEY_CALC_SUCCESSES = "calc_successes"; public static final String KEY_TENS_COUNT_TWICE = "tens_count_twice"; - public static final String KEY_ROLL_MOD = "roll_mod"; public static final String KEY_COLOR = "color"; // public static final String KEY_ = ""; // public static final String KEY_ = "";