use of android.widget.RadioGroup in project Small by wequick.
the class PickerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_picker);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final RadioGroup rg = (RadioGroup) findViewById(R.id.radioGroup1);
Button btnPick = (Button) findViewById(R.id.pick_button);
btnPick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent data = new Intent();
RadioButton rb = (RadioButton) findViewById(rg.getCheckedRadioButtonId());
data.putExtra("color", rb.getText());
setResult(RESULT_OK, data);
finish();
}
});
}
use of android.widget.RadioGroup in project HumaneApp by Ganesh1010.
the class DetailsOfQuantitySelected method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
context = DetailsOfQuantitySelected.this;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
DetailsPopulator detailsPopulator = new DetailsPopulator(this);
detailsPopulator.getCountryDetailsFromAPI();
Button edit = (Button) findViewById(R.id.edit_details);
edit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
Button cancel = (Button) findViewById(R.id.cancel_details);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radio_details);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
Fragment fr = null;
switch(i) {
case R.id.doante_by_urself_details:
fr = new EmptyFragment();
break;
case R.id.need_volunteer_details:
fr = new Needvolunteer();
break;
}
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fm.beginTransaction();
fragmentTransaction.replace(R.id.fragment, fr);
fragmentTransaction.commit();
}
});
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
}
use of android.widget.RadioGroup in project SuperToasts by JohnPersano.
the class AttributeRadioGroupFragment method onCreateView.
@Nullable
@Override
@SuppressWarnings("ConstantConditions")
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_attribute_radiogroup, container, false);
// Make sure the Fragment has found its arguments
if (this.getArguments() == null) {
throw new IllegalArgumentException(getClass().getName().concat(" cannot be " + "instantiated without arguments."));
}
final TextView subtitleTextView = (TextView) view.findViewById(R.id.subtitle);
subtitleTextView.setText(getArguments().getString(ARG_SUBTITLE));
final TextView summaryTextView = (TextView) view.findViewById(R.id.summary);
summaryTextView.setText(getArguments().getString(ARG_SUMMARY));
final RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.radiogroup);
for (String string : getArguments().getStringArrayList(ARG_ARRAY)) {
final RadioButton radioButton = new RadioButton(getActivity());
radioButton.setText(string);
radioButton.setId(ViewUtils.generateViewId());
radioGroup.addView(radioButton);
}
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
PreferenceManager.getDefaultSharedPreferences(getActivity()).edit().putInt(getArguments().getString(ARG_TITLE), group.indexOfChild(group.findViewById(group.getCheckedRadioButtonId()))).commit();
}
});
// RadioGroup.check() is misleading, we must check the RadioButton manually
((RadioButton) radioGroup.getChildAt(PreferenceManager.getDefaultSharedPreferences(getActivity()).getInt(getArguments().getString(ARG_TITLE), 0))).setChecked(true);
return view;
}
use of android.widget.RadioGroup in project SwipeToLoadLayout by Aspsine.
the class NavJavaCodeFragment method initDialogView.
private void initDialogView(View view) {
final RadioGroup rgStyle = (RadioGroup) view.findViewById(R.id.rgStyle);
final RadioGroup rgHeader = (RadioGroup) view.findViewById(R.id.rgHeader);
final RadioGroup rgFooter = (RadioGroup) view.findViewById(R.id.rgFooter);
rgStyle.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
for (int i = 0; i < rgStyle.getChildCount(); i++) {
RadioButton rb = (RadioButton) rgStyle.getChildAt(i);
if (rb.isChecked()) {
changeStyle(i);
break;
}
}
}
});
rgHeader.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
for (int i = 0; i < rgHeader.getChildCount(); i++) {
RadioButton rb = (RadioButton) rgHeader.getChildAt(i);
if (rb.isChecked()) {
changeHeader(i);
break;
}
}
}
});
rgFooter.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
for (int i = 0; i < rgFooter.getChildCount(); i++) {
RadioButton rb = (RadioButton) rgFooter.getChildAt(i);
if (rb.isChecked()) {
changeFooter(i);
break;
}
}
}
});
((RadioButton) rgStyle.getChildAt(mStyleNum)).setChecked(true);
((RadioButton) rgHeader.getChildAt(mHeaderNum)).setChecked(true);
((RadioButton) rgFooter.getChildAt(mFooterNum)).setChecked(true);
}
use of android.widget.RadioGroup in project JamsMusicPlayer by psaravan.
the class AlbumArtFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mContext = getActivity().getApplicationContext();
mApp = (Common) mContext;
View rootView = (View) getActivity().getLayoutInflater().inflate(R.layout.fragment_welcome_screen_4, null);
welcomeHeader = (TextView) rootView.findViewById(R.id.welcome_header);
welcomeHeader.setTypeface(TypefaceHelper.getTypeface(getActivity(), "Roboto-Light"));
welcomeText1 = (TextView) rootView.findViewById(R.id.welcome_text_1);
welcomeText1.setTypeface(TypefaceHelper.getTypeface(getActivity(), "Roboto-Regular"));
radioGroup = (RadioGroup) rootView.findViewById(R.id.album_art_radio_group);
mPickWhatsBestRadioButton = (RadioButton) rootView.findViewById(R.id.pick_whats_best_for_me);
mUseEmbeddedArtOnlyRadioButton = (RadioButton) rootView.findViewById(R.id.use_embedded_art_only);
mUseFolderArtOnlyRadioButton = (RadioButton) rootView.findViewById(R.id.use_folder_art_only);
mPickWhatsBestRadioButton.setTypeface(TypefaceHelper.getTypeface(getActivity(), "Roboto-Regular"));
mUseEmbeddedArtOnlyRadioButton.setTypeface(TypefaceHelper.getTypeface(getActivity(), "Roboto-Regular"));
mUseFolderArtOnlyRadioButton.setTypeface(TypefaceHelper.getTypeface(getActivity(), "Roboto-Regular"));
//Check which album art source is selected and set the appropriate flag.
if (mApp.getSharedPreferences().getInt("ALBUM_ART_SOURCE", 0) == 0) {
mPickWhatsBestRadioButton.setChecked(true);
} else if (mApp.getSharedPreferences().getInt("ALBUM_ART_SOURCE", 0) == 1) {
mUseEmbeddedArtOnlyRadioButton.setChecked(true);
} else if (mApp.getSharedPreferences().getInt("ALBUM_ART_SOURCE", 0) == 2) {
mUseFolderArtOnlyRadioButton.setChecked(true);
}
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch(checkedId) {
case R.id.pick_whats_best_for_me:
mApp.getSharedPreferences().edit().putInt("ALBUM_ART_SOURCE", 0).commit();
break;
case R.id.use_embedded_art_only:
mApp.getSharedPreferences().edit().putInt("ALBUM_ART_SOURCE", 1).commit();
break;
case R.id.use_folder_art_only:
mApp.getSharedPreferences().edit().putInt("ALBUM_ART_SOURCE", 2).commit();
break;
}
}
});
return rootView;
}
Aggregations