diff --git a/ExaltedDice/AndroidManifest.xml b/ExaltedDice/AndroidManifest.xml
index 2f1b86c..d76ddec 100755
--- a/ExaltedDice/AndroidManifest.xml
+++ b/ExaltedDice/AndroidManifest.xml
@@ -31,6 +31,10 @@
android:name="ExaltedDice"
android:theme="@android:style/Theme.Holo" >
+
+
diff --git a/ExaltedDice/res/values/strings.xml b/ExaltedDice/res/values/strings.xml
index 261ffc7..97dc274 100755
--- a/ExaltedDice/res/values/strings.xml
+++ b/ExaltedDice/res/values/strings.xml
@@ -10,5 +10,9 @@
Create New Game
Delete
New Game
+ Version Information
+ twentycodes@gmail.com
+ Send an email with ideas or problems to help make this application even better! Good or bad we want to know what you think!
+ Contact Us
\ No newline at end of file
diff --git a/ExaltedDice/res/xml/settings.xml b/ExaltedDice/res/xml/settings.xml
new file mode 100644
index 0000000..f8a6ac8
--- /dev/null
+++ b/ExaltedDice/res/xml/settings.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 57c62c6..992cac4 100755
--- a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java
+++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/ExaltedDice.java
@@ -36,6 +36,7 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
public static final String KEY_GAME_ID = "game_id";
private static final String[] DICE_VALUES = { "D2", "D3", "D4", "D6", "D8", "D10", "D12", "D20", "D100" };
private static final int DELETE = 0;
+ private static final int SETTINGS = Menu.FIRST + 2;
private ListView mListView;
private NumberPicker mNumberPicker;
@@ -148,6 +149,7 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
*/
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(1, MENU_CLEAR, 0, "Clear Roll History");
+ menu.add(1, SETTINGS, 0, "Settings");
menu.add(1, MENU_QUIT, 0, "Quit");
return true;
}
@@ -174,12 +176,15 @@ public class ExaltedDice extends Activity implements OnClickListener, OnItemClic
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
- case MENU_QUIT:
- quitDialog();
- return true;
- case MENU_CLEAR:
- clearHistory();
- return true;
+ case MENU_QUIT:
+ quitDialog();
+ return true;
+ case MENU_CLEAR:
+ clearHistory();
+ return true;
+ case SETTINGS:
+ startActivity(new Intent(this, Settings.class));
+ break;
}
return false;
}
diff --git a/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Settings.java b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Settings.java
new file mode 100644
index 0000000..b3aea1e
--- /dev/null
+++ b/ExaltedDice/src/com/TwentyCode/android/ExaltedDice/Settings.java
@@ -0,0 +1,85 @@
+/**
+ * Settings.java
+ * @date Feb 6, 2012
+ * @author ricky barrette
+ * @author Twenty Codes, LLC
+ */
+package com.TwentyCode.android.ExaltedDice;
+
+import android.content.Intent;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceActivity;
+
+/**
+ * This activity will be used to allow the user to fine tune exalted dice
+ *
+ * TODO
+ * + game specific settings?
+ * @author ricky barrette
+ */
+public class Settings extends PreferenceActivity implements OnPreferenceClickListener {
+
+ public static final String SETTINGS = "settings";
+ private static final CharSequence EMAIL = "email";
+
+ /**
+ * (non-Javadoc)
+ * @see android.preference.PreferenceActivity#onCreate(android.os.Bundle)
+ */
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ //set shared_prefs name
+ getPreferenceManager().setSharedPreferencesName(SETTINGS);
+
+ //load preferences xml. this load relies on only wether the app is full or not. it will show the check license option if full and leave it out if lite
+ addPreferencesFromResource(R.xml.settings);
+ this.findPreference(EMAIL).setOnPreferenceClickListener(this);
+ }
+
+ /**
+ * called when the email preference button is clicked
+ */
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ this.startActivity(generateEmailIntent());
+ return false;
+ }
+
+ /**
+ * generates the exception repost email intent
+ * @param report
+ * @return intent to start users email client
+ * @author ricky barrette
+ */
+ private Intent generateEmailIntent() {
+ /*
+ * get the build information, and build the string
+ */
+ PackageManager pm = this.getPackageManager();
+ PackageInfo pi;
+ try {
+ pi = pm.getPackageInfo(this.getPackageName(), 0);
+ } catch (NameNotFoundException eNnf) {
+ //doubt this will ever run since we want info about our own package
+ pi = new PackageInfo();
+ pi.versionName = "unknown";
+ pi.versionCode = 1;
+ }
+
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ String theSubject = this.getString(R.string.app_name);
+ String theBody = "\n\n\n"+ Build.FINGERPRINT +"\n"+ this.getString(R.string.app_name)+" "+pi.versionName+" build "+pi.versionCode;
+ intent.putExtra(Intent.EXTRA_EMAIL,new String[] {this.getString(R.string.email)});
+ intent.putExtra(Intent.EXTRA_TEXT, theBody);
+ intent.putExtra(Intent.EXTRA_SUBJECT, theSubject);
+ intent.setType("message/rfc822");
+ return intent;
+ }
+}
\ No newline at end of file