[tor-commits] [orbot/master] more wizard flow fixes

n8fr8 at torproject.org n8fr8 at torproject.org
Fri Jun 6 19:12:13 UTC 2014


commit 120da6bfe26e6da04c4cc6438a0ab118a050cc6f
Author: Nathan Freitas <nathan at freitas.net>
Date:   Fri Jun 6 14:19:06 2014 -0400

    more wizard flow fixes
---
 src/org/torproject/android/Orbot.java              |   21 +++---
 .../android/wizard/ChooseLocaleWizardActivity.java |   75 ++++++++------------
 .../android/wizard/ConfigureTransProxy.java        |   20 ++----
 src/org/torproject/android/wizard/LotsaText.java   |   17 +----
 src/org/torproject/android/wizard/Permissions.java |   24 ++-----
 .../torproject/android/wizard/TipsAndTricks.java   |   16 +----
 6 files changed, 55 insertions(+), 118 deletions(-)

diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index cd92d46..7e40c43 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -786,10 +786,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
 		Editor pEdit = mPrefs.edit();
 		pEdit.putBoolean("wizardscreen1",true);
 		pEdit.commit();
-		startActivityForResult(new Intent(getApplicationContext(), ChooseLocaleWizardActivity.class), 1);
+		startActivity(new Intent(getApplicationContext(), ChooseLocaleWizardActivity.class));
 	}
 	
-	
     /*
      * Load the basic settings application to display torrc
      */
@@ -800,12 +799,13 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
     }
     
     
+    
     @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-        
-        
-        if (requestCode == 1 && mService != null)
+	protected void onResume() {
+		super.onResume();
+		
+
+        if (mService != null && torStatus != TorServiceConstants.STATUS_ON)
         {
                 try {
 					mService.processSettings();
@@ -816,10 +816,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
 					e.printStackTrace();
 				}
         }
-       
-    }
-    
-    AlertDialog aDialog = null;
+	}
+
+	AlertDialog aDialog = null;
     
     //general alert dialog for mostly Tor warning messages
     //sometimes this can go haywire or crazy with too many error
diff --git a/src/org/torproject/android/wizard/ChooseLocaleWizardActivity.java b/src/org/torproject/android/wizard/ChooseLocaleWizardActivity.java
index 3ebe441..1a620c1 100644
--- a/src/org/torproject/android/wizard/ChooseLocaleWizardActivity.java
+++ b/src/org/torproject/android/wizard/ChooseLocaleWizardActivity.java
@@ -39,55 +39,42 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
 		super.onStart();
 		setContentView(R.layout.layout_wizard_locale);
 		
-		stepSix();
-        
-	}
-	
-	@Override
-	protected void onResume() {
-		super.onResume();
-	
-		
 		
-	}
+		listLocales = (ListView)findViewById(R.id.wizard_locale_list);
+	    Button next = ((Button)findViewById(R.id.btnWizard2));
+	   // next.setEnabled(false);
+	    
+	    String[] strLangs = getResources().getStringArray(R.array.languages);
+	    strLangs[0] = Locale.getDefault().getDisplayName();
+        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1,  strLangs);	        
+        listLocales.setAdapter(adapter);
+	    
+	    listLocales.setSelection(0);
+	    		    
+	    
+	    listLocales.setOnItemClickListener(new OnItemClickListener() {
+			
 
-	
-	private void stepSix(){
-		
-			listLocales = (ListView)findViewById(R.id.wizard_locale_list);
-		    Button next = ((Button)findViewById(R.id.btnWizard2));
-		   // next.setEnabled(false);
-		    
-		    String[] strLangs = getResources().getStringArray(R.array.languages);
-		    strLangs[0] = Locale.getDefault().getDisplayName();
-	        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1,  strLangs);	        
-	        listLocales.setAdapter(adapter);
-		    
-		    listLocales.setSelection(0);
-		    		    
-		    
-		    listLocales.setOnItemClickListener(new OnItemClickListener() {
+			@Override
+			public void onItemClick(AdapterView<?> arg0, View arg1,
+					int arg2, long arg3) {
 				
-
-				@Override
-				public void onItemClick(AdapterView<?> arg0, View arg1,
-						int arg2, long arg3) {
-					
-					setLocalePref(arg2);
-					finish();
-					startActivityForResult(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class), 1);
-					
-				}
-			});
-		        
-		    next.setOnClickListener(new View.OnClickListener() {
+				setLocalePref(arg2);
+				finish();
+				startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class));
 				
-				public void onClick(View v) {
-					finish();
-					startActivityForResult(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class), 1);
+			}
+		});
+	        
+	    next.setOnClickListener(new View.OnClickListener() {
+			
+			public void onClick(View v) {
+				setLocalePref(0);
+				finish();
+				startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class));
 
-				}
-			});
+			}
+		});
 		    
 
 	       
diff --git a/src/org/torproject/android/wizard/ConfigureTransProxy.java b/src/org/torproject/android/wizard/ConfigureTransProxy.java
index b6cad18..ca7f3ac 100644
--- a/src/org/torproject/android/wizard/ConfigureTransProxy.java
+++ b/src/org/torproject/android/wizard/ConfigureTransProxy.java
@@ -64,18 +64,6 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 		
 		
 	}
-
-	@Override
-	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-	    switch(resultCode)
-	    {
-	    case RESULT_CLOSE_ALL:
-	        setResult(RESULT_CLOSE_ALL);
-	        finish();
-	    }
-	    super.onActivityResult(requestCode, resultCode, data);
-	}
-
 	
 	private void setupUI ()
 	{
@@ -122,7 +110,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 					
 				public void onClick(View v) {
 					finish();	
-					startActivityForResult(new Intent(ConfigureTransProxy.this, Permissions.class), 1);
+					startActivity(new Intent(ConfigureTransProxy.this, Permissions.class));
 				}
 			});
 		    	
@@ -130,7 +118,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
 				
 				public void onClick(View v) {
 					finish();
-					startActivityForResult(new Intent(ConfigureTransProxy.this, TipsAndTricks.class), 1);
+					startActivity(new Intent(ConfigureTransProxy.this, TipsAndTricks.class));
 
 				}
 			});
@@ -144,8 +132,8 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
     		{
 
 				public void onClick(View v) {
-					finish();
-					context.startActivity(new Intent(context, AppManager.class));
+					
+					startActivity(new Intent(ConfigureTransProxy.this, AppManager.class));
 				}
     			
     		});
diff --git a/src/org/torproject/android/wizard/LotsaText.java b/src/org/torproject/android/wizard/LotsaText.java
index 9e28024..536edab 100644
--- a/src/org/torproject/android/wizard/LotsaText.java
+++ b/src/org/torproject/android/wizard/LotsaText.java
@@ -51,19 +51,6 @@ public class LotsaText extends Activity implements TorConstants{
 	
 		
 	}
-
-	
-	@Override
-	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-	    switch(resultCode)
-	    {
-	    case RESULT_CLOSE_ALL:
-	        setResult(RESULT_CLOSE_ALL);
-	        finish();
-	    }
-	    super.onActivityResult(requestCode, resultCode, data);
-	}
-	
 	
 	private void stepOne() {
 		
@@ -130,7 +117,7 @@ public class LotsaText extends Activity implements TorConstants{
 			
 			public void onClick(View v) {
 				finish();
-				startActivityForResult(new Intent(LotsaText.this, Permissions.class), 1);
+				startActivity(new Intent(LotsaText.this, Permissions.class));
 			}
 		});
 		
@@ -141,7 +128,7 @@ public class LotsaText extends Activity implements TorConstants{
 	public boolean onKeyDown(int keyCode, KeyEvent event)  {
 	    if(keyCode == KeyEvent.KEYCODE_BACK){
 	    	finish();
-	    	startActivityForResult(new Intent(getBaseContext(), ChooseLocaleWizardActivity.class), 1);
+	    	startActivity(new Intent(getBaseContext(), ChooseLocaleWizardActivity.class));
 	    	return true;
 	    }
 	    return true;
diff --git a/src/org/torproject/android/wizard/Permissions.java b/src/org/torproject/android/wizard/Permissions.java
index 5568df1..229f5bd 100644
--- a/src/org/torproject/android/wizard/Permissions.java
+++ b/src/org/torproject/android/wizard/Permissions.java
@@ -48,17 +48,6 @@ public class Permissions extends Activity implements TorConstants {
 		
 	}
 	
-	@Override
-	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-	    switch(resultCode)
-	    {
-	    case RESULT_CLOSE_ALL:
-	        setResult(RESULT_CLOSE_ALL);
-	        finish();
-	    }
-	    super.onActivityResult(requestCode, resultCode, data);
-	}
-
 	
 	private void stepFourRoot(){
 				
@@ -137,7 +126,7 @@ public class Permissions extends Activity implements TorConstants {
 				else
 				{
 					finish();
-					startActivityForResult(new Intent(Permissions.this, ConfigureTransProxy.class), 1);
+					startActivity(new Intent(Permissions.this, ConfigureTransProxy.class));
 				}
 
 				
@@ -148,7 +137,7 @@ public class Permissions extends Activity implements TorConstants {
 			
 			public void onClick(View v) {
 				finish();
-				startActivityForResult(new Intent(Permissions.this, LotsaText.class), 1);
+				startActivity(new Intent(Permissions.this, LotsaText.class));
 			}
 		});
     	
@@ -158,7 +147,7 @@ public class Permissions extends Activity implements TorConstants {
 			
 			public void onClick(View v) {
 				finish();
-				startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
+				startActivity(new Intent(Permissions.this, TipsAndTricks.class));
 			}
 		});
 		
@@ -184,7 +173,6 @@ public class Permissions extends Activity implements TorConstants {
 		Button grantPermissions = ((Button)findViewById(R.id.grantPermissions));
 		grantPermissions.setVisibility(Button.GONE);
         
-        
         CheckBox consent = (CheckBox)findViewById(R.id.checkBox);
         consent.setVisibility(CheckBox.GONE);
         
@@ -192,7 +180,7 @@ public class Permissions extends Activity implements TorConstants {
 			
 			public void onClick(View v) {
 				finish();
-				startActivityForResult(new Intent(Permissions.this, LotsaText.class), 1);
+				startActivity(new Intent(Permissions.this, LotsaText.class));
 			}
 		});
     	
@@ -200,7 +188,7 @@ public class Permissions extends Activity implements TorConstants {
 			
 			public void onClick(View v) {
 				finish();
-				startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
+				startActivity(new Intent(Permissions.this, TipsAndTricks.class));
 			}
 		});
 	}
@@ -209,7 +197,7 @@ public class Permissions extends Activity implements TorConstants {
 	public boolean onKeyDown(int keyCode, KeyEvent event)  {
 	    if(keyCode == KeyEvent.KEYCODE_BACK){
 	    	finish();
-	    	startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
+	    	startActivity(new Intent(getBaseContext(), LotsaText.class));
 	    	return true;
 	    }
 	    return false;
diff --git a/src/org/torproject/android/wizard/TipsAndTricks.java b/src/org/torproject/android/wizard/TipsAndTricks.java
index 222d950..2fcf9d2 100644
--- a/src/org/torproject/android/wizard/TipsAndTricks.java
+++ b/src/org/torproject/android/wizard/TipsAndTricks.java
@@ -39,17 +39,6 @@ public class TipsAndTricks extends Activity implements TorConstants {
 	
 		
 	}
-	
-	@Override
-	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-	    switch(resultCode)
-	    {
-	    case RESULT_CLOSE_ALL:
-	        setResult(RESULT_CLOSE_ALL);
-	        finish();
-	    }
-	    super.onActivityResult(requestCode, resultCode, data);
-	}
 
 	void stepFive(){
 		
@@ -192,7 +181,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
 			
 			public void onClick(View v) {
 				finish();
-				startActivityForResult(new Intent(TipsAndTricks.this, Permissions.class), 1);
+				startActivity(new Intent(TipsAndTricks.this, Permissions.class));
 			}
 		});
     	
@@ -200,7 +189,6 @@ public class TipsAndTricks extends Activity implements TorConstants {
 			
 			public void onClick(View v) {
 				finish();
-				startActivity(new Intent(TipsAndTricks.this, Orbot.class));
 			}
 		});
 	}
@@ -210,7 +198,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
 	public boolean onKeyDown(int keyCode, KeyEvent event)  {
 	    if(keyCode == KeyEvent.KEYCODE_BACK){
 	    	finish();
-	    	startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1);
+	    	startActivity(new Intent(getBaseContext(), Permissions.class));
 	    	return true;
 	    }
 	    return false;





More information about the tor-commits mailing list