Search in sources :

Example 56 with RadioGroup

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();
        }
    });
}
Also used : RadioGroup(android.widget.RadioGroup) RadioButton(android.widget.RadioButton) Button(android.widget.Button) Intent(android.content.Intent) RadioButton(android.widget.RadioButton) View(android.view.View)

Example 57 with RadioGroup

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.
}
Also used : RadioGroup(android.widget.RadioGroup) View(android.view.View) Fragment(android.support.v4.app.Fragment) FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) Button(android.widget.Button)

Example 58 with RadioGroup

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;
}
Also used : RadioGroup(android.widget.RadioGroup) TextView(android.widget.TextView) RadioButton(android.widget.RadioButton) TextView(android.widget.TextView) View(android.view.View) Nullable(android.support.annotation.Nullable)

Example 59 with RadioGroup

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);
}
Also used : RadioGroup(android.widget.RadioGroup) RadioButton(android.widget.RadioButton)

Example 60 with RadioGroup

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;
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup) TextView(android.widget.TextView) View(android.view.View) Paint(android.graphics.Paint)

Aggregations

RadioGroup (android.widget.RadioGroup)70 View (android.view.View)30 TextView (android.widget.TextView)23 RadioButton (android.widget.RadioButton)17 OnCheckedChangeListener (android.widget.RadioGroup.OnCheckedChangeListener)13 Button (android.widget.Button)10 CompoundButton (android.widget.CompoundButton)9 Validator (com.mobsandgeeks.saripaar.Validator)8 DialogInterface (android.content.DialogInterface)7 EditText (android.widget.EditText)7 Intent (android.content.Intent)6 AlertDialog (android.support.v7.app.AlertDialog)6 CheckBox (android.widget.CheckBox)6 LinearLayout (android.widget.LinearLayout)6 ImageView (android.widget.ImageView)5 IOException (java.io.IOException)5 RandomAccessFile (java.io.RandomAccessFile)5 Test (org.junit.Test)5 CardView (android.support.v7.widget.CardView)4 ScrollView (android.widget.ScrollView)4