use of android.widget.RadioButton in project xabber-android by redsolution.
the class ResourceAdapter method getView.
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View view = lInflater.inflate(R.layout.item_user_resource, parent, false);
TextView tvClient = (TextView) view.findViewById(R.id.tvClient);
TextView tvResource = (TextView) view.findViewById(R.id.tvResource);
final RadioButton radioButton = (RadioButton) view.findViewById(R.id.radioButton);
if (position == checkedItem)
radioButton.setChecked(true);
tvClient.setText(items.get(position).get(KEY_CLIENT));
tvResource.setText(items.get(position).get(KEY_RESOURCE));
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
radioButton.setChecked(true);
checkedItem = position;
notifyDataSetChanged();
}
});
return view;
}
use of android.widget.RadioButton in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ZenCustomRadioButtonPreferenceTest method setChecked_shouldUpdateButtonCheckedState.
@Test
public void setChecked_shouldUpdateButtonCheckedState() {
final ZenCustomRadioButtonPreference preference = new ZenCustomRadioButtonPreference(mContext);
final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(LayoutInflater.from(mContext).inflate(R.layout.preference_two_target_radio, null));
final RadioButton toggle = (RadioButton) holder.findViewById(android.R.id.checkbox);
preference.onBindViewHolder(holder);
preference.setChecked(true);
assertThat(toggle.isChecked()).isTrue();
preference.setChecked(false);
assertThat(toggle.isChecked()).isFalse();
}
use of android.widget.RadioButton in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TtsEnginePreference method onBindViewHolder.
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
super.onBindViewHolder(view);
if (mSharedState == null) {
throw new IllegalStateException("Call to getView() before a call to" + "setSharedState()");
}
final RadioButton rb = view.itemView.findViewById(android.R.id.checkbox);
rb.setOnCheckedChangeListener(mRadioChangeListener);
boolean isChecked = getKey().equals(mSharedState.getCurrentKey());
if (isChecked) {
mSharedState.setCurrentChecked(rb);
}
mPreventRadioButtonCallbacks = true;
rb.setChecked(isChecked);
mPreventRadioButtonCallbacks = false;
mRadioButton = rb;
}
use of android.widget.RadioButton in project superCleanMaster by joyoyao.
the class ChangeLanguage method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_change_language);
RadioButton rbtnRussian = (RadioButton) findViewById(R.id.rbtnRussian);
rbtnRussian.setOnClickListener(radioButtonClickListener);
RadioButton rbtnEnglish = (RadioButton) findViewById(R.id.rbtnEnglish);
rbtnEnglish.setOnClickListener(radioButtonClickListener);
RadioButton rbtnSpanish = (RadioButton) findViewById(R.id.rbtnSpanish);
rbtnSpanish.setOnClickListener(radioButtonClickListener);
}
use of android.widget.RadioButton in project zype-android by zype.
the class TracksListAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
Holder holder;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.tracks_row_layout, parent, false);
holder = new Holder((TextView) convertView.findViewById(R.id.text), (RadioButton) convertView.findViewById(R.id.radio));
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
holder.radio.setTag(position);
holder.radio.setChecked(mSelectedPosition == position);
convertView.setOnClickListener(this);
holder.label.setText(mTracks.get(position).getName());
return convertView;
}
Aggregations