2 * ownCloud Android client application
4 * Copyright (C) 2015 ownCloud Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 package com
.owncloud
.android
.ui
.activity
;
22 import android
.content
.Intent
;
23 import android
.os
.AsyncTask
;
24 import android
.os
.Bundle
;
25 import android
.support
.v4
.app
.Fragment
;
26 import android
.support
.v4
.app
.FragmentManager
;
27 import android
.support
.v4
.app
.FragmentTransaction
;
28 import android
.support
.v7
.app
.AppCompatActivity
;
29 import android
.view
.MenuItem
;
30 import android
.view
.View
;
31 import android
.view
.View
.OnClickListener
;
32 import android
.widget
.Button
;
33 import android
.widget
.TextView
;
35 import com
.owncloud
.android
.R
;
36 import com
.owncloud
.android
.lib
.common
.utils
.Log_OC
;
37 import com
.owncloud
.android
.ui
.dialog
.LoadingDialog
;
38 import com
.owncloud
.android
.utils
.FileStorageUtils
;
40 import java
.io
.BufferedReader
;
42 import java
.io
.FileReader
;
43 import java
.io
.IOException
;
44 import java
.lang
.ref
.WeakReference
;
47 public class ErrorReportActivity
extends AppCompatActivity
{
49 private static final String TAG
= ErrorReportActivity
.class.getSimpleName();
51 private String mLogText
;
54 protected void onCreate(Bundle savedInstanceState
) {
55 super.onCreate(savedInstanceState
);
57 setContentView(R
.layout
.error_send
);
58 setTitle(getString(R
.string
.error_log_title
));
59 Button cancelErrorLogButton
= (Button
) findViewById(R
.id
.cancelErrorLogButton
);
60 Button sendErrorLogButton
= (Button
) findViewById(R
.id
.sendErrorLogButton
);
61 TextView logTV
= (TextView
) findViewById(R
.id
.logTV
);
63 Intent intent
= getIntent();
64 String action
= intent
.getAction();
65 String type
= intent
.getType();
67 if (Intent
.ACTION_SEND
.equals(action
) && type
!= null
) {
68 mLogText
= intent
.getStringExtra(Intent
.EXTRA_TEXT
);
70 // Handle other intents, such as being started from the home screen
71 mLogText
= "Error, nothing received!";
74 logTV
.setText(mLogText
);
76 // TODO add Cancel Button
77 cancelErrorLogButton
.setOnClickListener(new OnClickListener() {
79 public void onClick(View v
) {
85 sendErrorLogButton
.setOnClickListener(new OnClickListener() {
88 public void onClick(View v
) {
95 * Start activity for sending email with logs attached
97 private void sendMail() {
98 Intent sendIntent
= new Intent();
99 sendIntent
.setAction(Intent
.ACTION_SEND
);
100 sendIntent
.putExtra(Intent
.EXTRA_TEXT
, mLogText
);
101 sendIntent
.setFlags(Intent
.FLAG_ACTIVITY_NEW_TASK
);
102 sendIntent
.setType("text/plain");
103 startActivity(sendIntent
);