Updated Transproxy screen

This commit is contained in:
Sathyanarayanan Gunasekaran 2011-06-09 01:31:32 +05:30
parent e7453b7f0b
commit 86727d6298
3 changed files with 45 additions and 39 deletions

View File

@ -149,4 +149,5 @@
<string name="wizard_transproxy_title">Transparent Proxy</string> <string name="wizard_transproxy_title">Transparent Proxy</string>
<string name="wizard_transproxy_msg">Transparent Proxying allows you to redirect client requests without any special configuration or knowledge at the client.</string> <string name="wizard_transproxy_msg">Transparent Proxying allows you to redirect client requests without any special configuration or knowledge at the client.</string>
<string name="wizard_transproxy_hint">(Check this box if you have no idea what we are talking about)</string> <string name="wizard_transproxy_hint">(Check this box if you have no idea what we are talking about)</string>
<string name="wizard_transproxy_none">None</string>
</resources> </resources>

View File

@ -15,13 +15,16 @@ import android.view.View.OnClickListener;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView; import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.Toast;
public class ConfigureTransProxy extends Activity implements TorConstants { public class ConfigureTransProxy extends Activity implements TorConstants {
private Context context; private Context context;
private int flag =0;
protected void onCreate(Bundle savedInstanceState) protected void onCreate(Bundle savedInstanceState)
{ {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -46,51 +49,49 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
} }
private void stepSix(){ private void stepSix(){
String title = context.getString(R.string.wizard_transproxy_title); String title = context.getString(R.string.wizard_transproxy_title);
TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle)); TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle));
txtTitle.setText(title); txtTitle.setText(title);
CheckBox cb1 = (CheckBox)findViewById(R.id.WizardRootCheckBox01); RadioGroup mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup);
Button btn1 = (Button)findViewById(R.id.WizardRootButton01); mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){
cb1.setOnCheckedChangeListener(new OnCheckedChangeListener (){
@Override @Override
public void onCheckedChanged(CompoundButton buttonView, public void onCheckedChanged(RadioGroup group, int checkedId){
boolean isChecked) {
flag = 0;
RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
RadioButton rb2 = (RadioButton)findViewById(R.id.radio2);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor pEdit = prefs.edit(); Editor pEdit = prefs.edit();
pEdit.putBoolean(PREF_TRANSPARENT, isChecked); pEdit.putBoolean(PREF_TRANSPARENT, rb0.isChecked());
pEdit.putBoolean(PREF_TRANSPARENT_ALL, isChecked); pEdit.putBoolean(PREF_TRANSPARENT_ALL, rb0.isChecked());
pEdit.commit(); pEdit.commit();
if(rb1.isChecked())
{
flag = 1;
SharedPreferences prefs1 = PreferenceManager.getDefaultSharedPreferences(context);
Editor pEdit1 = prefs1.edit();
pEdit1.putBoolean(PREF_TRANSPARENT, true);
pEdit1.putBoolean(PREF_TRANSPARENT_ALL, false);
pEdit1.commit();
} }
});
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Editor pEdit = prefs.edit();
pEdit.putBoolean(PREF_TRANSPARENT, true);
pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
pEdit.commit();
context.startActivity(new Intent(context, AppManager.class));
} }
}); });
@ -111,6 +112,10 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if( flag == 1 )
context.startActivity(new Intent(context, AppManager.class));
else
showWizardFinal(); showWizardFinal();
} }
}); });

View File

@ -115,7 +115,7 @@ public class Permissions extends Activity implements TorConstants {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
//Check and Install iptables //Check and Install iptables - orTransProxy.testOwnerModule(this)
startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1); startActivityForResult(new Intent(getBaseContext(), ConfigureTransProxy.class), 1);