Search in sources :

Example 16 with RadioGroup

use of android.widget.RadioGroup in project robolectric by robolectric.

the class ShadowRadioGroupTest method checkedRadioButtonId.

@Test
public void checkedRadioButtonId() throws Exception {
    RadioGroup radioGroup = new RadioGroup(RuntimeEnvironment.application);
    assertThat(radioGroup.getCheckedRadioButtonId()).isEqualTo(-1);
    radioGroup.check(99);
    assertThat(radioGroup.getCheckedRadioButtonId()).isEqualTo(99);
}
Also used : RadioGroup(android.widget.RadioGroup) Test(org.junit.Test)

Example 17 with RadioGroup

use of android.widget.RadioGroup in project robolectric by robolectric.

the class ShadowRadioGroupTest method clearCheck_shouldCallOnCheckedChangeListenerTwice.

@Test
public void clearCheck_shouldCallOnCheckedChangeListenerTwice() throws Exception {
    RadioGroup radioGroup = new RadioGroup(RuntimeEnvironment.application);
    TestOnCheckedChangeListener listener = new TestOnCheckedChangeListener();
    radioGroup.check(BUTTON_ID);
    radioGroup.setOnCheckedChangeListener(listener);
    radioGroup.clearCheck();
    assertEquals(Arrays.asList(-1), listener.onCheckedChangedCheckedIds);
    assertEquals(Arrays.asList(radioGroup), listener.onCheckedChangedGroups);
}
Also used : RadioGroup(android.widget.RadioGroup) Test(org.junit.Test)

Example 18 with RadioGroup

use of android.widget.RadioGroup in project android-saripaar by ragunathjawahar.

the class UnorderedSequencingActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_un_ordered_sequencing);
    // UI References
    mNameEditText = (EditText) findViewById(R.id.nameEditText);
    mAddressEditText = (EditText) findViewById(R.id.addressEditText);
    mEmailEditText = (EditText) findViewById(R.id.emailEditText);
    mPhoneEditText = (EditText) findViewById(R.id.phoneEditText);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    RadioGroup modeRadioGroup = (RadioGroup) findViewById(R.id.modeRadioGroup);
    Button saripaarButton = (Button) findViewById(R.id.saripaarButton);
    // Validator
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
    // Event listeners
    modeRadioGroup.setOnCheckedChangeListener(this);
    saripaarButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            try {
                mValidator.validate();
            } catch (IllegalStateException e) {
                mResultTextView.setText(R.string.crash);
            }
        }
    });
}
Also used : RadioGroup(android.widget.RadioGroup) Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) Validator(com.mobsandgeeks.saripaar.Validator)

Example 19 with RadioGroup

use of android.widget.RadioGroup in project android-saripaar by ragunathjawahar.

the class UnorderedValidateBeforeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_un_ordered_validate_till_before);
    // UI References
    mNameEditText = (EditText) findViewById(R.id.nameEditText);
    mAddressEditText = (EditText) findViewById(R.id.addressEditText);
    mEmailEditText = (EditText) findViewById(R.id.emailEditText);
    mPhoneEditText = (EditText) findViewById(R.id.phoneEditText);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    RadioGroup modeRadioGroup = (RadioGroup) findViewById(R.id.modeRadioGroup);
    // Validator
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
    // Event listeners
    mNameEditText.setOnFocusChangeListener(this);
    mAddressEditText.setOnFocusChangeListener(this);
    mEmailEditText.setOnFocusChangeListener(this);
    mPhoneEditText.setOnFocusChangeListener(this);
    modeRadioGroup.setOnCheckedChangeListener(this);
}
Also used : RadioGroup(android.widget.RadioGroup) Validator(com.mobsandgeeks.saripaar.Validator)

Example 20 with RadioGroup

use of android.widget.RadioGroup in project android-saripaar by ragunathjawahar.

the class OrderedSequencingActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_un_ordered_sequencing);
    // UI References
    mNameEditText = (EditText) findViewById(R.id.nameEditText);
    mAddressEditText = (EditText) findViewById(R.id.addressEditText);
    mEmailEditText = (EditText) findViewById(R.id.emailEditText);
    mPhoneEditText = (EditText) findViewById(R.id.phoneEditText);
    mResultTextView = (TextView) findViewById(R.id.resultTextView);
    RadioGroup modeRadioGroup = (RadioGroup) findViewById(R.id.modeRadioGroup);
    Button saripaarButton = (Button) findViewById(R.id.saripaarButton);
    // Validator
    mValidator = new Validator(this);
    mValidator.setValidationListener(this);
    // Event listeners
    modeRadioGroup.setOnCheckedChangeListener(this);
    saripaarButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mValidator.validate();
        }
    });
}
Also used : RadioGroup(android.widget.RadioGroup) Button(android.widget.Button) TextView(android.widget.TextView) View(android.view.View) Validator(com.mobsandgeeks.saripaar.Validator)

Aggregations

RadioGroup (android.widget.RadioGroup)62 View (android.view.View)26 TextView (android.widget.TextView)19 RadioButton (android.widget.RadioButton)13 OnCheckedChangeListener (android.widget.RadioGroup.OnCheckedChangeListener)13 Button (android.widget.Button)9 CompoundButton (android.widget.CompoundButton)8 Validator (com.mobsandgeeks.saripaar.Validator)8 CheckBox (android.widget.CheckBox)5 IOException (java.io.IOException)5 RandomAccessFile (java.io.RandomAccessFile)5 Test (org.junit.Test)5 DialogInterface (android.content.DialogInterface)4 Intent (android.content.Intent)4 ImageView (android.widget.ImageView)4 ScrollView (android.widget.ScrollView)4 Paint (android.graphics.Paint)3 AlertDialog (android.support.v7.app.AlertDialog)3 LinearLayout (android.widget.LinearLayout)3 SeekBar (android.widget.SeekBar)3