[tor-commits] [orbot/master] cleaned Permissions workflow, implemented override for back button

n8fr8 at torproject.org n8fr8 at torproject.org
Thu Jun 5 15:15:59 UTC 2014


commit 6488e6a699153a0e061cfed8385a0488999e86e2
Author: Amogh Pradeep <amoghbl1 at gmail.com>
Date:   Sat May 24 02:55:36 2014 +0530

    cleaned Permissions workflow, implemented override for back button
---
 src/org/torproject/android/wizard/Permissions.java |   23 ++++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/org/torproject/android/wizard/Permissions.java b/src/org/torproject/android/wizard/Permissions.java
index 37db185..1df4212 100644
--- a/src/org/torproject/android/wizard/Permissions.java
+++ b/src/org/torproject/android/wizard/Permissions.java
@@ -3,7 +3,6 @@ package org.torproject.android.wizard;
 import org.sufficientlysecure.rootcommands.RootCommands;
 import org.torproject.android.R;
 import org.torproject.android.TorConstants;
-import org.torproject.android.service.TorService;
 import org.torproject.android.service.TorServiceUtils;
 
 import android.app.Activity;
@@ -12,14 +11,13 @@ import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.SharedPreferences.Editor;
 import android.os.Bundle;
-import android.preference.PreferenceManager;
 import android.util.Log;
+import android.view.KeyEvent;
 import android.view.View;
 import android.widget.Button;
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
 import android.widget.CompoundButton.OnCheckedChangeListener;
-import android.widget.ImageView;
 import android.widget.TextView;
 
 public class Permissions extends Activity implements TorConstants {
@@ -138,9 +136,8 @@ public class Permissions extends Activity implements TorConstants {
 				}
 				else
 				{
+					finish();
 					startActivityForResult(new Intent(Permissions.this, ConfigureTransProxy.class), 1);
-
-					
 				}
 
 				
@@ -150,7 +147,7 @@ public class Permissions extends Activity implements TorConstants {
     	back.setOnClickListener(new View.OnClickListener() {
 			
 			public void onClick(View v) {
-				
+				finish();
 				startActivityForResult(new Intent(Permissions.this, LotsaText.class), 1);
 			}
 		});
@@ -160,6 +157,7 @@ public class Permissions extends Activity implements TorConstants {
     	 
 			
 			public void onClick(View v) {
+				finish();
 				startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
 			}
 		});
@@ -193,7 +191,7 @@ public class Permissions extends Activity implements TorConstants {
     	btn1.setOnClickListener(new View.OnClickListener() {
 			
 			public void onClick(View v) {
-				
+				finish();
 				startActivityForResult(new Intent(Permissions.this, LotsaText.class), 1);
 			}
 		});
@@ -201,10 +199,21 @@ public class Permissions extends Activity implements TorConstants {
     	btn2.setOnClickListener(new View.OnClickListener() {
 			
 			public void onClick(View v) {
+				finish();
 				startActivityForResult(new Intent(Permissions.this, TipsAndTricks.class), 1);
 			}
 		});
 	}
 		
+	//Code to override the back button!
+	public boolean onKeyDown(int keyCode, KeyEvent event)  {
+		Log.d("myTag", "IT HAS BEEN CLICKED :O"+keyCode+"    "+event);
+	    if(keyCode == KeyEvent.KEYCODE_BACK){
+	    	finish();
+	    	startActivityForResult(new Intent(getBaseContext(), LotsaText.class), 1);
+	    	return true;
+	    }
+	    return false;
+	}
 	
 }
\ No newline at end of file





More information about the tor-commits mailing list