[or-cvs] r22852: {projects} added proxy settings help screen and fixed processSettings() (in projects/android/trunk/Orbot: . res/layout res/values src/org/torproject/android)

Nathan Freitas nathan at freitas.net
Tue Aug 10 16:43:32 UTC 2010


Author: n8fr8
Date: 2010-08-10 16:43:32 +0000 (Tue, 10 Aug 2010)
New Revision: 22852

Modified:
   projects/android/trunk/Orbot/AndroidManifest.xml
   projects/android/trunk/Orbot/CHANGELOG
   projects/android/trunk/Orbot/default.properties
   projects/android/trunk/Orbot/res/layout/layout_wizard_tips.xml
   projects/android/trunk/Orbot/res/values/strings.xml
   projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java
   projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java
Log:
added proxy settings help screen and fixed processSettings() NPE

Modified: projects/android/trunk/Orbot/AndroidManifest.xml
===================================================================
--- projects/android/trunk/Orbot/AndroidManifest.xml	2010-08-10 15:19:30 UTC (rev 22851)
+++ projects/android/trunk/Orbot/AndroidManifest.xml	2010-08-10 16:43:32 UTC (rev 22852)
@@ -47,6 +47,4 @@
 
 
 
-
-
 </manifest> 

Modified: projects/android/trunk/Orbot/CHANGELOG
===================================================================
--- projects/android/trunk/Orbot/CHANGELOG	2010-08-10 15:19:30 UTC (rev 22851)
+++ projects/android/trunk/Orbot/CHANGELOG	2010-08-10 16:43:32 UTC (rev 22852)
@@ -1,8 +1,12 @@
 NOTE: Specific #s below correspond to Trac tickets logged and maintained at https://trac.torproject.org/projects/tor/
 
+1.0.0 - 2010-08-10
+- Added "Proxy Settings" help screen
+- Handle potential null pointers on process settings where service not yet active 
+
 0.0.9x - 2010-08-03
 - Revised Orbot install wizard
-- Integrated Tor 0.2.2.14 binary
+- Integrated Tor 0.2.2.14 and iptables 4.x binary
 - Fixed "got root" detection method 
 - Fixed Per App Torification handling so it updates on exit from Settings screen
 

Modified: projects/android/trunk/Orbot/default.properties
===================================================================
--- projects/android/trunk/Orbot/default.properties	2010-08-10 15:19:30 UTC (rev 22851)
+++ projects/android/trunk/Orbot/default.properties	2010-08-10 16:43:32 UTC (rev 22852)
@@ -10,5 +10,5 @@
 # Indicates whether an apk should be generated for each density.
 split.density=false
 # Project target.
-target=Google Inc.:Google APIs:3
+target=android-3
 apk-configurations=

Modified: projects/android/trunk/Orbot/res/layout/layout_wizard_tips.xml
===================================================================
--- projects/android/trunk/Orbot/res/layout/layout_wizard_tips.xml	2010-08-10 15:19:30 UTC (rev 22851)
+++ projects/android/trunk/Orbot/res/layout/layout_wizard_tips.xml	2010-08-10 16:43:32 UTC (rev 22852)
@@ -21,7 +21,7 @@
 
 <Button android:text="@string/wizard_tips_orweb"  android:drawableLeft="@drawable/icon_orweb" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOrweb" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
 
-<Button android:text="@string/wizard_tips_proxy" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOrweb" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+<Button android:text="@string/wizard_tips_proxy" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonProxyHelp" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
 
 			</LinearLayout>
 		</ScrollView>			

Modified: projects/android/trunk/Orbot/res/values/strings.xml
===================================================================
--- projects/android/trunk/Orbot/res/values/strings.xml	2010-08-10 15:19:30 UTC (rev 22851)
+++ projects/android/trunk/Orbot/res/values/strings.xml	2010-08-10 16:43:32 UTC (rev 22852)
@@ -96,7 +96,15 @@
     <string name="wizard_tips_msg">We encourage you to download &amp; use apps that know how to connect directly to Orbot. Click on the buttons below to install.</string>
     <string name="wizard_tips_otrchat">OTRCHAT - Secure instant messaging client for Android</string>
     <string name="wizard_tips_orweb">ORWEB (Android 1.x Only) - Browser designed for privacy &amp; for Orbot</string>
-    <string name="wizard_tips_proxy">Proxy Help - Learn how to configure apps to work with Orbot</string>
+    <string name="wizard_tips_proxy">Proxy Settings - Learn how to configure apps to work with Orbot</string>
+    
+    <string name="wizard_proxy_help_info">Proxy Settings</string>
+    <string name="wizard_proxy_help_msg">If the Android app you are using can support the use of an HTTP or SOCKS proxy, then you can configure it to connect to Orbot and use Tor.\n\n
+    The host settings is 127.0.0.1 or "localhost". For HTTP, the port setting is 8118. For SOCKS, the proxy is 9050. You should use SOCKS4A or SOCKS5 if possible.
+    \n\n
+    You can learn more about proxying on Android via the FAQ at: http://tinyurl.com/proxyandroid
+    </string>
+    
     <string name="wizard_final">Orbot is ready!</string>
     <string name="wizard_final_msg">Hundreds of thousands of people around the world use Tor for a wide variety of reasons: journalists and bloggers, human rights workers, law enforcement officers, soldiers, corporations, citizens of repressive regimes, and just ordinary citizens... and now you are ready to, as well!</string>
     

Modified: projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java	2010-08-10 15:19:30 UTC (rev 22851)
+++ projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java	2010-08-10 16:43:32 UTC (rev 22852)
@@ -32,6 +32,7 @@
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
+import android.view.MotionEvent;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.animation.Animation;
@@ -398,100 +399,114 @@
 	private void processSettings () throws RemoteException
 	{
 		
-	
-		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
-		
-		boolean useBridges = prefs.getBoolean(PREF_BRIDGES_ENABLED, false);
-		
-		boolean autoUpdateBridges = prefs.getBoolean(PREF_BRIDGES_UPDATED, false);
-
-        boolean becomeRelay = prefs.getBoolean(PREF_OR, false);
-
-        boolean ReachableAddresses = prefs.getBoolean(PREF_REACHABLE_ADDRESSES,false);
-
-		boolean enableTransparentProxy = prefs.getBoolean(PREF_TRANSPARENT, false);
-		
-		mService.updateTransProxy();
-		
-		String bridgeList = prefs.getString(PREF_BRIDGES_LIST,"");
-
-		if (useBridges)
+		try
 		{
-			if (bridgeList == null || bridgeList.length() == 0)
-			{
+			if (mService == null)
+				return; //nothing to do if the service isn't connected yet
 			
-				showAlert("Bridge Error","In order to use the bridge feature, you must enter at least one bridge IP address." +
-						"Send an email to bridges at torproject.org with the line \"get bridges\" by itself in the body of the mail from a gmail account.");
-				
+			SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
 			
-				return;
-			}
+			boolean useBridges = prefs.getBoolean(PREF_BRIDGES_ENABLED, false);
 			
+			//boolean autoUpdateBridges = prefs.getBoolean(PREF_BRIDGES_UPDATED, false);
+	
+	        boolean becomeRelay = prefs.getBoolean(PREF_OR, false);
+	
+	        boolean ReachableAddresses = prefs.getBoolean(PREF_REACHABLE_ADDRESSES,false);
+	
+			boolean enableTransparentProxy = prefs.getBoolean(PREF_TRANSPARENT, false);
 			
-			mService.updateConfiguration("UseBridges", "1", false);
-				
-			String bridgeDelim = "\n";
+			mService.updateTransProxy();
 			
-			if (bridgeList.indexOf(",") != -1)
+			String bridgeList = prefs.getString(PREF_BRIDGES_LIST,"");
+	
+			if (useBridges)
 			{
-				bridgeDelim = ",";
+				if (bridgeList == null || bridgeList.length() == 0)
+				{
+				
+					showAlert("Bridge Error","In order to use the bridge feature, you must enter at least one bridge IP address." +
+							"Send an email to bridges at torproject.org with the line \"get bridges\" by itself in the body of the mail from a gmail account.");
+					
+				
+					return;
+				}
+				
+				
+				mService.updateConfiguration("UseBridges", "1", false);
+					
+				String bridgeDelim = "\n";
+				
+				if (bridgeList.indexOf(",") != -1)
+				{
+					bridgeDelim = ",";
+				}
+				
+				StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim);
+				while (st.hasMoreTokens())
+				{
+	
+					mService.updateConfiguration("bridge", st.nextToken(), false);
+	
+				}
+				
+				mService.updateConfiguration("UpdateBridgesFromAuthority", "0", false);
+				
 			}
-			
-			StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim);
-			while (st.hasMoreTokens())
+			else
 			{
-
-				mService.updateConfiguration("bridge", st.nextToken(), false);
-
+				mService.updateConfiguration("UseBridges", "0", false);
+	
 			}
-			
-			mService.updateConfiguration("UpdateBridgesFromAuthority", "0", false);
-			
-		}
-		else
-		{
-			mService.updateConfiguration("UseBridges", "0", false);
-
-		}
-
-        try
-        {
-            if (ReachableAddresses)
-            {
-                String ReachableAddressesPorts =
-                    prefs.getString(PREF_REACHABLE_ADDRESSES_PORTS, "*:80,*:443");
-                
-    			mService.updateConfiguration("ReachableAddresses", ReachableAddressesPorts, false);
-
-            }
-        }
+	
+	        try
+	        {
+	            if (ReachableAddresses)
+	            {
+	                String ReachableAddressesPorts =
+	                    prefs.getString(PREF_REACHABLE_ADDRESSES_PORTS, "*:80,*:443");
+	                
+	    			mService.updateConfiguration("ReachableAddresses", ReachableAddressesPorts, false);
+	
+	            }
+	        }
+	        catch (Exception e)
+	        {
+	           showAlert("Config Error","Your ReachableAddresses settings caused an exception!");
+	        }
+	
+	        try
+	        {
+	            if (becomeRelay && (!useBridges) && (!ReachableAddresses))
+	            {
+	                int ORPort =  Integer.parseInt(prefs.getString(PREF_OR_PORT, "9001"));
+	                String nickname = prefs.getString(PREF_OR_NICKNAME, "Orbot");
+	
+	    			mService.updateConfiguration("ORPort", ORPort + "", false);
+	    			mService.updateConfiguration("Nickname", nickname, false);
+	    			mService.updateConfiguration("ExitPolicy", "reject *:*", false);
+	
+	            }
+	        }
+	        catch (Exception e)
+	        {
+	            showAlert("Uh-oh!","Your relay settings caused an exception!");
+	          
+	            return;
+	        }
+	
+	        if (mService != null)
+	        	mService.saveConfiguration();
+		 }
         catch (Exception e)
         {
-           showAlert("Config Error","Your ReachableAddresses settings caused an exception!");
-        }
-
-        try
-        {
-            if (becomeRelay && (!useBridges) && (!ReachableAddresses))
-            {
-                int ORPort =  Integer.parseInt(prefs.getString(PREF_OR_PORT, "9001"));
-                String nickname = prefs.getString(PREF_OR_NICKNAME, "Orbot");
-
-    			mService.updateConfiguration("ORPort", ORPort + "", false);
-    			mService.updateConfiguration("Nickname", nickname, false);
-    			mService.updateConfiguration("ExitPolicy", "reject *:*", false);
-
-            }
-        }
-        catch (Exception e)
-        {
-            showAlert("Uh-oh!","Your relay settings caused an exception!");
+            showAlert("Uh-oh!","There was an error updating your settings");
           
+            Log.w(TAG, "processSettings()", e);
+            
             return;
         }
 
-        mService.saveConfiguration();
-        
 	}
 	
 	
@@ -623,15 +638,47 @@
     	
     }
     
-    /*
+    
+    @Override
+	public boolean onTouchEvent(MotionEvent event) {
+    	try
+		{
+			
+			if (mService == null)
+			{
+			
+			}
+			else if (mService.getStatus() == STATUS_READY)
+			{
+				
+				startTor();
+				
+			}
+			else
+			{
+				
+				stopTor();
+				
+			}
+			
+		}
+		catch (Exception e)
+		{
+			Log.i(TAG,"error onclick",e);
+		}
+		
+		return super.onTouchEvent(event);
+	}
+
+	/*
      * (non-Javadoc)
      * @see android.view.View.OnClickListener#onClick(android.view.View)
      */
 	public void onClick(View view) {
 		
 		// the start button
-		if (view.getId()==R.id.imgStatus || view.getId()==R.id.lblStatus)
-		{
+	//	if (view.getId()==R.id.imgStatus || view.getId()==R.id.lblStatus)
+	//	{
 			try
 			{
 				
@@ -658,7 +705,7 @@
 				Log.i(TAG,"error onclick",e);
 			}
 			
-		}
+	//	}
 		
 		
 	}

Modified: projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java	2010-08-10 15:19:30 UTC (rev 22851)
+++ projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java	2010-08-10 16:43:32 UTC (rev 22852)
@@ -207,6 +207,18 @@
 			}
 		});
         
+        Button btn3 = (Button)view.findViewById(R.id.WizardRootButtonProxyHelp);
+        
+        btn3.setOnClickListener(new OnClickListener() {
+			
+			@Override
+			public void onClick(View view) {
+
+				showProxyHelp();
+
+			}
+		});
+        
 		showCustomDialog(title, view,context.getString(R.string.btn_next),context.getString(R.string.btn_back),new DialogInterface.OnClickListener() {
 			
 			
@@ -380,5 +392,17 @@
         .show();
 	}
 	
+	private void showProxyHelp ()
+	{
+		
+		LayoutInflater li = LayoutInflater.from(context);
+        View view = li.inflate(R.layout.layout_wizard_proxy_help, null); 
+       
+		new AlertDialog.Builder(context)
+        .setTitle(context.getString(R.string.wizard_proxy_help_info))
+        .setView(view)
+        .show();
+	}
+	
 }
 



More information about the tor-commits mailing list