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:textStyle="bold"
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_height="wrap_content"
android:autoLink="web"

View File

@ -1,9 +1,19 @@
<?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:"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:padding="3px" />
<ListView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/applistview"></ListView>
</LinearLayout>
android:padding="3px"
android:layout_above="@+id/applistview"
/>
-->
<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.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
@ -55,8 +56,6 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
mAppManager = this;
}
@ -66,6 +65,16 @@ public class AppManager extends Activity implements OnCheckedChangeListener, OnC
super.onResume();
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)
loadApps();
}

View File

@ -39,7 +39,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
{
super.onCreate(savedInstanceState);
context = this;
}
@Override
@ -56,9 +56,41 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
protected void 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(){
@ -85,13 +117,29 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
//Dirty flag variable - improve logic
@Override
public void onClick(View v) {
if( flag == 1 )
context.startActivity(new Intent(context, AppManager.class));
else
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);
mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){
@ -101,14 +149,6 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
public void onCheckedChanged(RadioGroup group, int checkedId){
Button next = ((Button)findViewById(R.id.btnWizard2));
next.setEnabled(true);
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showWizardFinal();
}
});
RadioButton rb0 = (RadioButton)findViewById(R.id.radio0);
RadioButton rb1 = (RadioButton)findViewById(R.id.radio1);
@ -129,23 +169,13 @@ public class ConfigureTransProxy extends Activity implements TorConstants {
else if(rb1.isChecked())
{
flag = 1;
flag++;
pEdit.putBoolean(PREF_TRANSPARENT, true);
pEdit.putBoolean(PREF_TRANSPARENT_ALL, false);
pEdit.putString("radiobutton","rb1");
pEdit.commit();
next.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
context.startActivity(new Intent(context, AppManager.class));
}
});
}
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);
}
}