1 /* ownCloud Android client application
2 * Copyright (C) 2012 Bartek Przybylski
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package eu
.alefzero
.owncloud
;
23 import android
.app
.AlertDialog
;
24 import android
.app
.Dialog
;
25 import android
.content
.DialogInterface
;
26 import android
.content
.DialogInterface
.OnCancelListener
;
27 import android
.content
.DialogInterface
.OnClickListener
;
28 import android
.os
.Bundle
;
29 import android
.util
.Log
;
31 import com
.actionbarsherlock
.app
.SherlockActivity
;
33 public class CrashlogSendActivity
extends SherlockActivity
implements OnClickListener
, OnCancelListener
{
35 private static final String TAG
= "CrashlogSendActivity";
36 private static final int DIALOG_SUBMIT
= 5;
38 private String mLogFilename
;
41 protected void onCreate(Bundle savedInstanceState
) {
42 super.onCreate(savedInstanceState
);
43 mLogFilename
= getIntent().getStringExtra(CrashHandler
.KEY_CRASH_FILENAME
);
44 if (mLogFilename
== null
) {
45 Log
.wtf(TAG
, "No file crashlog path given!");
49 Log
.i(TAG
, "crashlog file path " + mLogFilename
);
51 showDialog(DIALOG_SUBMIT
);
56 protected Dialog
onCreateDialog(int id
) {
57 if (id
== DIALOG_SUBMIT
) {
58 AlertDialog
.Builder builder
= new AlertDialog
.Builder(this);
59 builder
.setMessage(R
.string
.crashlog_message
);
60 builder
.setNegativeButton(R
.string
.crashlog_dont_send_report
, this);
61 builder
.setPositiveButton(R
.string
.crashlog_send_report
, this);
62 builder
.setCancelable(true
);
63 builder
.setOnCancelListener(this);
64 return builder
.create();
66 return super.onCreateDialog(id
);
71 public void onClick(DialogInterface dialog
, int which
) {
72 new File(mLogFilename
).delete();
78 public void onCancel(DialogInterface dialog
) {
79 new File(mLogFilename
).delete();