more wizard flow fixes

This commit is contained in:
Nathan Freitas 2014-06-06 14:19:06 -04:00
parent 816a6b2be0
commit 120da6bfe2
6 changed files with 55 additions and 118 deletions

View File

@ -786,10 +786,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
Editor pEdit = mPrefs.edit(); Editor pEdit = mPrefs.edit();
pEdit.putBoolean("wizardscreen1",true); pEdit.putBoolean("wizardscreen1",true);
pEdit.commit(); pEdit.commit();
startActivityForResult(new Intent(getApplicationContext(), ChooseLocaleWizardActivity.class), 1); startActivity(new Intent(getApplicationContext(), ChooseLocaleWizardActivity.class));
} }
/* /*
* Load the basic settings application to display torrc * Load the basic settings application to display torrc
*/ */
@ -800,12 +799,13 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
} }
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onResume() {
super.onActivityResult(requestCode, resultCode, data); super.onResume();
if (requestCode == 1 && mService != null) if (mService != null && torStatus != TorServiceConstants.STATUS_ON)
{ {
try { try {
mService.processSettings(); mService.processSettings();
@ -816,10 +816,9 @@ public class Orbot extends ActionBarActivity implements TorConstants, OnLongClic
e.printStackTrace(); e.printStackTrace();
} }
} }
}
} AlertDialog aDialog = null;
AlertDialog aDialog = null;
//general alert dialog for mostly Tor warning messages //general alert dialog for mostly Tor warning messages
//sometimes this can go haywire or crazy with too many error //sometimes this can go haywire or crazy with too many error

View File

@ -39,55 +39,42 @@ public class ChooseLocaleWizardActivity extends Activity implements TorConstants
super.onStart(); super.onStart();
setContentView(R.layout.layout_wizard_locale); setContentView(R.layout.layout_wizard_locale);
stepSix();
} listLocales = (ListView)findViewById(R.id.wizard_locale_list);
Button next = ((Button)findViewById(R.id.btnWizard2));
// next.setEnabled(false);
@Override String[] strLangs = getResources().getStringArray(R.array.languages);
protected void onResume() { strLangs[0] = Locale.getDefault().getDisplayName();
super.onResume(); 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(){ @Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
listLocales = (ListView)findViewById(R.id.wizard_locale_list); setLocalePref(arg2);
Button next = ((Button)findViewById(R.id.btnWizard2)); finish();
// next.setEnabled(false); startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class));
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); next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
setLocalePref(0);
finish();
startActivity(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class));
listLocales.setOnItemClickListener(new OnItemClickListener() { }
});
@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() {
public void onClick(View v) {
finish();
startActivityForResult(new Intent(ChooseLocaleWizardActivity.this, LotsaText.class), 1);
}
});

View File

@ -65,18 +65,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 () private void setupUI ()
{ {
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
@ -122,7 +110,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
public void onClick(View v) { public void onClick(View v) {
finish(); 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) { public void onClick(View v) {
finish(); 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) { public void onClick(View v) {
finish();
context.startActivity(new Intent(context, AppManager.class)); startActivity(new Intent(ConfigureTransProxy.this, AppManager.class));
} }
}); });

View File

@ -52,19 +52,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() { private void stepOne() {
SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext()); SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
@ -130,7 +117,7 @@ public class LotsaText extends Activity implements TorConstants{
public void onClick(View v) { public void onClick(View v) {
finish(); 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) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){ if(keyCode == KeyEvent.KEYCODE_BACK){
finish(); finish();
startActivityForResult(new Intent(getBaseContext(), ChooseLocaleWizardActivity.class), 1); startActivity(new Intent(getBaseContext(), ChooseLocaleWizardActivity.class));
return true; return true;
} }
return true; return true;

View File

@ -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(){ private void stepFourRoot(){
@ -137,7 +126,7 @@ public class Permissions extends Activity implements TorConstants {
else else
{ {
finish(); 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) { public void onClick(View v) {
finish(); 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) { public void onClick(View v) {
finish(); 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)); Button grantPermissions = ((Button)findViewById(R.id.grantPermissions));
grantPermissions.setVisibility(Button.GONE); grantPermissions.setVisibility(Button.GONE);
CheckBox consent = (CheckBox)findViewById(R.id.checkBox); CheckBox consent = (CheckBox)findViewById(R.id.checkBox);
consent.setVisibility(CheckBox.GONE); consent.setVisibility(CheckBox.GONE);
@ -192,7 +180,7 @@ public class Permissions extends Activity implements TorConstants {
public void onClick(View v) { public void onClick(View v) {
finish(); 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) { public void onClick(View v) {
finish(); 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) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){ if(keyCode == KeyEvent.KEYCODE_BACK){
finish(); finish();
startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1); startActivity(new Intent(getBaseContext(), LotsaText.class));
return true; return true;
} }
return false; return false;

View File

@ -40,17 +40,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(){ void stepFive(){
@ -192,7 +181,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
public void onClick(View v) { public void onClick(View v) {
finish(); 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) { public void onClick(View v) {
finish(); 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) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){ if(keyCode == KeyEvent.KEYCODE_BACK){
finish(); finish();
startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1); startActivity(new Intent(getBaseContext(), Permissions.class));
return true; return true;
} }
return false; return false;