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
This commit is contained in:
Sathyanarayanan Gunasekaran 2011-06-11 02:32:39 +05:30
parent 791a6267df
commit 0eb64792bf
4 changed files with 35 additions and 18 deletions

View File

@ -3,7 +3,10 @@ package org.torproject.android;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
@ -12,13 +15,15 @@ import android.widget.TextView;
public class LotsaText extends Activity implements TorConstants{ public class LotsaText extends Activity implements TorConstants{
private Context context; private Context context;
private int step = -1;
protected void onCreate(Bundle savedInstanceState) protected void onCreate(Bundle savedInstanceState)
{ {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
context = this; context = this;
} }
@Override @Override
@ -27,7 +32,13 @@ public class LotsaText extends Activity implements TorConstants{
super.onStart(); super.onStart();
setContentView(R.layout.scrollingtext_buttons_view); setContentView(R.layout.scrollingtext_buttons_view);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean wizardScreen1 = prefs.getBoolean("wizardscreen1",false);
if(wizardScreen1)
stepOne(); 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() { 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 title = context.getString(R.string.wizard_title);
String msg = context.getString(R.string.wizard_title_msg); String msg = context.getString(R.string.wizard_title_msg);
@ -79,7 +86,12 @@ public class LotsaText extends Activity implements TorConstants{
} }
private void stepTwo() { 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); setContentView(R.layout.scrollingtext_buttons_view);
String title = context.getString(R.string.wizard_warning_title); String title = context.getString(R.string.wizard_warning_title);

View File

@ -456,6 +456,11 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
private void showHelp () 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); startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
} }

View File

@ -150,7 +150,7 @@ public class Permissions extends Activity implements TorConstants {
@Override @Override
public void onClick(View v) { 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); startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);

View File

@ -277,7 +277,7 @@ public class WizardHelper implements TorConstants {
public void showWizardRootConfigureTorification() public void showWizardRootConfigureTorification()
{ {
/*
LayoutInflater li = LayoutInflater.from(context); LayoutInflater li = LayoutInflater.from(context);
View view = li.inflate(R.layout.layout_wizard_root, null); View view = li.inflate(R.layout.layout_wizard_root, null);
@ -347,7 +347,7 @@ public class WizardHelper implements TorConstants {
} }
}); });
*/
} }