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);
}
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);
}
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);
}
}
});
}
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);
}
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();
}
});
}
Aggregations