diff --git a/ExaltedDice/AndroidManifest.xml b/ExaltedDice/AndroidManifest.xml
index f81a662..251b4e0 100755
--- a/ExaltedDice/AndroidManifest.xml
+++ b/ExaltedDice/AndroidManifest.xml
@@ -3,7 +3,9 @@
android:installLocation="auto"
package="com.TwentyCode.android.ExaltedDice"
android:versionCode="15"
- android:versionName="1.0.1" >
+ android:versionName="1.0.1" >
+
+
-
-
-
-
diff --git a/ExaltedDice/res/layout-land/main.xml b/ExaltedDice/res/layout-land/main.xml
index 6ba9d12..2f2c665 100755
--- a/ExaltedDice/res/layout-land/main.xml
+++ b/ExaltedDice/res/layout-land/main.xml
@@ -20,13 +20,26 @@
android:layout_centerHorizontal="true"
layout="@layout/dice_selector" />
-
+ android:layout_marginTop="10dip" >
+
+
+
+
+
-
+ android:layout_weight="1" >
+
+
+
+
+
-3
- -2
- -1
- - 0
+ - +0
- +1
- +2
- +3
diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Database.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Database.java
index 5fd7cf4..7a83dea 100644
--- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Database.java
+++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Database.java
@@ -554,6 +554,9 @@ public class Database {
* update the game table
*/
mDb.update(GAME_NAME_TABLE, game, "id" + "= "+ id, null);
+
+ if(mListener != null)
+ mListener.onDatabaseInsertComplete();
}
/**
diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/DatabaseListener.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/DatabaseListener.java
index 7cecefa..6a13b37 100644
--- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/DatabaseListener.java
+++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/DatabaseListener.java
@@ -36,5 +36,11 @@ public interface DatabaseListener {
* @author ricky barrette
*/
public void onDatabaseUpgrade();
+
+ /**
+ * Called when information has been inserted into the database
+ * @author ricky barrette
+ */
+ public void onDatabaseInsertComplete();
}
\ No newline at end of file
diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java
index 9948d28..0ff8aab 100755
--- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java
+++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java
@@ -25,11 +25,12 @@ import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.NumberPicker;
+import android.widget.ProgressBar;
import android.widget.Toast;
import com.TwentyCodes.android.exception.ExceptionHandler;
-public class ExaltedDice extends Activity implements OnClickListener, OnItemClickListener {
+public class ExaltedDice extends Activity implements OnClickListener, OnItemClickListener, DatabaseListener {
private static final int MENU_QUIT = Menu.FIRST;
private static final int MENU_CLEAR = Menu.FIRST + 1;
@@ -50,6 +51,8 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
private SharedPreferences mSettings;
private String[] mModValues;
private NumberPicker mModPicker;
+ private ProgressBar mRollProgress;
+ private View mRollButton;
/**
* Applies the presets from the provided roll
@@ -160,7 +163,10 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
mModPicker.setDisplayedValues(mModValues);
mModPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
- findViewById(R.id.roll_button).setOnClickListener(this);
+ mRollProgress = (ProgressBar) findViewById(R.id.roll_progress);
+
+ mRollButton = findViewById(R.id.roll_button);
+ mRollButton.setOnClickListener(this);
}
/**
@@ -261,7 +267,7 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
*/
@Override
protected void onStart() {
- mDb = new Database(this);
+ mDb = new Database(this, this);
mListAdapter = new RollHistoryDatabaseAdapter(mGameId, mDb, this);
mListView.setAdapter(mListAdapter);
super.onStart();
@@ -377,21 +383,27 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
* @author ricky barrette
*/
public void rollDice() {
- // vibrate for 50 milliseconds
- vibrate(50);
+ mRollButton.setEnabled(false);
+ mRollProgress.setVisibility(View.VISIBLE);
- int rollId = mDb.getGameRollCount(mGameId) +1;
-
- ContentValues roll = new ContentValues();
- roll.put(Database.KEY_D_TYPE, mDiceValues[mDPicker.getValue()]);
- roll.put(Database.KEY_NUMBER, mNumberPicker.getValue());
- roll.putAll(results(mNumberPicker.getValue()));
-
- roll.put(Database.KEY_MOD, DatabaseUtils.sqlEscapeString(mModValues[mModPicker.getValue()]));
-
- mDb.updateGame(mGameId, mGameName, roll, rollId);
-
- refresh();
+ new Thread( new Runnable() {
+ @Override
+ public void run(){
+ // vibrate for 50 milliseconds
+ vibrate(50);
+
+ int rollId = mDb.getGameRollCount(mGameId) +1;
+
+ ContentValues roll = new ContentValues();
+ roll.put(Database.KEY_D_TYPE, mDiceValues[mDPicker.getValue()]);
+ roll.put(Database.KEY_NUMBER, mNumberPicker.getValue());
+ roll.putAll(results(mNumberPicker.getValue()));
+
+ roll.put(Database.KEY_MOD, DatabaseUtils.sqlEscapeString(mModValues[mModPicker.getValue()]));
+
+ mDb.updateGame(mGameId, mGameName, roll, rollId);
+ }
+ }).start();
}
/**
@@ -452,4 +464,38 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
Vibrator vib = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
vib.vibrate(milliseconds);
}
+
+ @Override
+ public void onDatabaseUpgradeComplete() {
+ // do nothing
+
+ }
+
+ @Override
+ public void onDeletionComplete() {
+ // do nothing
+
+ }
+
+ @Override
+ public void onRestoreComplete() {
+ // do nothing
+ }
+
+ @Override
+ public void onDatabaseUpgrade() {
+ //do nothing
+ }
+
+ @Override
+ public void onDatabaseInsertComplete() {
+ this.runOnUiThread(new Runnable(){
+ @Override
+ public void run(){
+ mRollProgress.setVisibility(View.GONE);
+ mRollButton.setEnabled(true);
+ refresh();
+ }
+ });
+ }
}
\ No newline at end of file
diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/GameListActivity.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/GameListActivity.java
index b669f97..0f30628 100644
--- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/GameListActivity.java
+++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/GameListActivity.java
@@ -81,6 +81,12 @@ public class GameListActivity extends Activity implements OnClickListener, Datab
super.onCreateContextMenu(menu, v, menuInfo);
}
+ @Override
+ public void onDatabaseInsertComplete() {
+ // TODO Auto-generated method stub
+
+ }
+
@Override
public void onDatabaseUpgrade() {
// TODO Auto-generated method stub