diff --git a/ExaltedDice/res/layout/list_row.xml b/ExaltedDice/res/layout/list_row.xml index b39b66e..0976185 100755 --- a/ExaltedDice/res/layout/list_row.xml +++ b/ExaltedDice/res/layout/list_row.xml @@ -1,6 +1,26 @@ - \ No newline at end of file + + + + + + + + + \ No newline at end of file diff --git a/ExaltedDice/res/values/strings.xml b/ExaltedDice/res/values/strings.xml index 8014595..34590bb 100755 --- a/ExaltedDice/res/values/strings.xml +++ b/ExaltedDice/res/values/strings.xml @@ -21,7 +21,7 @@ Are you sure you want to quit? Total: \nSuccesses: - \nRolls: + Rolls: Roll Again Rolls the with the same presets as the selected roll from history Calculate Successes diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Database.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Database.java index 737e294..5fd7cf4 100644 --- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Database.java +++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Database.java @@ -68,9 +68,11 @@ public class Database { public final static String KEY_LOG = "log"; public final static String KEY_ROLL_ID = "roll_id"; public final static String KEY_MOD = "mod"; + public static final String KEY_ROLLED = "rolled"; private static final String TAG = "Database"; + private Context mContext; private SQLiteDatabase mDb; public boolean isUpgrading = false; diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java index d9b0d8b..415599f 100755 --- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java +++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java @@ -331,8 +331,9 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic * @return String resultsString * @author ricky barrette */ - public String results(int times) { + public ContentValues results(int times) { Log.i(TAG, "results()"); + ContentValues rolled = new ContentValues(); StringBuffer resultsString = new StringBuffer(); StringBuffer rolls = new StringBuffer(); long total = 0; @@ -351,8 +352,10 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic 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(); + rolled.put(Database.KEY_LOG, resultsString.toString()); + + rolled.put(Database.KEY_ROLLED, getString(R.string.rolls)+ rolls.toString()); + return rolled; } /** @@ -369,7 +372,7 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic ContentValues roll = new ContentValues(); roll.put(Database.KEY_D_TYPE, mDiceValues[mDPicker.getValue()]); roll.put(Database.KEY_NUMBER, mNumberPicker.getValue()); - roll.put(Database.KEY_LOG, results(mNumberPicker.getValue())); + roll.putAll(results(mNumberPicker.getValue())); roll.put(Database.KEY_MOD, DatabaseUtils.sqlEscapeString(mModValues[mModPicker.getValue()])); diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/RollHistoryDatabaseAdapter.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/RollHistoryDatabaseAdapter.java index b8c47c2..0406c9e 100644 --- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/RollHistoryDatabaseAdapter.java +++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/RollHistoryDatabaseAdapter.java @@ -78,27 +78,27 @@ public class RollHistoryDatabaseAdapter extends BaseAdapter { convertView = mInflater.inflate(R.layout.list_row, null); holder = new ViewHolder(); - holder.text = (TextView) convertView.findViewById(R.id.text1); + holder.mRoll = (TextView) convertView.findViewById(R.id.textView1); + holder.mStats = (TextView) convertView.findViewById(R.id.textView2); + holder.mRolled = (TextView) convertView.findViewById(R.id.textView3); + convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } - ContentValues roll = getItem(position); - StringBuffer s = new StringBuffer(); - s.append("Rolled: "+roll.getAsInteger(Database.KEY_NUMBER)); - s.append(" "+roll.getAsString(Database.KEY_D_TYPE)); - s.append(" "+roll.getAsString(Database.KEY_MOD).replace("'", "")); - s.append("\n"+roll.getAsString(Database.KEY_LOG)); - - holder.text.setText(s.toString()); + holder.mRoll.setText("Rolled: "+roll.getAsInteger(Database.KEY_NUMBER) + " "+roll.getAsString(Database.KEY_D_TYPE) +" "+ roll.getAsString(Database.KEY_MOD).replace("'", "")); + holder.mStats.setText(roll.getAsString(Database.KEY_LOG)); + holder.mRolled.setText(roll.getAsString(Database.KEY_ROLLED)); return convertView; } private class ViewHolder { - TextView text; + TextView mRoll; + TextView mStats; + TextView mRolled; } } \ No newline at end of file