aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/nullwire/trace/ExceptionClickListener.java
blob: 525b755cba5f1efe111ea19075235fe96097c278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 *
 */
package com.nullwire.trace;

import java.lang.ref.WeakReference;

import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.util.Log;

/**
 * @author Kenny Root
 *
 */
public class ExceptionClickListener implements OnClickListener {
	public static String TAG = "com.nullwire.trace.ExceptionClickListener";

	WeakReference<Context> context;

	public ExceptionClickListener() { }

	public void onClick(DialogInterface dialog, int whichButton) {
		switch (whichButton) {
		case DialogInterface.BUTTON_POSITIVE:
			dialog.dismiss();
			Log.d(TAG, "Trying to submit stack traces");
			new Thread(new Runnable() {
				public void run() {
					ExceptionHandler.submitStackTraces();
				}
			}).start();
			break;
		case DialogInterface.BUTTON_NEGATIVE:
			dialog.dismiss();
			Log.d(TAG, "Deleting old stack traces.");
			new Thread(new Runnable() {
				public void run() {
					ExceptionHandler.removeStackTraces();
				}
			}).start();
			break;
		default:
			Log.d("ExceptionClickListener", "Got unknown button click: " + whichButton);
			dialog.cancel();
		}
	}
}