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

[tor-commits] [orbot/master] Fixed wizard restart on rotation



commit 0eb64792bf5911412758d0b73eff486c27172bb8
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@xxxxxxxxx>
Date:   Sat Jun 11 02:32:39 2011 +0530

    Fixed wizard restart on rotation
    
    Added a SharedPreference - "wizardscreen1" which when set to true
    shows stepOne()(Intro screen) and shows stepTwo()(Warning screen)
    when set to palse
---
 src/org/torproject/android/LotsaText.java    |   40 +++++++++++++++++---------
 src/org/torproject/android/Orbot.java        |    7 ++++-
 src/org/torproject/android/Permissions.java  |    2 +-
 src/org/torproject/android/WizardHelper.java |    4 +-
 4 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/src/org/torproject/android/LotsaText.java b/src/org/torproject/android/LotsaText.java
index e9fc556..43e6d16 100644
--- a/src/org/torproject/android/LotsaText.java
+++ b/src/org/torproject/android/LotsaText.java
@@ -3,7 +3,10 @@ package org.torproject.android;
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.SharedPreferences.Editor;
 import android.os.Bundle;
+import android.preference.PreferenceManager;
 import android.view.View;
 import android.widget.Button;
 import android.widget.ImageView;
@@ -12,12 +15,14 @@ import android.widget.TextView;
 public class LotsaText extends Activity implements TorConstants{
 	
 	private Context context;
-	private int step = -1;
 	
 	protected void onCreate(Bundle savedInstanceState)
-	{
+	{	
+		
+		
         super.onCreate(savedInstanceState);
         context = this;
+        
 
 	}
 	
@@ -27,7 +32,13 @@ public class LotsaText extends Activity implements TorConstants{
 		super.onStart();
 		setContentView(R.layout.scrollingtext_buttons_view);
 		
-		stepOne();
+		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+		boolean wizardScreen1 = prefs.getBoolean("wizardscreen1",false);
+		if(wizardScreen1)
+			stepOne();
+		else
+			stepTwo();
         
 	}
 	
@@ -39,19 +50,15 @@ public class LotsaText extends Activity implements TorConstants{
 	}
 	
 	
-	/*public void startWizard(){
-		
-		switch(step){
-		
-		case -1 : stepOne();break;
-		
-		}
-	}
-	*/
+	
 	private void stepOne() {
 		
+		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+		Editor pEdit = prefs.edit();
+		pEdit.putBoolean("wizardscreen1",true);
+		pEdit.commit();
 		
-		//setContentView(R.layout.scrollingtext_buttons_view);
 		String title = context.getString(R.string.wizard_title);
 		String msg = context.getString(R.string.wizard_title_msg);
 		
@@ -79,7 +86,12 @@ public class LotsaText extends Activity implements TorConstants{
 	}
 	
 	private void stepTwo() {
-		step=0;
+		
+		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+		Editor pEdit = prefs.edit();
+		pEdit.putBoolean("wizardscreen1",false);
+		pEdit.commit();
 		
 		setContentView(R.layout.scrollingtext_buttons_view);
 		String title = context.getString(R.string.wizard_warning_title);
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index 383929d..7f8af3b 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -455,7 +455,12 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
 	 */
 	private void showHelp ()
 	{
-		
+
+        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+
+		Editor pEdit = prefs.edit();
+		pEdit.putBoolean("wizardscreen1",true);
+		pEdit.commit();
 		startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
 	}
 	
diff --git a/src/org/torproject/android/Permissions.java b/src/org/torproject/android/Permissions.java
index a29b04a..3b782df 100644
--- a/src/org/torproject/android/Permissions.java
+++ b/src/org/torproject/android/Permissions.java
@@ -150,7 +150,7 @@ public class Permissions extends Activity implements TorConstants {
 			
 			@Override
 			public void onClick(View v) {
-				//Check and Install iptables - orTransProxy.testOwnerModule(this)
+				//Check and Install iptables - TorTransProxy.testOwnerModule(this)
 				startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);
 
 				
diff --git a/src/org/torproject/android/WizardHelper.java b/src/org/torproject/android/WizardHelper.java
index 684a730..c85c50a 100644
--- a/src/org/torproject/android/WizardHelper.java
+++ b/src/org/torproject/android/WizardHelper.java
@@ -277,7 +277,7 @@ public class WizardHelper implements TorConstants {
 	
 	public void showWizardRootConfigureTorification()
 	{
-		
+		/*
 		LayoutInflater li = LayoutInflater.from(context);
         View view = li.inflate(R.layout.layout_wizard_root, null); 
         
@@ -347,7 +347,7 @@ public class WizardHelper implements TorConstants {
 			}
 		});
 
-		  
+		 */ 
       
 	}
 	



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