[tor-commits] [orbot/master] fixes for wizard transproxy screen

n8fr8 at torproject.org n8fr8 at torproject.org
Sat Oct 29 06:55:21 UTC 2011


commit 73265cec1d1eb8e095078e3525d9ca8c81888226
Author: Nathan Freitas <nathan at freitas.net>
Date:   Fri Oct 28 13:39:14 2011 -0400

    fixes for wizard transproxy screen
---
 res/layout/layout_about.xml                        |    2 +-
 res/layout/layout_apps.xml                         |   18 +++-
 .../torproject/android/settings/AppManager.java    |   13 +++-
 .../android/wizard/ConfigureTransProxy.java        |   91 ++++++++++++++------
 4 files changed, 92 insertions(+), 32 deletions(-)

diff --git a/res/layout/layout_about.xml b/res/layout/layout_about.xml
index f81a940..0e0be56 100644
--- a/res/layout/layout_about.xml
+++ b/res/layout/layout_about.xml
@@ -80,7 +80,7 @@
 				android:paddingLeft="15px"
 				android:textStyle="bold"
 				android:textColor="#00ff00" />	
-			<TextView android:text="Tor v0.2.2.25: https://www.torproject.org"
+			<TextView android:text="Tor v0.2.3.6-alpha: https://www.torproject.org"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:autoLink="web"
diff --git a/res/layout/layout_apps.xml b/res/layout/layout_apps.xml
index afd3618..ddd546d 100644
--- a/res/layout/layout_apps.xml
+++ b/res/layout/layout_apps.xml
@@ -1,9 +1,19 @@
 <?xml version="1.0" encoding="utf-8"?>
-<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:duplicateParentState="false">
+<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:duplicateParentState="false">
+
+<!-- 
 <TextView android:text="Select apps to use with Tor:"
 				android:layout_width="fill_parent" 
 				android:layout_height="wrap_content"
 				android:textSize="16sp"		
-				android:padding="3px" />
-	<ListView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/applistview"></ListView>
-</LinearLayout>
+				android:padding="3px" 
+				 android:layout_above="@+id/applistview"
+				/>
+	 -->
+	 			
+<Button android:layout_width="fill_parent"
+        android:layout_height="wrap_content" android:id="@+id/btnsave"
+        android:text="@string/button_close" android:layout_alignParentBottom="true" />
+
+	<ListView android:layout_above="@id/btnsave"  android:layout_alignParentTop="true" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/applistview"></ListView>
+</RelativeLayout>
diff --git a/src/org/torproject/android/settings/AppManager.java b/src/org/torproject/android/settings/AppManager.java
index 6874f2d..3ced335 100644
--- a/src/org/torproject/android/settings/AppManager.java
+++ b/src/org/torproject/android/settings/AppManager.java
@@ -28,6 +28,7 @@ import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 import android.widget.ArrayAdapter;
+import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
 import android.widget.CompoundButton.OnCheckedChangeListener;
@@ -55,8 +56,6 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
 		
 		mAppManager = this;
 
-
-		
 	}
 	
 	
@@ -66,6 +65,16 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
 		super.onResume();
 		listApps = (ListView)findViewById(R.id.applistview);
 
+		Button btnSave = (Button)findViewById(R.id.btnsave);
+		btnSave.setOnClickListener(new OnClickListener()
+		{
+
+			@Override
+			public void onClick(View v) {
+				finish();
+			}
+		});
+		
 		if (!appsLoaded)
 			loadApps();
 	}
diff --git a/src/org/torproject/android/wizard/ConfigureTransProxy.java b/src/org/torproject/android/wizard/ConfigureTransProxy.java
index 05e4e68..a343e04 100644
--- a/src/org/torproject/android/wizard/ConfigureTransProxy.java
+++ b/src/org/torproject/android/wizard/ConfigureTransProxy.java
@@ -39,7 +39,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 	{
         super.onCreate(savedInstanceState);
         context = this;
-
+       
 	}
 	
 	@Override
@@ -56,9 +56,41 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 	protected void onResume() {
 		super.onResume();
 	
+		 setupUI();
+	
+		
 		
 	}
 	
+	private void setupUI ()
+	{
+		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+		boolean transEnabled = prefs.getBoolean(PREF_TRANSPARENT, false);
+		
+		if (transEnabled)
+		{
+			boolean transAllEnabled = prefs.getBoolean(PREF_TRANSPARENT_ALL, false);
+			
+			if (transAllEnabled)
+			{
+				RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
+				rb0.setChecked(true);
+				
+				
+			}
+			else
+			{
+				RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
+        		rb1.setChecked(true);
+				
+			}
+			
+		    Button next = ((Button)findViewById(R.id.btnWizard2));
+		    next.setEnabled(true);
+		}
+		
+	}
 	
 	
 	private void stepSix(){
@@ -85,13 +117,29 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 		    	//Dirty flag variable - improve logic
 				@Override
 				public void onClick(View v) {
-					if( flag == 1 )
-						context.startActivity(new Intent(context, AppManager.class));
-							
-					else 
+					
 						showWizardFinal();
 				}
 			});
+		    
+
+    		RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
+    		RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
+    		RadioButton rb2 = (RadioButton)findViewById(R.id.radio2);
+
+    		rb1.setOnClickListener(new OnClickListener()
+    		{
+
+				@Override
+				public void onClick(View v) {
+					
+						context.startActivity(new Intent(context, AppManager.class));							
+					
+					
+					
+				}
+    			
+    		});
 		
 			RadioGroup mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup);
 	        mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){
@@ -101,14 +149,6 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 	        	public void onCheckedChanged(RadioGroup group, int checkedId){
 	        		Button next = ((Button)findViewById(R.id.btnWizard2));
 	        		next.setEnabled(true);
-	        		next.setOnClickListener(new View.OnClickListener() {
-	    				
-	    				@Override
-	    				public void onClick(View v) {
-	    					
-	    						showWizardFinal();
-	    				}
-	    			});
 	        		
 	        		RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
 	        		RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
@@ -129,23 +169,13 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 	        		
 					else if(rb1.isChecked())
 	        		{	
-	        			flag = 1;
+	        			flag++;
 	        			
 	        			pEdit.putBoolean(PREF_TRANSPARENT, true);
 						pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
 						pEdit.putString("radiobutton","rb1");
 						pEdit.commit();
-						
-						next.setOnClickListener(new View.OnClickListener() {
-		    				
-		    				@Override
-		    				public void onClick(View v) {
-		    					
-		    					context.startActivity(new Intent(context, AppManager.class));
-		    						
-		    					
-		    				}
-		    			});
+					
 	        		}
 					else if(rb2.isChecked())
 					{
@@ -189,4 +219,15 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 				
 		
 	}
+
+	@Override
+	protected void onRestoreInstanceState(Bundle savedInstanceState) {
+		super.onRestoreInstanceState(savedInstanceState);
+	}
+
+	@Override
+	protected void onSaveInstanceState(Bundle outState) {
+		super.onSaveInstanceState(outState);
+		
+	}
 }
\ No newline at end of file





More information about the tor-commits mailing list