cleaned ConfigureTransProxy workflow, implemented override for back button

This commit is contained in:
Amogh Pradeep 2014-05-24 02:38:19 +05:30
parent ea384f95f6
commit f29a49439e
1 changed files with 19 additions and 7 deletions

View File

@ -20,6 +20,8 @@ import android.content.SharedPreferences.Editor;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.widget.Button; import android.widget.Button;
@ -119,7 +121,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
back.setOnClickListener(new View.OnClickListener() { back.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish();
startActivityForResult(new Intent(ConfigureTransProxy.this, Permissions.class), 1); startActivityForResult(new Intent(ConfigureTransProxy.this, Permissions.class), 1);
} }
}); });
@ -127,7 +129,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
next.setOnClickListener(new View.OnClickListener() { next.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
finish();
startActivityForResult(new Intent(ConfigureTransProxy.this, TipsAndTricks.class), 1); startActivityForResult(new Intent(ConfigureTransProxy.this, TipsAndTricks.class), 1);
} }
@ -142,11 +144,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)); context.startActivity(new Intent(context, AppManager.class));
} }
}); });
@ -239,4 +238,17 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
//Code to override the back button!
@Override
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(), Permissions.class), 1);
return true;
}
return false;
}
} }