1
0
mirror of https://github.com/moparisthebest/SSLDroid synced 2024-11-23 09:22:16 -05:00

Polished log view a bit more

Signed-off-by: Balint Kovacs <blint@blint.hu>
This commit is contained in:
Balint Kovacs 2011-05-03 18:11:07 +02:00
parent 3a03aa7eed
commit 2e55c4e2c3
3 changed files with 9 additions and 15 deletions

View File

@ -8,4 +8,4 @@
# project structure. # project structure.
# Project target. # Project target.
target=android-8 target=android-7

View File

@ -1,11 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <ScrollView android:id="@+id/scrollView1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:android="http://schemas.android.com/apk/res/android" <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="none" android:editable="false" android:id="@+id/logTextView" android:text="@string/reading_logs"/>
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:isScrollContainer="true">
<ScrollView android:id="@+id/scrollView1" android:layout_height="match_parent" android:layout_width="wrap_content">
<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/logTextView" android:text="@string/reading_logs"></TextView>
</LinearLayout>
</ScrollView> </ScrollView>
</LinearLayout>

View File

@ -16,26 +16,27 @@ public class SSLDroidReadLogs extends Activity{
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.read_logs); setContentView(R.layout.read_logs);
TextView logcontainer = (TextView) findViewById(R.id.logTextView); TextView logcontainer = (TextView) findViewById(R.id.logTextView);
logcontainer.setText("");
Process mLogcatProc = null; Process mLogcatProc = null;
BufferedReader reader = null; BufferedReader reader = null;
try try
{ {
mLogcatProc = Runtime.getRuntime().exec(new String[] mLogcatProc = Runtime.getRuntime().exec(new String[]
{"logcat", "-d", "SSLDroid:D SSLDroidGui:D *:S" }); {"logcat", "-d", "-v", "time", "-b", "main", "SSLDroid:D SSLDroidGui:D *:S" });
reader = new BufferedReader(new InputStreamReader(mLogcatProc.getInputStream())); reader = new BufferedReader(new InputStreamReader(mLogcatProc.getInputStream()));
String line; String line;
final StringBuilder log = new StringBuilder(); //final StringBuilder log = new StringBuilder();
String separator = System.getProperty("line.separator"); String separator = System.getProperty("line.separator");
while ((line = reader.readLine()) != null) while ((line = reader.readLine()) != null)
{ {
log.append(line); logcontainer.append(line);
log.append(separator); logcontainer.append(separator);
} }
logcontainer.setText(log); //logcontainer.setText(log);
} }
catch (IOException e) catch (IOException e)