[tor-commits] [orbot/master] add back in log output temporarily in sidebar

n8fr8 at torproject.org n8fr8 at torproject.org
Fri Apr 3 17:04:05 UTC 2015


commit 5cb6cb930d5d5d859c9427300f4758e13d984882
Author: Nathan Freitas <nathan at freitas.net>
Date:   Wed Feb 4 12:36:24 2015 -0500

    add back in log output temporarily in sidebar
---
 res/layout/layout_main.xml                        |   55 +++++----------------
 src/org/torproject/android/OrbotMainActivity.java |   19 +++++--
 2 files changed, 26 insertions(+), 48 deletions(-)

diff --git a/res/layout/layout_main.xml b/res/layout/layout_main.xml
index ae04937..b060ce9 100644
--- a/res/layout/layout_main.xml
+++ b/res/layout/layout_main.xml
@@ -182,48 +182,17 @@
 	    </LinearLayout>
 	    </LinearLayout>
 	 <LinearLayout
-    android:layout_width="240dp"
+    android:layout_width="320dp"
     android:layout_height="match_parent"
     android:orientation="vertical"
     android:id="@+id/left_drawer"
-    android:layout_gravity="start"        
-    android:background="@color/panel_background"
+    android:layout_gravity="start"            
+    android:background="#333333"
      >
-    </LinearLayout>
-	
-	</android.support.v4.widget.DrawerLayout>
-	
-</LinearLayout>
-
-		<!-- 
-	 <SlidingDrawer
-        android:layout_width="fill_parent"
-        android:id="@+id/SlidingDrawer"
-        android:handle="@+id/slideButton"
-        android:content="@+id/trafficLog"
-        android:padding="10dip"
-        android:layout_height="fill_parent"
-        android:orientation="vertical"
-        		android:gravity="bottom"
-        >
-          <Button
-              android:id="@+id/slideButton"
-              android:layout_width="wrap_content"
-              android:layout_height="wrap_content"
-              android:text="@string/menu_log" ></Button>
-
-	<RelativeLayout android:id="@+id/trafficLog"
-		android:gravity="top"
-	    android:layout_width="fill_parent"
-	    android:visibility="invisible"
-	    android:layout_height="wrap_content"
-	    android:padding="6dp"
-	    android:layout_marginTop="6dp"
-	    android:background="#ee333333">
-	    
-		<TextView
+    	<TextView
 			android:id="@+id/orbotLog"
-			android:textColor="#FFFFFF"
+			android:textColor="#00FF00"
+			android:background="#333333"
 			android:textSize="12sp"
 			android:gravity="left"
 			android:layout_width="fill_parent"
@@ -231,12 +200,12 @@
 			android:layout_alignParentLeft="true"
 			android:layout_marginTop="10dp"
 			android:textIsSelectable="true"
-			android:fontFamily="sans-serif-light"
+			android:fontFamily="monospace"
 			 />
-    </RelativeLayout>		
-    </SlidingDrawer>
-       
-</FrameLayout>
-    -->
+    </LinearLayout>
+	
+	</android.support.v4.widget.DrawerLayout>
+	
+</LinearLayout>
 
 
diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java
index 591fb60..e10c89c 100644
--- a/src/org/torproject/android/OrbotMainActivity.java
+++ b/src/org/torproject/android/OrbotMainActivity.java
@@ -70,6 +70,8 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
     private TextView downloadText = null;
     private TextView uploadText = null;
   
+    private TextView mTxtOrbotLog = null;
+    
     private Button mBtnBrowser = null;
     private Button mBtnVPN = null;
 
@@ -211,6 +213,8 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
 
         setupMenu();
         
+        mTxtOrbotLog = (TextView)findViewById(R.id.orbotLog);
+        
         lblStatus = (TextView)findViewById(R.id.lblStatus);
         lblStatus.setOnLongClickListener(this);
         imgStatus = (ImageProgressView)findViewById(R.id.imgStatus);
@@ -889,10 +893,13 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
                             if (mItemOnOff != null)
                                     mItemOnOff.setTitle(R.string.menu_stop);
                             
+                            if (lblStatus != null && torServiceMsg != null)
+                            	if (torServiceMsg.indexOf('%')!=-1)
+                            		lblStatus.setText(torServiceMsg);
                         
                             if (torServiceMsg != null && torServiceMsg.length() > 0)
                             {
-                            //	appendLogTextAndScroll(torServiceMsg);
+                            	mTxtOrbotLog.append(torServiceMsg + '\n');
                             }
                             
                             boolean showFirstTime = mPrefs.getBoolean("connect_first_time",true);
@@ -930,9 +937,11 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
                         	if (torServiceMsg.indexOf('%')!=-1)
                         		lblStatus.setText(torServiceMsg);
                         	
-                        //appendLogTextAndScroll(torServiceMsg);
-                        
-                                    
+                        if (torServiceMsg != null && torServiceMsg.length() > 0)
+                        {
+                        	mTxtOrbotLog.append(torServiceMsg + '\n');
+                        }
+                    	           
                     }
                     else if (torStatus == TorServiceConstants.STATUS_OFF)
                     {
@@ -960,7 +969,7 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
 		startService (TorServiceConstants.CMD_START);
 		torStatus = TorServiceConstants.STATUS_CONNECTING;
 				
-//		mTxtOrbotLog.setText("");
+		mTxtOrbotLog.setText("");
 
         //here we update the UI which is a bit sloppy and mixed up code wise
         //might be best to just call updateStatus() instead of directly manipulating UI in this method - yep makes sense





More information about the tor-commits mailing list