[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] TransProxy screen added



commit e7453b7f0be28c84c2f89da0ec321ad33c8a1719
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@xxxxxxxxx>
Date:   Wed Jun 8 00:32:59 2011 +0530

    TransProxy screen added
---
 AndroidManifest.xml                                |    1 +
 res/layout/layout_wizard_permissions.xml           |   19 +--
 res/layout/layout_wizard_root.xml                  |   53 ++++++--
 res/layout/layout_wizard_tips.xml                  |   19 +--
 res/values/strings.xml                             |    5 +-
 .../torproject/android/ConfigureTransProxy.java    |  150 ++++++++++++++++++++
 src/org/torproject/android/Permissions.java        |    2 +
 7 files changed, 207 insertions(+), 42 deletions(-)

diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ad48d9d..030bbff 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -32,6 +32,7 @@
       	<activity android:name=".LotsaText"/>
       	<activity android:name=".Permissions"/>
       	<activity android:name=".TipsAndTricks"/>
+      	<activity android:name=".ConfigureTransProxy"/>
       	<activity android:name=".SettingsPreferences"  android:label="@string/app_name"/>
         <activity android:name=".AppManager"  android:label="@string/app_name"/>
         <activity android:name=".WizardActivity"  android:label="@string/app_name"/>
diff --git a/res/layout/layout_wizard_permissions.xml b/res/layout/layout_wizard_permissions.xml
index b861d7a..f7ecab8 100644
--- a/res/layout/layout_wizard_permissions.xml
+++ b/res/layout/layout_wizard_permissions.xml
@@ -11,19 +11,10 @@
 	android:layout_height="wrap_content" 
 	android:id="@+id/relativeLayout1" 
 	android:layout_gravity="center_horizontal">
-        <ImageView 
-        	android:src="@drawable/tor" 
-        	android:visibility="invisible"
-        	android:id="@+id/orbot_image" 
-        	android:layout_width="wrap_content" 
-        	android:layout_height="wrap_content" 
-        	android:layout_alignParentLeft="true"
-        	android:paddingLeft="20px" android:paddingRight="20px" >
-        </ImageView>
+        
         <TextView android:textSize="10pt" 
-        	android:layout_toRightOf="@id/orbot_image" 
+        	
         	android:layout_alignParentTop="true"
-        	android:gravity="center_vertical"
        	 	android:layout_height="wrap_content" 
         	android:id="@+id/WizardTextTitle" 
         	android:layout_width="wrap_content" 
@@ -31,11 +22,7 @@
         	android:text="TITLE" 
         	android:textColor="#00ff00" 
         	android:singleLine="true" 
-        	
-        	
-        	
-        	android:layout_centerInParent="true" 
-        	android:padding="20px"> 
+          	android:padding="20px" android:layout_centerInParent="true"> 
         </TextView>
     </RelativeLayout>    
 <TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
diff --git a/res/layout/layout_wizard_root.xml b/res/layout/layout_wizard_root.xml
index f71c284..62afa38 100644
--- a/res/layout/layout_wizard_root.xml
+++ b/res/layout/layout_wizard_root.xml
@@ -1,29 +1,64 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
     android:orientation="vertical"
     android:layout_width="fill_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="fill_parent"
+            android:background="@drawable/background">
+            
+<RelativeLayout 
+	android:layout_width="match_parent" 
+	android:layout_height="wrap_content" 
+	android:id="@+id/relativeLayout1" 
+	android:layout_gravity="center_horizontal">
+         <TextView android:textSize="10pt" 
+        	
+        	android:layout_alignParentTop="true"
+       	 	android:layout_height="wrap_content" 
+        	android:id="@+id/WizardTextTitle" 
+        	android:layout_width="wrap_content" 
+        	android:fadingEdge="vertical" 
+        	android:text="TITLE" 
+        	android:textColor="#00ff00" 
+        	android:singleLine="true" 
+          	android:padding="20px" android:layout_centerInParent="true"> 
+        </TextView>
+    </RelativeLayout>    
+<TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
+
+<TableRow android:id="@+id/TableRow01" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="fill_parent">
+
+
 	<ScrollView android:id="@+id/helpscrollview" 
 		android:orientation="vertical"
 		android:layout_width="fill_parent" 
-		android:layout_height="fill_parent">    
-		<LinearLayout
+		android:layout_height="fill_parent"
+		 android:layout_span="3">    
+
+<LinearLayout
 		    android:orientation="vertical"
 		    android:layout_width="fill_parent"
 		    android:layout_height="fill_parent"
 		    android:padding="3px">
-<TextView android:text="@string/wizard_configure_msg" 	android:textColor="#ffffff" android:id="@+id/WizardRootTextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+<TextView android:text="@string/wizard_transproxy_msg" 	android:textColor="#ffffff" android:id="@+id/WizardRootTextView01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
 
 
-<CheckBox android:layout_marginTop="20px" android:text="@string/wizard_configure_all" android:id="@+id/WizardRootCheckBox01" android:layout_width="wrap_content" android:layout_height="wrap_content"></CheckBox>
-<TextView android:text="  or  " 	android:textColor="#ffffff"  android:layout_width="wrap_content" android:layout_height="wrap_content"></TextView>
+<CheckBox android:layout_marginTop="20px" android:text="@string/wizard_configure_all" android:id="@+id/WizardRootCheckBox01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"></CheckBox>
+<TextView android:text="@string/wizard_transproxy_hint" 	android:textColor="#ffffff"  android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="20dip"></TextView>
 
-<Button android:text="@string/wizard_configure_select_apps" android:id="@+id/WizardRootButton01" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
+<Button android:text="@string/wizard_configure_select_apps" android:id="@+id/WizardRootButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"/>
 
 
 			</LinearLayout>
-		</ScrollView>			
+		</ScrollView>
+		
+</TableRow>
+<TableRow android:id="@+id/TableRow01" android:textColor="#00ff00" android:layout_width="fill_parent" android:layout_height="30px">
+	   	<Button android:text="Back" android:id="@+id/btnWizard1" android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>
+    	<Button android:text="Next" android:id="@+id/btnWizard2"  android:layout_weight="1" android:layout_width="fill_parent" android:layout_height="wrap_content"></Button>	    
+</TableRow>			
+</TableLayout>
 </LinearLayout>
 
+
+
diff --git a/res/layout/layout_wizard_tips.xml b/res/layout/layout_wizard_tips.xml
index 60cba51..6a304ca 100644
--- a/res/layout/layout_wizard_tips.xml
+++ b/res/layout/layout_wizard_tips.xml
@@ -11,18 +11,9 @@
 	android:layout_height="wrap_content" 
 	android:id="@+id/relativeLayout1" 
 	android:layout_gravity="center_horizontal">
-        <ImageView 
-        	android:src="@drawable/tor" 
-        	android:id="@+id/orbot_image" 
-        	android:layout_width="wrap_content" 
-        	android:layout_height="wrap_content" 
-        	android:layout_alignParentLeft="true"
-        	android:paddingLeft="20px" android:paddingRight="20px" >
-        </ImageView>
-        <TextView android:textSize="10pt" 
-        	android:layout_toRightOf="@id/orbot_image" 
+         <TextView android:textSize="10pt" 
+        	
         	android:layout_alignParentTop="true"
-        	android:gravity="center_vertical"
        	 	android:layout_height="wrap_content" 
         	android:id="@+id/WizardTextTitle" 
         	android:layout_width="wrap_content" 
@@ -30,11 +21,7 @@
         	android:text="TITLE" 
         	android:textColor="#00ff00" 
         	android:singleLine="true" 
-        	
-        	
-        	
-        	android:layout_centerInParent="true" 
-        	android:padding="20px"> 
+          	android:padding="20px" android:layout_centerInParent="true"> 
         </TextView>
     </RelativeLayout>    
 <TableLayout android:id="@+id/TableLayout01" android:stretchColumns="*" android:layout_height="fill_parent" android:layout_width="wrap_content">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0bf8286..da4cca3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -145,5 +145,8 @@
 	<string name="gibberbot_apk_url">https://market.android.com/details?id=info.guardianproject.otr.app.im</string>
     <string name="firefox_apk_url">https://market.android.com/details?id=org.mozilla.firefox</string>
     <string name="proxymob_url">https://addons.mozilla.org/mobile/downloads/latest/251558/type:attachment/addon-251558-latest.xpi?src=addon-detail</string>
-    
+    <!-- Transparent Proxy screen -->
+    <string name="wizard_transproxy_title">Transparent Proxy</string>
+    <string name="wizard_transproxy_msg">Transparent Proxying allows you to redirect client requests without any special configuration or knowledge at the client.</string>
+    <string name="wizard_transproxy_hint">(Check this box if you have no idea what we are talking about)</string>
 </resources>
diff --git a/src/org/torproject/android/ConfigureTransProxy.java b/src/org/torproject/android/ConfigureTransProxy.java
new file mode 100644
index 0000000..8ff6dad
--- /dev/null
+++ b/src/org/torproject/android/ConfigureTransProxy.java
@@ -0,0 +1,150 @@
+package org.torproject.android;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
+import android.net.Uri;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.TextView;
+import android.widget.CompoundButton.OnCheckedChangeListener;
+
+public class ConfigureTransProxy extends Activity implements TorConstants {
+
+	private Context context;
+	
+	protected void onCreate(Bundle savedInstanceState)
+	{
+        super.onCreate(savedInstanceState);
+        context = this;
+
+	}
+	
+	@Override
+	protected void onStart() {
+		
+		super.onStart();
+		setContentView(R.layout.layout_wizard_root);
+		
+		stepSix();
+        
+	}
+	
+	@Override
+	protected void onResume() {
+		super.onResume();
+	
+		
+	}
+	
+	private void stepSix(){
+		
+			String title = context.getString(R.string.wizard_transproxy_title);
+			TextView txtTitle  = ((TextView)findViewById(R.id.WizardTextTitle));
+			txtTitle.setText(title);
+		
+			CheckBox cb1 = (CheckBox)findViewById(R.id.WizardRootCheckBox01);
+	        Button btn1 = (Button)findViewById(R.id.WizardRootButton01);
+	        
+	        cb1.setOnCheckedChangeListener(new OnCheckedChangeListener (){
+
+				@Override
+				public void onCheckedChanged(CompoundButton buttonView,
+						boolean isChecked) {
+				
+					
+					SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+					Editor pEdit = prefs.edit();
+					
+					pEdit.putBoolean(PREF_TRANSPARENT, isChecked);
+					pEdit.putBoolean(PREF_TRANSPARENT_ALL, isChecked);
+					
+					pEdit.commit();
+					
+				}
+	        	
+	        });
+	        
+	     
+	        
+	        btn1.setOnClickListener(new OnClickListener() {
+				
+				@Override
+				public void onClick(View view) {
+					
+					
+					SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+					Editor pEdit = prefs.edit();
+					pEdit.putBoolean(PREF_TRANSPARENT, true);
+					pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
+					pEdit.commit();
+					
+					context.startActivity(new Intent(context, AppManager.class));
+					
+				}
+			});
+	        
+	        Button back = ((Button)findViewById(R.id.btnWizard1));
+	        Button next = ((Button)findViewById(R.id.btnWizard2));
+	        
+	        back.setOnClickListener(new View.OnClickListener() {
+				
+				@Override
+				public void onClick(View v) {
+					
+					startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
+				}
+			});
+	    	
+	    	next.setOnClickListener(new View.OnClickListener() {
+				
+				@Override
+				public void onClick(View v) {
+					showWizardFinal();
+				}
+			});
+	}
+	
+	private void showWizardFinal ()
+	{
+		String title = null;
+		String msg = null;
+		
+		
+		title = context.getString(R.string.wizard_final);
+		msg = context.getString(R.string.wizard_final_msg);
+		
+		DialogInterface.OnClickListener ocListener = new DialogInterface.OnClickListener() {
+			
+			@Override
+			public void onClick(DialogInterface dialog, int which) {
+				//close wizard - return to orbot
+				
+			}
+		};
+	
+		
+		 new AlertDialog.Builder(context)
+		.setIcon(R.drawable.icon)
+        .setTitle(title)
+        .setPositiveButton(R.string.button_close, ocListener)
+        .setMessage(msg)
+        .show();
+		
+	
+	
+				
+		
+	}
+}
\ No newline at end of file
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index 996a1dc..248fd96 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -116,6 +116,8 @@ public class Permissions extends Activity implements TorConstants {
 			@Override
 			public void onClick(View v) {
 				//Check and Install iptables
+				startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);
+
 				
 			}
 		});



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits