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:
parent
821b911db3
commit
4574c95b55
|
@ -228,7 +228,7 @@ public class Orbot extends Activity implements OnLongClickListener, TorConstants
|
|||
private void doExit ()
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
//one of the confusing things about all of this code is the multiple
|
||||
//places where things like "stopTor" are called, both in the Activity and the Service
|
||||
//not something to tackle in your first iteration, but i thin we can talk about fixing
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -61,6 +61,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 ()
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
@ -55,7 +55,18 @@ 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() {
|
||||
|
@ -135,6 +146,6 @@ public class LotsaText extends Activity implements TorConstants{
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue