Updated roll history list UI

Made the list easier to read by making different parts of the information
bigger of smaller

Change-Id: I64482dfd8ec03ded60e96f7dd9916445ef8ee7fe
Signed-off-by: Ricky Barrette <rickbarrette@gmail.com>
This commit is contained in:
2012-02-08 12:26:04 -05:00
parent a7ea1ed73b
commit 12a1d4c17d
5 changed files with 45 additions and 20 deletions

View File

@@ -1,6 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@+id/text1"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20px"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>

View File

@@ -21,7 +21,7 @@
<string name="do_you_want_to_quit">Are you sure you want to quit?</string>
<string name="total">Total: </string>
<string name="sucesses">\nSuccesses: </string>
<string name="rolls">\nRolls: </string>
<string name="rolls">Rolls: </string>
<string name="roll_again">Roll Again</string>
<string name="roll_again_summary">Rolls the with the same presets as the selected roll from history</string>
<string name="calc_successes">Calculate Successes</string>

View File

@@ -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;

View File

@@ -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()]));

View File

@@ -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;
}
}