[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] Kill wizard activities on Exit
commit 4574c95b555e56aa5b60a11ca5937d66d42baf18
Author: Sathyanarayanan Gunasekaran <gsathya.ceg@xxxxxxxxx>
Date: Fri Nov 4 01:44:50 2011 +0530
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
---
src/org/torproject/android/Orbot.java | 4 +++-
src/org/torproject/android/TorConstants.java | 2 +-
.../android/wizard/ConfigureTransProxy.java | 14 +++++++++++++-
src/org/torproject/android/wizard/LotsaText.java | 13 ++++++++++++-
src/org/torproject/android/wizard/Permissions.java | 12 ++++++++++++
.../torproject/android/wizard/TipsAndTricks.java | 13 ++++++++++++-
6 files changed, 53 insertions(+), 5 deletions(-)
diff --git a/src/org/torproject/android/Orbot.java b/src/org/torproject/android/Orbot.java
index e105db7..8493f00 100644
--- a/src/org/torproject/android/Orbot.java
+++ b/src/org/torproject/android/Orbot.java
@@ -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();
}
diff --git a/src/org/torproject/android/TorConstants.java b/src/org/torproject/android/TorConstants.java
index 38bb0d2..df430c6 100644
--- a/src/org/torproject/android/TorConstants.java
+++ b/src/org/torproject/android/TorConstants.java
@@ -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;
}
diff --git a/src/org/torproject/android/wizard/ConfigureTransProxy.java b/src/org/torproject/android/wizard/ConfigureTransProxy.java
index a343e04..54336d4 100644
--- a/src/org/torproject/android/wizard/ConfigureTransProxy.java
+++ b/src/org/torproject/android/wizard/ConfigureTransProxy.java
@@ -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);
}
};
diff --git a/src/org/torproject/android/wizard/LotsaText.java b/src/org/torproject/android/wizard/LotsaText.java
index 1470a4b..5af1e39 100644
--- a/src/org/torproject/android/wizard/LotsaText.java
+++ b/src/org/torproject/android/wizard/LotsaText.java
@@ -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{
});
}
-
+
}
\ No newline at end of file
diff --git a/src/org/torproject/android/wizard/Permissions.java b/src/org/torproject/android/wizard/Permissions.java
index f2c24a0..151e6cb 100644
--- a/src/org/torproject/android/wizard/Permissions.java
+++ b/src/org/torproject/android/wizard/Permissions.java
@@ -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();
diff --git a/src/org/torproject/android/wizard/TipsAndTricks.java b/src/org/torproject/android/wizard/TipsAndTricks.java
index c46f2e4..ca8e416 100644
--- a/src/org/torproject/android/wizard/TipsAndTricks.java
+++ b/src/org/torproject/android/wizard/TipsAndTricks.java
@@ -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);
}
});
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits