commit fbdeb71974a4ea3567b5f6cb7b6962ab9c5a19cf Author: Sathyanarayanan Gunasekaran gsathya.ceg@gmail.com Date: Mon Jun 13 15:40:34 2011 +0530
Updated RadioButtons in ConfigureTransProxy
All the RadioButtons are unchecked by default. The next button is disabled until a RadioButton is checked. --- res/layout/layout_wizard_root.xml | 2 +- .../torproject/android/ConfigureTransProxy.java | 52 +++++++++++--------- 2 files changed, 29 insertions(+), 25 deletions(-)
diff --git a/res/layout/layout_wizard_root.xml b/res/layout/layout_wizard_root.xml index 4c64035..443106e 100644 --- a/res/layout/layout_wizard_root.xml +++ b/res/layout/layout_wizard_root.xml @@ -42,7 +42,7 @@ android:padding="3px"> <TextView android:text="@string/wizard_transproxy_msg" android:layout_width="wrap_content" android:textColor="#ffffff" android:layout_height="wrap_content" android:textSize="8pt" android:id="@+id/WizardTextBody1" android:padding="20dip"></TextView> <RadioGroup android:id="@+id/radioGroup" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingLeft="15dip"> - <RadioButton android:checked="true" android:text="@string/wizard_configure_all" android:id="@+id/radio0" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton> + <RadioButton android:text="@string/wizard_configure_all" android:id="@+id/radio0" android:layout_height="wrap_content" android:layout_width="wrap_content"></RadioButton> <TextView android:layout_height="wrap_content" android:text="@string/wizard_transproxy_hint" android:layout_width="wrap_content" diff --git a/src/org/torproject/android/ConfigureTransProxy.java b/src/org/torproject/android/ConfigureTransProxy.java index 4e9405b..d515aae 100644 --- a/src/org/torproject/android/ConfigureTransProxy.java +++ b/src/org/torproject/android/ConfigureTransProxy.java @@ -57,6 +57,32 @@ public class ConfigureTransProxy extends Activity implements TorConstants { String title = context.getString(R.string.wizard_transproxy_title); TextView txtTitle = ((TextView)findViewById(R.id.WizardTextTitle)); txtTitle.setText(title); + + Button back = ((Button)findViewById(R.id.btnWizard1)); + Button next = ((Button)findViewById(R.id.btnWizard2)); + next.setEnabled(false); + + back.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + + startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1); + } + }); + + next.setOnClickListener(new View.OnClickListener() { + + //Dirty flag variable - improve logic + @Override + public void onClick(View v) { + if( flag == 1 ) + context.startActivity(new Intent(context, AppManager.class)); + + else + showWizardFinal(); + } + }); RadioGroup mRadioGroup = (RadioGroup)findViewById(R.id.radioGroup); mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener (){ @@ -65,6 +91,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants { @Override public void onCheckedChanged(RadioGroup group, int checkedId){ Button next = ((Button)findViewById(R.id.btnWizard2)); + next.setEnabled(true); next.setOnClickListener(new View.OnClickListener() { @Override @@ -120,30 +147,7 @@ public class ConfigureTransProxy extends Activity implements TorConstants { } });
- Button back = ((Button)findViewById(R.id.btnWizard1)); - Button next = ((Button)findViewById(R.id.btnWizard2)); - - back.setOnClickListener(new View.OnClickListener() { - - @Override - public void onClick(View v) { - - startActivityForResult(new Intent(getBaseContext(), Permissions.class), 1); - } - }); - - next.setOnClickListener(new View.OnClickListener() { - - //Dirty flag variable - improve logic - @Override - public void onClick(View v) { - if( flag == 1 ) - context.startActivity(new Intent(context, AppManager.class)); - - else - showWizardFinal(); - } - }); + } private void showWizardFinal ()