Kill wizard activities on Exit

Orbot.java's doExit() returns a
RESULT_CLOSE_ALL to the wizard activities.
The onActivityResult() is overrided
in the wizard activities to kill all
the activities if the result is
RESULT_CLOSE_ALL
This commit is contained in:
Sathyanarayanan Gunasekaran 2011-11-04 01:44:50 +05:30
parent 821b911db3
commit 4574c95b55
6 changed files with 53 additions and 5 deletions

View File

@ -247,6 +247,8 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
Log.w(TAG, e);
}
//Kill all the wizard activities
setResult(RESULT_CLOSE_ALL);
finish();
}

View File

@ -41,7 +41,7 @@ public interface TorConstants {
public final static String PREF_TRANSPARENT_ALL = "pref_transparent_all";
public final static String PREF_HAS_ROOT = "has_root";
public final static int RESULT_CLOSE_ALL = 0;
}

View File

@ -62,6 +62,18 @@ 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 ()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
@ -202,7 +214,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
@Override
public void onClick(DialogInterface dialog, int which) {
context.startActivity(new Intent(context, Orbot.class));
startActivityForResult(new Intent(getBaseContext(), Orbot.class), 1);
}
};

View File

@ -57,6 +57,17 @@ 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() {

View File

@ -55,6 +55,18 @@ 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 stepThree(){
boolean isRootPossible = TorServiceUtils.isRootPossible();

View File

@ -49,6 +49,17 @@ 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(){
String title = getString(R.string.wizard_tips_title);
@ -141,7 +152,7 @@ public class TipsAndTricks extends Activity implements TorConstants {
@Override
public void onClick(View v) {
startActivity(new Intent(getBaseContext(), Orbot.class));
startActivityForResult(new Intent(getBaseContext(), Orbot.class), 1);
}
});