diff --git a/ExceptionHandlerLib/AndroidManifest.xml b/ExceptionHandlerLib/AndroidManifest.xml
index c02ac16..b78863a 100644
--- a/ExceptionHandlerLib/AndroidManifest.xml
+++ b/ExceptionHandlerLib/AndroidManifest.xml
@@ -6,7 +6,7 @@
+ android:targetSdkVersion="16" />
diff --git a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ExceptionHandler.java b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ExceptionHandler.java
index 8a9a03a..5be79c4 100644
--- a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ExceptionHandler.java
+++ b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ExceptionHandler.java
@@ -30,18 +30,20 @@ import android.util.Log;
import anroid.v4.compat.NotificationCompat;
/**
- * This is Twenty Codes, LLC Exception Handler of Awesomeness!
- * This class will be used to generate reports that will be emailed to us via the users email client after the users approval
+ * This is Twenty Codes, LLC Exception Handler of Awesomeness! This class will
+ * be used to generate reports that will be emailed to us via the users email
+ * client after the users approval
+ *
* @author ricky barrette
*/
public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
private static final String MSG_SUBJECT_TAG = "Exception Report";
- private static final String MSG_BODY = "Just click send to help make this application better. "+
- "No personal information is being sent (you can check by reading the rest of the email).";
+ private static final String MSG_BODY = "Just click send to help make this application better. "
+ + "No personal information is being sent (you can check by reading the rest of the email).";
protected static final int SIMPLE_NOTFICATION_ID = 45684645;
private final Thread.UncaughtExceptionHandler mDefaultUEH;
- private Activity mApp= null;
+ private Activity mApp = null;
private Service mService = null;
private BroadcastReceiver mBroadcastReceiver = null;
private final Context mContext;
@@ -54,6 +56,7 @@ public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
/**
* Creates a new ExceptionHandler
+ *
* @param app
* @author ricky barrette
*/
@@ -66,10 +69,11 @@ public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
/**
* Creates a new ExceptionHandler
+ *
* @param broadcastReceiver
* @author ricky barrette
*/
- public ExceptionHandler(final BroadcastReceiver broadcastReceiver, final Context context){
+ public ExceptionHandler(final BroadcastReceiver broadcastReceiver, final Context context) {
mDefaultUEH = Thread.getDefaultUncaughtExceptionHandler();
mBroadcastReceiver = broadcastReceiver;
mContext = context;
@@ -78,10 +82,11 @@ public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
/**
* Creates a new ExceptionHandler
+ *
* @param service
* @author ricky barrette
*/
- public ExceptionHandler(final Service service){
+ public ExceptionHandler(final Service service) {
mDefaultUEH = Thread.getDefaultUncaughtExceptionHandler();
mService = service;
mContext = service;
@@ -90,25 +95,26 @@ public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
/**
* Generates an email from the report
+ *
* @author ricky barrette
*/
- private void displayEmailNotification(){
+ private void displayEmailNotification() {
Log.i(TAG, "displayEmailNotification");
CharSequence title = null;
- if(mApp != null)
+ if (mApp != null)
title = mApp.getTitle();
- if(mService != null)
+ if (mService != null)
title = mService.getClass().getName();
- if(mBroadcastReceiver != null)
+ if (mBroadcastReceiver != null)
title = mBroadcastReceiver.getClass().getName();
final Intent intent = new Intent(Intent.ACTION_SEND);
final String theSubject = title + " " + MSG_SUBJECT_TAG;
- final String theBody = "\n\n"+MSG_BODY+mReport.toString();
- intent.putExtra(Intent.EXTRA_EMAIL,new String[] {mEmail});
+ final String theBody = "\n\n" + MSG_BODY + mReport.toString();
+ intent.putExtra(Intent.EXTRA_EMAIL, new String[] { mEmail });
intent.putExtra(Intent.EXTRA_TEXT, theBody);
intent.putExtra(Intent.EXTRA_SUBJECT, theSubject);
intent.setType("message/rfc822");
@@ -117,7 +123,9 @@ public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
}
/**
- * displays an notification in the status bar, letting the user know that there was an issue
+ * displays an notification in the status bar, letting the user know that
+ * there was an issue
+ *
* @param generatedReportIntent
*/
private void displayNotification(final Intent generatedReportIntent) {
@@ -125,19 +133,16 @@ public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
final Context context = mContext.getApplicationContext();
final NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
final PendingIntent intent = PendingIntent.getActivity(context, 0, generatedReportIntent, android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
- final NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
- .setContentTitle(context.getString(R.string.crash))
- .setContentText(context.getString(R.string.sorry))
- .setTicker(context.getString(R.string.crash))
- .setSmallIcon(android.R.drawable.stat_notify_error)
- .setWhen(System.currentTimeMillis())
- .setAutoCancel(true)
- .setContentIntent(intent);
- notificationManager.notify(SIMPLE_NOTFICATION_ID, builder.getNotification());
+ final NotificationCompat.Builder builder = new NotificationCompat.Builder(context).setContentTitle(context.getString(R.string.crash))
+ .setContentText(context.getString(R.string.sorry)).setTicker(context.getString(R.string.crash)).setSmallIcon(android.R.drawable.stat_notify_error)
+ .setWhen(System.currentTimeMillis()).setAutoCancel(true).setContentIntent(intent);
+ notificationManager.notify(SIMPLE_NOTFICATION_ID, builder.getNotification());
}
/**
- * parses in the exception handler options from the client application's assets folder. /assets/exceptionhandler.properties
+ * parses in the exception handler options from the client application's
+ * assets folder. /assets/exceptionhandler.properties
+ *
* @author ricky barrette
*/
private void parseProperties() {
@@ -160,35 +165,36 @@ public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
@Override
public void run() {
- if(mEmail == null)
+ if (mEmail == null)
displayNotification(new Intent(mContext, ExceptionReportActivity.class).putExtra("report", mReport));
else
displayEmailNotification();
}
/**
- * Called when there is an uncaught exception.
- * (non-Javadoc)
- * @see java.lang.Thread.UncaughtExceptionHandler#uncaughtException(java.lang.Thread, java.lang.Throwable)
+ * Called when there is an uncaught exception. (non-Javadoc)
+ *
+ * @see java.lang.Thread.UncaughtExceptionHandler#uncaughtException(java.lang.Thread,
+ * java.lang.Throwable)
* @author ricky barrette
*/
@Override
public void uncaughtException(final Thread t, final Throwable e) {
Log.d(TAG, "uncaughtException()");
- // Log.d(TAG,"mURL = "+ this.mURL);
- // Log.d(TAG,"mEmail = "+ this.mEmail);
+ // Log.d(TAG,"mURL = "+ this.mURL);
+ // Log.d(TAG,"mEmail = "+ this.mEmail);
final Date theDate = new Date();
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd_HH.mm.ss_zzz");
final PackageManager pm = mContext.getPackageManager();
- //app environment;
+ // app environment;
PackageInfo pi;
try {
pi = pm.getPackageInfo(mContext.getPackageName(), 0);
} catch (final NameNotFoundException eNnf) {
- //doubt this will ever run since we want info about our own package
+ // doubt this will ever run since we want info about our own package
pi = new PackageInfo();
pi.versionName = "unknown";
pi.versionCode = 69;
@@ -196,37 +202,37 @@ public class ExceptionHandler implements UncaughtExceptionHandler, Runnable {
final StringBuffer report = new StringBuffer();
for (final StackTraceElement item : e.getStackTrace())
- report.append("at "+item.toString() + "\n");
+ report.append("at " + item.toString() + "\n");
final StringBuffer causereport = new StringBuffer();
final Throwable cause = e.getCause();
if (cause != null) {
causereport.append(cause.toString() + "\n \n");
for (final StackTraceElement item : cause.getStackTrace())
- causereport.append("at "+item.toString() + "\n");
+ causereport.append("at " + item.toString() + "\n");
}
- //generate the report
- mReport = new Report(mURL).generateReport(e.toString(), report.toString(), causereport.toString(), sdf.format(theDate), Build.FINGERPRINT, pi.versionName+"b"+pi.versionCode, mAppName != null ? mAppName : mContext.getPackageName(), mTracker, mContext.getPackageName());
+ // generate the report
+ mReport = new Report(mURL).generateReport(e.toString(), report.toString(), causereport.toString(), sdf.format(theDate), Build.FINGERPRINT, pi.versionName + "b"
+ + pi.versionCode, mAppName != null ? mAppName : mContext.getPackageName(), mTracker, mContext.getPackageName());
- //try to send file contents via email (need to do so via the UI thread)
- if(mApp != null)
+ // try to send file contents via email (need to do so via the UI thread)
+ if (mApp != null)
mApp.runOnUiThread(this);
-
- if(mService != null)
- if(mEmail == null)
+ if (mService != null)
+ if (mEmail == null)
displayNotification(new Intent(mContext, ExceptionReportActivity.class).putExtra("report", mReport));
else
displayEmailNotification();
- if(mBroadcastReceiver != null)
- if(mEmail == null)
+ if (mBroadcastReceiver != null)
+ if (mEmail == null)
displayNotification(new Intent(mContext, ExceptionReportActivity.class).putExtra("report", mReport));
else
displayEmailNotification();
- //do not forget to pass this exception through up the chain
- mDefaultUEH.uncaughtException(t,e);
+ // do not forget to pass this exception through up the chain
+ mDefaultUEH.uncaughtException(t, e);
}
}
\ No newline at end of file
diff --git a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ExceptionReportActivity.java b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ExceptionReportActivity.java
index 7d258b7..78d3b54 100644
--- a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ExceptionReportActivity.java
+++ b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ExceptionReportActivity.java
@@ -16,7 +16,9 @@ import android.widget.EditText;
import android.widget.ListView;
/**
- * This activity will be used to present the user with the exception report, and allows them to send it, or not
+ * This activity will be used to present the user with the exception report, and
+ * allows them to send it, or not
+ *
* @author ricky barrette
*/
public class ExceptionReportActivity extends Activity implements OnClickListener {
@@ -26,6 +28,7 @@ public class ExceptionReportActivity extends Activity implements OnClickListener
/**
* (non-Javadoc)
+ *
* @see android.view.View.OnClickListener#onClick(android.view.View)
* @author ricky barrette
*/
@@ -40,6 +43,7 @@ public class ExceptionReportActivity extends Activity implements OnClickListener
/**
* (non-Javadoc)
+ *
* @see android.app.Activity#onCreate(android.os.Bundle)
* @author ricky barrette
*/
@@ -49,7 +53,7 @@ public class ExceptionReportActivity extends Activity implements OnClickListener
super.onCreate(savedInstanceState);
mReport = (Report) getIntent().getParcelableExtra("report");
- if(getIntent().hasExtra("display"))
+ if (getIntent().hasExtra("display"))
this.setContentView(R.layout.list);
else {
this.setContentView(R.layout.exception_activity);
diff --git a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/Report.java b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/Report.java
index 8058cdb..104a9e2 100644
--- a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/Report.java
+++ b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/Report.java
@@ -29,10 +29,12 @@ import android.os.Parcel;
import android.os.Parcelable;
/**
- * This class will be used to generate a report, and insert it into our exception report database
+ * This class will be used to generate a report, and insert it into our
+ * exception report database
+ *
* @author ricky barrette
*/
-public class Report implements Parcelable{
+public class Report implements Parcelable {
private final String mUrl;
private ArrayList mReport;
@@ -51,10 +53,11 @@ public class Report implements Parcelable{
/**
* Creates a new Report
+ *
* @param in
* @author ricky barrette
*/
- public Report(final Parcel in){
+ public Report(final Parcel in) {
mUrl = in.readString();
mReport = new ArrayList();
in.readTypedList(mReport, ReportItem.CREATOR);
@@ -62,10 +65,11 @@ public class Report implements Parcelable{
/**
* Creates a new Report
+ *
* @author ricky barrette
*/
public Report(final String url) {
- // Log.d(TAG, url);
+ // Log.d(TAG, url);
mUrl = url;
}
@@ -76,24 +80,25 @@ public class Report implements Parcelable{
/**
* Files the report with the remote database
+ *
* @author ricky barrette
* @throws IOException
* @throws ClientProtocolException
* @return String result
*/
- public String file() throws ClientProtocolException, IOException{
+ public String file() throws ClientProtocolException, IOException {
final HttpClient httpclient = new DefaultHttpClient();
final HttpPost httppost = new HttpPost(mUrl);
httppost.setEntity(new UrlEncodedFormEntity(getNameValuePairs()));
- //return the results
+ // return the results
final HttpResponse response = httpclient.execute(httppost);
final HttpEntity entity = response.getEntity();
final InputStream is = entity.getContent();
- final BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
final StringBuilder sb = new StringBuilder();
sb.append(reader.readLine() + "\n");
- String line="0";
+ String line = "0";
while ((line = reader.readLine()) != null)
sb.append(line + "\n");
is.close();
@@ -103,24 +108,26 @@ public class Report implements Parcelable{
/**
* Generates a report to be displayed form a downloaded JSON object
+ *
* @param report
* @return
* @author ricky barrette
* @throws JSONException
*/
@SuppressWarnings("rawtypes")
- public Report generateReport(final JSONObject report) throws JSONException{
+ public Report generateReport(final JSONObject report) throws JSONException {
mReport = new ArrayList();
final Iterator iter = report.keys();
- while(iter.hasNext()){
- final String key = (String)iter.next();
- mReport.add(new ReportItem(key , report.getString(key)));
+ while (iter.hasNext()) {
+ final String key = (String) iter.next();
+ mReport.add(new ReportItem(key, report.getString(key)));
}
return this;
}
/**
* Generates a report to be sent.
+ *
* @param msg
* @param stackTrace
* @param cause
@@ -130,28 +137,30 @@ public class Report implements Parcelable{
* @return this
* @author ricky barrette
*/
- public Report generateReport(final String msg, final String stackTrace, final String cause, final String date, final String device, final String appVersion, final String app, final String tracker, final String packageName){
+ public Report generateReport(final String msg, final String stackTrace, final String cause, final String date, final String device, final String appVersion,
+ final String app, final String tracker, final String packageName) {
mReport = new ArrayList();
- mReport.add(new ReportItem("app",app));
- mReport.add(new ReportItem("version",appVersion));
- mReport.add(new ReportItem("date",date));
- mReport.add(new ReportItem("msg",msg));
- mReport.add(new ReportItem("stackTrace",stackTrace));
- mReport.add(new ReportItem("cause",cause));
- mReport.add(new ReportItem("device",device));
- mReport.add(new ReportItem("tracker",tracker));
- mReport.add(new ReportItem("package",packageName));
+ mReport.add(new ReportItem("app", app));
+ mReport.add(new ReportItem("version", appVersion));
+ mReport.add(new ReportItem("date", date));
+ mReport.add(new ReportItem("msg", msg));
+ mReport.add(new ReportItem("stackTrace", stackTrace));
+ mReport.add(new ReportItem("cause", cause));
+ mReport.add(new ReportItem("device", device));
+ mReport.add(new ReportItem("tracker", tracker));
+ mReport.add(new ReportItem("package", packageName));
return this;
}
/**
* Extracts the name value pairs from the report bundle
+ *
* @return
* @author ricky barrette
*/
private ArrayList getNameValuePairs() {
final ArrayList list = new ArrayList();
- for(final ReportItem entry : mReport)
+ for (final ReportItem entry : mReport)
list.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
return list;
}
@@ -160,12 +169,13 @@ public class Report implements Parcelable{
* @return the generated exception report
* @author ricky barrette
*/
- public ArrayList getReport(){
+ public ArrayList getReport() {
return getNameValuePairs();
}
/**
* Sets the optional users description of what happened
+ *
* @param string
* @author ricky barrette
*/
@@ -179,11 +189,11 @@ public class Report implements Parcelable{
* @author ricky barrette
*/
@Override
- public String toString(){
+ public String toString() {
final StringBuilder s = new StringBuilder();
- for(final ReportItem item : mReport){
- s.append("\n\n-----"+ item.getKey()+"-----");
- s.append("\n"+item.getValue());
+ for (final ReportItem item : mReport) {
+ s.append("\n\n-----" + item.getKey() + "-----");
+ s.append("\n" + item.getValue());
}
return s.toString();
}
diff --git a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportAdapter.java b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportAdapter.java
index 3b47083..ce545f9 100644
--- a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportAdapter.java
+++ b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportAdapter.java
@@ -18,7 +18,9 @@ import android.widget.BaseAdapter;
import android.widget.TextView;
/**
- * This class will be used to populate a custom Listview used to display the Generated exception report
+ * This class will be used to populate a custom Listview used to display the
+ * Generated exception report
+ *
* @author ricky barrette
*/
public class ReportAdapter extends BaseAdapter {
@@ -27,12 +29,14 @@ public class ReportAdapter extends BaseAdapter {
TextView title;
TextView body;
}
+
private final ArrayList mReport;
private final LayoutInflater mInflater;
/**
* Creates a new ReportAdapter
+ *
* @author ricky barrette
*/
public ReportAdapter(final Context context, final ArrayList report) {
@@ -44,6 +48,7 @@ public class ReportAdapter extends BaseAdapter {
/**
* (non-Javadoc)
+ *
* @see android.widget.Adapter#getCount()
* @author ricky barrette
*/
@@ -54,6 +59,7 @@ public class ReportAdapter extends BaseAdapter {
/**
* (non-Javadoc)
+ *
* @see android.widget.Adapter#getItem(int)
* @author ricky barrette
*/
@@ -64,6 +70,7 @@ public class ReportAdapter extends BaseAdapter {
/**
* (non-Javadoc)
+ *
* @see android.widget.Adapter#getItemId(int)
* @author ricky barrette
*/
@@ -78,16 +85,20 @@ public class ReportAdapter extends BaseAdapter {
@Override
public View getView(final int position, View convertView, final ViewGroup parent) {
- // A ViewHolder keeps references to children views to avoid unnecessary calls to findViewById() on each row.
+ // A ViewHolder keeps references to children views to avoid unnecessary
+ // calls to findViewById() on each row.
ViewHolder holder;
- // When convertView is not null, we can reuse it directly, there is no need
- // to reinflate it. We only inflate a new View when the convertView supplied
+ // When convertView is not null, we can reuse it directly, there is no
+ // need
+ // to reinflate it. We only inflate a new View when the convertView
+ // supplied
// by ListView is null.
if (convertView == null) {
convertView = mInflater.inflate(R.layout.exception_list_item, null);
- // Creates a ViewHolder and store references to the two children views
+ // Creates a ViewHolder and store references to the two children
+ // views
// we want to bind data to.
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(R.id.exception_title);
diff --git a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportItem.java b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportItem.java
index f1d573b..8928d09 100644
--- a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportItem.java
+++ b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportItem.java
@@ -10,8 +10,10 @@ import android.os.Parcel;
import android.os.Parcelable;
/**
- * This class will represent an individual report item. The ReportItems will be used in an array list that will be passed via intent.
- * This will allow for our report items to stay in the proper order.
+ * This class will represent an individual report item. The ReportItems will be
+ * used in an array list that will be passed via intent. This will allow for our
+ * report items to stay in the proper order.
+ *
* @author ricky
*/
public final class ReportItem implements Parcelable {
@@ -33,15 +35,17 @@ public final class ReportItem implements Parcelable {
/**
* Creates a new ReportItem from a parcel
+ *
* @param in
*/
- public ReportItem(final Parcel in){
+ public ReportItem(final Parcel in) {
mKey = in.readString();
mValue = in.readString();
}
/**
* Creates a new ReportItem
+ *
* @author ricky barrette
*/
public ReportItem(final String key, final String value) {
@@ -49,7 +53,9 @@ public final class ReportItem implements Parcelable {
mValue = value;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see android.os.Parcelable#describeContents()
*/
@Override
@@ -72,7 +78,9 @@ public final class ReportItem implements Parcelable {
return mValue;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
*/
@Override
diff --git a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportPostingService.java b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportPostingService.java
index 7aec820..67b14ae 100644
--- a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportPostingService.java
+++ b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/ReportPostingService.java
@@ -21,8 +21,9 @@ import android.util.Log;
import anroid.v4.compat.NotificationCompat;
/**
- * This service will allow the exception handler to post reports in the backgound,
- * allowing the user to do what ever they want
+ * This service will allow the exception handler to post reports in the
+ * backgound, allowing the user to do what ever they want
+ *
* @author ricky barrette
*/
public class ReportPostingService extends Service {
@@ -38,6 +39,7 @@ public class ReportPostingService extends Service {
/**
* Fires of a notification based upon api level
+ *
* @param title
* @param contentText
* @param ticker
@@ -48,21 +50,17 @@ public class ReportPostingService extends Service {
*/
private void fireNotification(final String title, final String contentText, final String ticker, final int icon, final Intent intent, final boolean isOngoing) {
PendingIntent pendingIntent = null;
- if(intent != null)
+ if (intent != null)
pendingIntent = PendingIntent.getService(getApplicationContext(), 0, intent, 0);
- final NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext())
- .setContentTitle(title)
- .setContentText(contentText)
- .setTicker(ticker)
- .setSmallIcon(icon)
- .setWhen(System.currentTimeMillis());
-
- if(isOngoing)
+ final NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext()).setContentTitle(title).setContentText(contentText)
+ .setTicker(ticker).setSmallIcon(icon).setWhen(System.currentTimeMillis());
+
+ if (isOngoing)
builder.setOngoing(true);
else
builder.setAutoCancel(true);
-
+
if (intent != null)
builder.setContentIntent(pendingIntent);
mNotificationManager.notify(NOTIFICATION_ID, builder.getNotification());
@@ -70,6 +68,7 @@ public class ReportPostingService extends Service {
/**
* Extracts the report object from the intent
+ *
* @param intent
* @author ricky barrette
*/
@@ -79,32 +78,26 @@ public class ReportPostingService extends Service {
/**
* notifiys the user that we are sending a report
+ *
* @author ricky barrette
*/
private void notifyError() {
- fireNotification(getString(R.string.reporting_error),
- getString(R.string.reporting_error_msg),
- getString(R.string.reporting_error_msg),
- android.R.drawable.stat_notify_error,
- new Intent(getApplicationContext(), ReportPostingService.class).putExtras(mIntent),
- false);
+ fireNotification(getString(R.string.reporting_error), getString(R.string.reporting_error_msg), getString(R.string.reporting_error_msg),
+ android.R.drawable.stat_notify_error, new Intent(getApplicationContext(), ReportPostingService.class).putExtras(mIntent), false);
}
/**
* notifiys the user that we are sending a report
+ *
* @author ricky barrette
*/
private void notifySending() {
- fireNotification(getString(R.string.sending),
- getString(R.string.sending_report),
- getString(R.string.sending),
- android.R.drawable.stat_sys_upload,
- null,
- true);
+ fireNotification(getString(R.string.sending), getString(R.string.sending_report), getString(R.string.sending), android.R.drawable.stat_sys_upload, null, true);
}
/**
* (non-Javadoc)
+ *
* @see android.app.Service#onBind(android.content.Intent)
*/
@Override
@@ -114,10 +107,9 @@ public class ReportPostingService extends Service {
}
/**
- * Called when the service is being created
- * Here we want to display a notifcation,
- * to inform the user what we are doing.
- * (non-Javadoc)
+ * Called when the service is being created Here we want to display a
+ * notifcation, to inform the user what we are doing. (non-Javadoc)
+ *
* @see android.app.Service#onCreate()
*/
@Override
@@ -128,10 +120,11 @@ public class ReportPostingService extends Service {
notifySending();
super.onCreate();
}
+
/**
- * Called when the service is being destroyed
- * Here we want to dismiss the notifications
- * (non-Javadoc)
+ * Called when the service is being destroyed Here we want to dismiss the
+ * notifications (non-Javadoc)
+ *
* @see android.app.Service#onDestroy()
*/
@Override
@@ -144,6 +137,7 @@ public class ReportPostingService extends Service {
/**
* (non-Javadoc)
+ *
* @see android.app.Service#onStart(android.content.Intent, int)
*/
@SuppressWarnings("deprecation")
@@ -158,6 +152,7 @@ public class ReportPostingService extends Service {
/**
* (non-Javadoc)
+ *
* @see android.app.Service#onStartCommand(android.content.Intent, int, int)
*/
@TargetApi(5)
@@ -172,14 +167,15 @@ public class ReportPostingService extends Service {
/**
* Posts a copy of the report to the report handing server
+ *
* @author ricky barrette
*/
- private void postReport(){
- if(!isStarted){
+ private void postReport() {
+ if (!isStarted) {
isStarted = true;
- new Thread(new Runnable(){
+ new Thread(new Runnable() {
@Override
- public void run(){
+ public void run() {
try {
Log.d(TAG, mReport.file());
} catch (final ClientProtocolException e) {
diff --git a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/VersionInformationPreference.java b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/VersionInformationPreference.java
index 14bfb1e..696e84d 100644
--- a/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/VersionInformationPreference.java
+++ b/ExceptionHandlerLib/src/com/TwentyCodes/android/exception/VersionInformationPreference.java
@@ -20,7 +20,9 @@ import android.widget.LinearLayout;
import android.widget.TextView;
/**
- * this class will be a simple preference that contains only a text view that will display the application build information
+ * this class will be a simple preference that contains only a text view that
+ * will display the application build information
+ *
* @author ricky barrette
*/
public class VersionInformationPreference extends Preference {
@@ -29,6 +31,7 @@ public class VersionInformationPreference extends Preference {
/**
* creates a preference that is nothing but a text view
+ *
* @param context
*/
public VersionInformationPreference(final Context context) {
@@ -38,6 +41,7 @@ public class VersionInformationPreference extends Preference {
/**
* creates a preference that is nothing but a text view
+ *
* @param context
* @param attrs
*/
@@ -48,6 +52,7 @@ public class VersionInformationPreference extends Preference {
/**
* creates a preference that is nothing but a text view
+ *
* @param context
* @param attrs
* @param defStyle
@@ -57,17 +62,16 @@ public class VersionInformationPreference extends Preference {
mContext = context;
}
-
/**
- * creates a linear layout the contains only a textview.
- * (non-Javadoc)
+ * creates a linear layout the contains only a textview. (non-Javadoc)
+ *
* @see android.preference.Preference#onCreateView(android.view.ViewGroup)
* @param parent
* @return
* @author ricky barrette
*/
@Override
- protected View onCreateView(final ViewGroup parent){
+ protected View onCreateView(final ViewGroup parent) {
/*
* get the build information, and build the string
@@ -77,29 +81,30 @@ public class VersionInformationPreference extends Preference {
try {
pi = pm.getPackageInfo(mContext.getPackageName(), 0);
} catch (final NameNotFoundException eNnf) {
- //doubt this will ever run since we want info about our own package
+ // doubt this will ever run since we want info about our own package
pi = new PackageInfo();
pi.versionName = "unknown";
pi.versionCode = 1;
}
/*
- * create a vertical linear layout that width and height that wraps content
+ * create a vertical linear layout that width and height that wraps
+ * content
*/
final LinearLayout layout = new LinearLayout(getContext());
final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
- // params.gravity = Gravity.CENTER;
+ // params.gravity = Gravity.CENTER;
layout.setPadding(15, 5, 10, 5);
layout.setOrientation(LinearLayout.VERTICAL);
layout.removeAllViews();
/*
- * create a textview that will be used to display the application's name and build information
- * and add it to the layout
+ * create a textview that will be used to display the application's name
+ * and build information and add it to the layout
*/
final TextView title = new TextView(getContext());
- title.setText(mContext.getString(R.string.version)+" "+pi.versionName+" bulid "+pi.versionCode);
+ title.setText(mContext.getString(R.string.version) + " " + pi.versionName + " bulid " + pi.versionCode);
title.setTextSize(16);
title.setTypeface(Typeface.SANS_SERIF);
title.setGravity(Gravity.LEFT);