fixes for wizard transproxy screen

This commit is contained in:
Nathan Freitas 2011-10-28 13:39:14 -04:00
parent d6692610e4
commit 73265cec1d
4 changed files with 92 additions and 32 deletions

View File

@ -80,7 +80,7 @@
android:paddingLeft="15px" android:paddingLeft="15px"
android:textStyle="bold" android:textStyle="bold"
android:textColor="#00ff00" /> android:textColor="#00ff00" />
<TextView android:text="Tor v0.2.2.25: https://www.torproject.org" <TextView android:text="Tor v0.2.3.6-alpha: https://www.torproject.org"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:autoLink="web" android:autoLink="web"

View File

@ -1,9 +1,19 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:duplicateParentState="false"> <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:duplicateParentState="false">
<!--
<TextView android:text="Select apps to use with Tor:" <TextView android:text="Select apps to use with Tor:"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="16sp" android:textSize="16sp"
android:padding="3px" /> android:padding="3px"
<ListView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/applistview"></ListView> android:layout_above="@+id/applistview"
</LinearLayout> />
-->
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/btnsave"
android:text="@string/button_close" android:layout_alignParentBottom="true" />
<ListView android:layout_above="@id/btnsave" android:layout_alignParentTop="true" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/applistview"></ListView>
</RelativeLayout>

View File

@ -28,6 +28,7 @@ import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.CompoundButton.OnCheckedChangeListener;
@ -55,8 +56,6 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
mAppManager = this; mAppManager = this;
} }
@ -66,6 +65,16 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
super.onResume(); super.onResume();
listApps = (ListView)findViewById(R.id.applistview); listApps = (ListView)findViewById(R.id.applistview);
Button btnSave = (Button)findViewById(R.id.btnsave);
btnSave.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) {
finish();
}
});
if (!appsLoaded) if (!appsLoaded)
loadApps(); loadApps();
} }

View File

@ -56,9 +56,41 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
setupUI();
} }
private void setupUI ()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean transEnabled = prefs.getBoolean(PREF_TRANSPARENT, false);
if (transEnabled)
{
boolean transAllEnabled = prefs.getBoolean(PREF_TRANSPARENT_ALL, false);
if (transAllEnabled)
{
RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
rb0.setChecked(true);
}
else
{
RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
rb1.setChecked(true);
}
Button next = ((Button)findViewById(R.id.btnWizard2));
next.setEnabled(true);
}
}
private void stepSix(){ private void stepSix(){
@ -85,14 +117,30 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
//Dirty flag variable - improve logic //Dirty flag variable - improve logic
@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();
} }
}); });
RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
RadioButton rb2 = (RadioButton)findViewById(R.id.radio2);
rb1.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) {
context.startActivity(new Intent(context, AppManager.class));
}
});
RadioGroup mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup); RadioGroup mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup);
mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){ mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){
@ -101,14 +149,6 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
public void onCheckedChanged(RadioGroup group, int checkedId){ public void onCheckedChanged(RadioGroup group, int checkedId){
Button next = ((Button)findViewById(R.id.btnWizard2)); Button next = ((Button)findViewById(R.id.btnWizard2));
next.setEnabled(true); next.setEnabled(true);
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showWizardFinal();
}
});
RadioButton rb0 = (RadioButton)findViewById(R.id.radio0); RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
RadioButton rb1 = (RadioButton)findViewById(R.id.radio1); RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
@ -129,23 +169,13 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
else if(rb1.isChecked()) else if(rb1.isChecked())
{ {
flag = 1; flag++;
pEdit.putBoolean(PREF_TRANSPARENT, true); pEdit.putBoolean(PREF_TRANSPARENT, true);
pEdit.putBoolean(PREF_TRANSPARENT_ALL, false); pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
pEdit.putString("radiobutton","rb1"); pEdit.putString("radiobutton","rb1");
pEdit.commit(); pEdit.commit();
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
context.startActivity(new Intent(context, AppManager.class));
}
});
} }
else if(rb2.isChecked()) else if(rb2.isChecked())
{ {
@ -188,5 +218,16 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
} }
} }