From 93d80bcb33cf2eac9b1ea2bf238e62b55bf12eaa Mon Sep 17 00:00:00 2001 From: Ricky Barrette Date: Wed, 8 Feb 2012 10:47:40 -0500 Subject: [PATCH] Integrated Roll Again and Calc Successes Settings into Exalted Dice Change-Id: I12cfc26e7bdb9abaa7eab54cd567db4520f51410 Signed-off-by: Ricky Barrette --- ExaltedDice/res/xml/settings.xml | 2 ++ .../TwentyCode/android/ExaltedDice/ExaltedDice.java | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ExaltedDice/res/xml/settings.xml b/ExaltedDice/res/xml/settings.xml index aeb5e6a..3667b1c 100644 --- a/ExaltedDice/res/xml/settings.xml +++ b/ExaltedDice/res/xml/settings.xml @@ -2,10 +2,12 @@ diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java index f6dfa6c..be6f9fc 100755 --- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java +++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java @@ -9,6 +9,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.SharedPreferences; import android.os.Bundle; import android.os.Vibrator; import android.util.Log; @@ -45,6 +46,7 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic private String mGameName; private long mGameId; private RollHistoryDatabaseAdapter mListAdapter; + private SharedPreferences mSettings; /** * clears the rollHistory List array and refreshes the listview @@ -113,6 +115,8 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic this.setTitle(mGameName); } + mSettings = getSharedPreferences(Settings.SETTINGS, Context.MODE_WORLD_WRITEABLE); + mDiceValues = getResources().getStringArray(R.array.dice_types); mListView = (ListView) findViewById(R.id.list); @@ -166,7 +170,8 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic mNumberPicker.setValue(roll.getAsInteger(Database.KEY_NUMBER)); mDPicker.setValue(parseD(roll.getAsString(Database.KEY_D_TYPE))); - rollDice(); + if(mSettings.getBoolean(Settings.KEY_ROLL_AGAIN, true)) + rollDice(); } /** @@ -314,7 +319,10 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic } resultsString.append(getString(R.string.total)+ total); - resultsString.append(getString(R.string.sucesses)+ successes(roll)); + + if(mSettings.getBoolean(Settings.KEY_CALC_SUCCESSES, true)) + resultsString.append(getString(R.string.sucesses)+ successes(roll)); + resultsString.append(getString(R.string.rolls)+ rolls.toString()); return resultsString.toString(); }