[or-cvs] r22729: {projects} updated root perm cacheing issue and help wizard dialogs (in projects/android/trunk/Orbot: . res/layout res/values res/xml src/org/torproject/android)

Nathan Freitas nathan at freitas.net
Fri Jul 30 20:19:13 UTC 2010


Author: n8fr8
Date: 2010-07-30 20:19:13 +0000 (Fri, 30 Jul 2010)
New Revision: 22729

Modified:
   projects/android/trunk/Orbot/AndroidManifest.xml
   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/res/xml/preferences.xml
   projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java
   projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java
Log:
updated root perm cacheing issue and help wizard dialogs

Modified: projects/android/trunk/Orbot/AndroidManifest.xml
===================================================================
--- projects/android/trunk/Orbot/AndroidManifest.xml	2010-07-30 16:21:11 UTC (rev 22728)
+++ projects/android/trunk/Orbot/AndroidManifest.xml	2010-07-30 20:19:13 UTC (rev 22729)
@@ -4,9 +4,7 @@
       android:versionName="0.2.2.14-orbot-alpha-0.0.9" android:versionCode="8">
        
        <uses-permission android:name="android.permission.INTERNET" />
-        <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  
- 
     <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">
       
         <activity android:name=".Orbot"

Modified: projects/android/trunk/Orbot/default.properties
===================================================================
--- projects/android/trunk/Orbot/default.properties	2010-07-30 16:21:11 UTC (rev 22728)
+++ projects/android/trunk/Orbot/default.properties	2010-07-30 20:19:13 UTC (rev 22729)
@@ -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-07-30 16:21:11 UTC (rev 22728)
+++ projects/android/trunk/Orbot/res/layout/layout_wizard_tips.xml	2010-07-30 20:19:13 UTC (rev 22729)
@@ -15,12 +15,13 @@
 		    android:layout_height="fill_parent"
 		    android:padding="3px">
 		    
-<TextView android:text="@string/wizard_tips_msg" 	android:textColor="#ffffff" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+<TextView android:text="@string/wizard_tips_msg" android:layout_gravity="left"	android:textColor="#ffffff" android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
 
-<Button android:text="@string/wizard_tips_otrchat" android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOtrchat" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+<Button android:text="@string/wizard_tips_otrchat"  android:layout_gravity="left" android:drawableLeft="@drawable/icon_otrchat"  android:layout_marginTop="10px" android:id="@+id/WizardRootButtonInstallOtrchat" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
 
-<Button android:text="@string/wizard_tips_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_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"/>
 
 			</LinearLayout>
 		</ScrollView>			

Modified: projects/android/trunk/Orbot/res/values/strings.xml
===================================================================
--- projects/android/trunk/Orbot/res/values/strings.xml	2010-07-30 16:21:11 UTC (rev 22728)
+++ projects/android/trunk/Orbot/res/values/strings.xml	2010-07-30 20:19:13 UTC (rev 22729)
@@ -77,15 +77,15 @@
     <string name="wizard_welcome_msg">Orbot brings Tor to Android. Tor is free software and an open network that helps you defend against a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security known as traffic analysis.\n\n*WARNING:* Simply installing Orbot will _not_ magically anonymize your mobile traffic! This wizard will help you get started.</string>
     <string name="wizard_details">Some Orbot Details</string>
     <string name="wizard_details_msg">Orbot is an open-source application that contains Tor, LibEvent and Privoxy. It provides a local HTTP proxy (8118) and a SOCKS proxy (9050) into the Tor network. Orbot also has the ability, on rooted device, to send all internet traffic through Tor.</string>
-    <string name="wizard_permissions_root">Grant Permissions</string>
-    <string name="wizard_permissions_stock">Permissions Warning</string>
+    <string name="wizard_permissions_root">Permission Granted</string>
+    <string name="wizard_permissions_stock">Orbot Permissions</string>
     <string name="wizard_premissions_msg_root">Excellent! We\'ve detected that you have root permissions enabled for Orbot. We will use this power wisely.</string>
-    <string name="wizard_permissions_msg_stock">We\'ve detected that you do not have root permissions enabled. Your application data usage will NOT be transparently routed through Tor without root access. </string>
+    <string name="wizard_permissions_msg_stock"> While it is not required, Orbot can become a more powerful tool if your device has root access. Use the button below to grant Orbot superpowers! </string>
    
-    <string name="wizard_permissions_no_root">If you choose to continue WITHOUT root, you must use apps that know how to talk to Tor.</string>
+    <string name="wizard_permissions_no_root">If you don\'t have root access or have no idea what we\'re talking about, just be sure to use apps made to work with Orbot.</string>
     <string name="wizard_permissions_consent">I understand and would like to continue without root</string>
    
-    <string name="wizard_permission_enable_root">Attempt to enable root access</string>
+    <string name="wizard_permission_enable_root">Grant Root for Orbot</string>
     <string name="wizard_configure">Configure Torification</string>
     <string name="wizard_configure_msg">Orbot gives you the option to route all application traffic through Tor OR to choose your applications individually.</string> 
     <string name="wizard_configure_all">Proxy All Apps Through Tor</string>
@@ -94,9 +94,9 @@
     
     <string name="wizard_tips_tricks">Orbot-enabled Apps</string>
     <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 - From the Orbot dev team, a secure Instant Messaging client for Android.</string>
-    <string name="wizard_tips_orweb">OrWeb (Android 1.x Only) - From the Orbot dev team, a web browser designed to work with Tor.</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_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>
     
@@ -105,5 +105,6 @@
     
  <!-- END Welcome Wizard strings (DJH) -->
 
+	<string name="connect_first_time"> You\'ve successfully connected to the Tor network - but this does NOT mean your device is secure. You can use the \'Check\' option from the menu to test your browser. \n\nVisit us at https://guardianproject.info/apps/orbot or send an email to help at guardianproject.info to learn more.</string>
 
 </resources>

Modified: projects/android/trunk/Orbot/res/xml/preferences.xml
===================================================================
--- projects/android/trunk/Orbot/res/xml/preferences.xml	2010-07-30 16:21:11 UTC (rev 22728)
+++ projects/android/trunk/Orbot/res/xml/preferences.xml	2010-07-30 20:19:13 UTC (rev 22729)
@@ -27,6 +27,17 @@
 
 </PreferenceCategory>
 
+<!-- 
+<PreferenceCategory android:title="Web Proxy">
+<Preference
+android:defaultValue="" 
+android:key="pref_web_proxy"
+android:title="Open Proxy Panel"
+android:summary="Set HTTP Settings (Android 2.x Experimental)"
+android:enabled="true"/>
+</PreferenceCategory>
+ -->
+ 
 <PreferenceCategory android:title="Bridges">
 
 <CheckBoxPreference android:defaultValue="false" 

Modified: projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java	2010-07-30 16:21:11 UTC (rev 22728)
+++ projects/android/trunk/Orbot/src/org/torproject/android/Orbot.java	2010-07-30 20:19:13 UTC (rev 22729)
@@ -186,7 +186,9 @@
 			
 			unbindService();
 			
+            stopService(new Intent(ITorService.class.getName()));
 			
+			
 		} catch (RemoteException e) {
 			Log.w(TAG, e);
 		}
@@ -330,7 +332,7 @@
     	lblStatus = (TextView)findViewById(R.id.lblStatus);
     	imgStatus = (ImageView)findViewById(R.id.imgStatus);
     	
-    	updateStatus("");
+    	//updateStatus("");
     }
 	
 	/*
@@ -343,36 +345,6 @@
 	}
 	
 	
-	private static class ListEntry {
-		private CheckBox box;
-		private TextView text;
-	}
-	/*
-	 * Show the about view - a popup dialog
-	 */
-	private void showAbout ()
-	{
-		
-		LayoutInflater li = LayoutInflater.from(this);
-        View view = li.inflate(R.layout.layout_about, null); 
-        TextView versionName = (TextView)view.findViewById(R.id.versionName);
-        versionName.setText(R.string.app_version);    
-        
-		new AlertDialog.Builder(this)
-        .setTitle(getString(R.string.button_about))
-        .setView(view)
-        .setNeutralButton(getString(R.string.button_help), new DialogInterface.OnClickListener() {
-                public void onClick(DialogInterface dialog, int whichButton) {
-                      showHelp();
-                }
-        })
-        .setNegativeButton(getString(R.string.button_close), new DialogInterface.OnClickListener() {
-                public void onClick(DialogInterface dialog, int whichButton) {
-                    //    Log.d(TAG, "Close pressed");
-                }
-        })
-        .show();
-	}
 	
 	/*
 	 * Show the help view - a popup dialog
@@ -649,6 +621,7 @@
 	{
 		 
 		 new AlertDialog.Builder(this)
+		 .setIcon(R.drawable.icon)
          .setTitle(title)
          .setMessage(msg)
          .setPositiveButton(android.R.string.ok, null)
@@ -683,7 +656,22 @@
 		    		lblStatus.setText(getString(R.string.status_activated));
 		    		
 		    		
+		    		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mOrbot);
+
+		    		boolean showWizard = prefs.getBoolean("connect_first_time",true);
 		    		
+		    		if (showWizard)
+		    		{
+		    		
+		    			Editor pEdit = prefs.edit();
+		    			
+		    			pEdit.putBoolean("connect_first_time",false);
+		    			
+		    			pEdit.commit();
+		    			
+		    			showAlert(getString(R.string.status_activated),getString(R.string.connect_first_time));
+		    			
+		    		}
 	    		
 	    			/*
 		    		if (progressDialog != null)
@@ -792,7 +780,7 @@
 		Message msg = mHandler.obtainMessage(ENABLE_TOR_MSG);
     	mHandler.sendMessage(msg);
     	
-    	updateStatus("");
+    //	updateStatus("");
     }
     
     private void stopTor () throws RemoteException
@@ -802,7 +790,7 @@
 		Message msg = mHandler.obtainMessage(DISABLE_TOR_MSG);
     	mHandler.sendMessage(msg);
     	
-    	updateStatus("");
+    	//updateStatus("");
     	
     }
     
@@ -979,6 +967,9 @@
             if (mService != null) {
                 try {
                     mService.unregisterCallback(mCallback);
+                    
+                
+                    
                 } catch (RemoteException e) {
                     // There is nothing special we need to do if the service
                     // has crashed.
@@ -988,6 +979,7 @@
             // Detach our existing connection.
             unbindService(mConnection);
             mIsBound = false;
+            
         }
     }
 	

Modified: projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java	2010-07-30 16:21:11 UTC (rev 22728)
+++ projects/android/trunk/Orbot/src/org/torproject/android/WizardHelper.java	2010-07-30 20:19:13 UTC (rev 22729)
@@ -24,7 +24,7 @@
 public class WizardHelper implements TorConstants {
 
 	private Context context;
-	private Dialog currentDialog;
+	private AlertDialog currentDialog;
 	
 	public WizardHelper (Context context)
 	{
@@ -70,60 +70,73 @@
 	public void showWizardStep2()
 	{
 		
-		String title = null;
-		String msg = null;
+	
+		String title = context.getString(R.string.wizard_permissions_stock);
 		
-		
-			title = context.getString(R.string.wizard_permissions_root);
-			msg = context.getString(R.string.wizard_premissions_msg_root);
-		
+		LayoutInflater li = LayoutInflater.from(context);
+        View view = li.inflate(R.layout.layout_wizard_stock, null); 
+        
+        Button btn1 = (Button)view.findViewById(R.id.WizardRootButtonEnable);
+        
+        btn1.setOnClickListener(new OnClickListener() {
 			
-			title = context.getString(R.string.wizard_permissions_stock);
+			@Override
+			public void onClick(View view) {
+				
+				
+				boolean hasRoot = TorTransProxy.hasRootAccess();
+				
+				if (hasRoot)
+				{
+					currentDialog.dismiss();
+					showWizardStep2Root();
+				}
+				else
+				{
+					Toast.makeText(context, "Unable to get root access", Toast.LENGTH_LONG).show();
+					view.setEnabled(false);
+				}
+			}
+		});
+        
+        CheckBox cb1 = (CheckBox)view.findViewById(R.id.CheckBoxConsent);
+         
+        cb1.setOnCheckedChangeListener(new OnCheckedChangeListener (){
+
+			@Override
+			public void onCheckedChanged(CompoundButton buttonView,
+					boolean isChecked) {
 			
-			LayoutInflater li = LayoutInflater.from(context);
-	        View view = li.inflate(R.layout.layout_wizard_stock, null); 
-	        
-	        Button btn1 = (Button)view.findViewById(R.id.WizardRootButtonEnable);
-	        
-	        btn1.setOnClickListener(new OnClickListener() {
+				currentDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setEnabled(isChecked);
 				
-				@Override
-				public void onClick(View view) {
-					
-					
-					boolean hasRoot = TorTransProxy.hasRootAccess();
-					
-					if (hasRoot)
-					{
-						currentDialog.dismiss();
-						showWizardStep2Root();
-					}
-					else
-					{
-						Toast.makeText(context, "Unable to get root access", Toast.LENGTH_LONG).show();
-					}
+				
+				
+			}
+        	
+        });
+        
+ 
+		showCustomDialog(title, view,context.getString(R.string.btn_next),context.getString(R.string.btn_back),new DialogInterface.OnClickListener() {
+			
+			@Override
+			public void onClick(DialogInterface dialog, int which) {
+				dialog.dismiss();
+				
+				if (which == DialogInterface.BUTTON_NEUTRAL)
+				{
+					showWizardTipsAndTricks();
 				}
-			});
-	 
-			showCustomDialog(title, view,context.getString(R.string.btn_next),context.getString(R.string.btn_back),new DialogInterface.OnClickListener() {
+				else if (which == DialogInterface.BUTTON_POSITIVE)
+				{
+					showWizardStep1();
+				}
 				
-				@Override
-				public void onClick(DialogInterface dialog, int which) {
-					dialog.dismiss();
-					
-					if (which == DialogInterface.BUTTON_NEUTRAL)
-					{
-						showWizardTipsAndTricks();
-					}
-					else if (which == DialogInterface.BUTTON_POSITIVE)
-					{
-						showWizardStep1();
-					}
-					
-				}
-			});
-			
+			}
+		});
 		
+		currentDialog.getButton(AlertDialog.BUTTON_NEUTRAL).setEnabled(false);
+		
+		
 	}
 	
 	public void showWizardStep2Root()
@@ -315,7 +328,7 @@
 		
 	}
 	
-	private void showDialog (String title, String msg, String button1, String button2, DialogInterface.OnClickListener ocListener)
+	public void showDialog (String title, String msg, String button1, String button2, DialogInterface.OnClickListener ocListener)
 	{
 	 
 //		dialog.setContentView(R.layout.custom_dialog);



More information about the tor-commits mailing list