limit log length for diag share

This commit is contained in:
Nathan Freitas 2014-04-17 13:39:49 -04:00
parent edd3195ec8
commit b870dd3c7d
1 changed files with 12 additions and 1 deletions

View File

@ -33,6 +33,7 @@ public class OrbotDiagnosticsActivity extends Activity {
private TextView mTextView = null;
private final static String TAG = "OrbotDiag";
private StringBuffer log = new StringBuffer();
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -310,6 +311,7 @@ public class OrbotDiagnosticsActivity extends Activity {
{
Log.d(TAG, msg);
mTextView.append(msg + '\n');
log.append(msg + '\n');
}
@ -339,9 +341,18 @@ public class OrbotDiagnosticsActivity extends Activity {
private void sendLog ()
{
int maxLength = 5000;
String logShare = null;
if (log.length() > maxLength)
logShare = log.substring(0, maxLength);
else
logShare = log.toString();
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, mTextView.getText().toString());
sendIntent.putExtra(Intent.EXTRA_TEXT, logShare);
sendIntent.setType("text/plain");
startActivity(sendIntent);
}