mirror of
https://github.com/moparisthebest/SSLDroid
synced 2024-11-14 21:15:09 -05:00
Added share logs functionality
Signed-off-by: Balint Kovacs <blint@blint.hu>
This commit is contained in:
parent
74d7c4c6a4
commit
1c7977a78d
@ -23,4 +23,5 @@
|
|||||||
<string name="provision">Please enter the URL for remote XML configuration</string>
|
<string name="provision">Please enter the URL for remote XML configuration</string>
|
||||||
<string name="back">Back</string>
|
<string name="back">Back</string>
|
||||||
<string name="refresh">Refresh</string>
|
<string name="refresh">Refresh</string>
|
||||||
|
<string name="share">Share logs</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -5,6 +5,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -17,12 +18,19 @@ public class SSLDroidReadLogs extends Activity {
|
|||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
MenuItem refresh = menu.add(R.string.refresh);
|
MenuItem refresh = menu.add(R.string.refresh);
|
||||||
refresh.setIcon(android.R.drawable.ic_menu_rotate);
|
refresh.setIcon(android.R.drawable.ic_menu_rotate);
|
||||||
|
MenuItem share = menu.add(R.string.share);
|
||||||
|
share.setIcon(android.R.drawable.ic_menu_share);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
if (item.getTitle() == getResources().getString(R.string.refresh))
|
||||||
refreshLogs();
|
refreshLogs();
|
||||||
|
else if ((item.getTitle() == getResources().getString(R.string.share)))
|
||||||
|
shareLogs();
|
||||||
|
else
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +48,7 @@ public class SSLDroidReadLogs extends Activity {
|
|||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
try {
|
try {
|
||||||
mLogcatProc = Runtime.getRuntime().exec(new String[]
|
mLogcatProc = Runtime.getRuntime().exec(new String[]
|
||||||
{"logcat", "-d", "-v", "time", "-b", "main", "SSLDroid:D SSLDroidGui:D *:S" });
|
{"logcat", "-d", "-v", "time", "-b", "main", "SSLDroid:D SSLDroidGui:D AndroidRuntime *:S" });
|
||||||
|
|
||||||
reader = new BufferedReader(new InputStreamReader(mLogcatProc.getInputStream()));
|
reader = new BufferedReader(new InputStreamReader(mLogcatProc.getInputStream()));
|
||||||
|
|
||||||
@ -63,4 +71,15 @@ public class SSLDroidReadLogs extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void shareLogs() {
|
||||||
|
Intent sendIntent = new Intent();
|
||||||
|
TextView logcontainer = (TextView) findViewById(R.id.logTextView);
|
||||||
|
CharSequence logdata = logcontainer.getText();
|
||||||
|
|
||||||
|
sendIntent.setAction(Intent.ACTION_SEND);
|
||||||
|
sendIntent.putExtra(Intent.EXTRA_TEXT, logdata);
|
||||||
|
sendIntent.setType("text/plain");
|
||||||
|
startActivity(sendIntent);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user