Search in sources :

Example 6 with OnCheckedChangeListener

use of android.widget.RadioGroup.OnCheckedChangeListener in project httpclient by pixmob.

the class CustomNavigation method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    //Used for theme switching in samples
    setTheme(SampleList.THEME);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text);
    ((TextView) findViewById(R.id.text)).setText(R.string.custom_navigation_content);
    //Inflate the custom view
    View customNav = LayoutInflater.from(this).inflate(R.layout.custom_view, null);
    //Bind to its state change
    ((RadioGroup) customNav.findViewById(R.id.radio_nav)).setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            Toast.makeText(CustomNavigation.this, "Navigation selection changed.", Toast.LENGTH_SHORT).show();
        }
    });
    //Attach to the action bar
    getSupportActionBar().setCustomView(customNav);
    getSupportActionBar().setDisplayShowCustomEnabled(true);
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 7 with OnCheckedChangeListener

use of android.widget.RadioGroup.OnCheckedChangeListener in project MagicCamera by wuhaoyu1990.

the class ImageActivity method initRadioButtons.

private void initRadioButtons() {
    mRadioGroup = (RadioGroup) findViewById(R.id.image_edit_radiogroup);
    mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            switch(checkedId) {
                case R.id.image_edit_adjust:
                    if (!mFragments[2].isAdded())
                        getFragmentManager().beginTransaction().add(R.id.image_edit_fragment_container, mFragments[2]).show(mFragments[2]).commit();
                    else
                        getFragmentManager().beginTransaction().show(mFragments[2]).commit();
                    mFragmentTag = 2;
                    break;
                case R.id.image_edit_filter:
                    if (!mFragments[3].isAdded())
                        getFragmentManager().beginTransaction().add(R.id.image_edit_fragment_container, mFragments[3]).show(mFragments[3]).commit();
                    else
                        getFragmentManager().beginTransaction().show(mFragments[3]).commit();
                    mFragmentTag = 3;
                    break;
                case R.id.image_edit_frame:
                    if (!mFragments[4].isAdded())
                        getFragmentManager().beginTransaction().add(R.id.image_edit_fragment_container, mFragments[4]).show(mFragments[4]).commit();
                    else
                        getFragmentManager().beginTransaction().show(mFragments[4]).commit();
                    mFragmentTag = 4;
                    break;
                case R.id.image_edit_adds:
                    if (!mFragments[1].isAdded())
                        getFragmentManager().beginTransaction().add(R.id.image_edit_fragment_container, mFragments[1]).show(mFragments[1]).commit();
                    else
                        getFragmentManager().beginTransaction().show(mFragments[1]).commit();
                    mFragmentTag = 1;
                    break;
                case R.id.image_edit_beauty:
                    if (!mFragments[0].isAdded())
                        getFragmentManager().beginTransaction().add(R.id.image_edit_fragment_container, mFragments[0]).show(mFragments[0]).commit();
                    else
                        getFragmentManager().beginTransaction().show(mFragments[0]).commit();
                    mFragmentTag = 0;
                    break;
                default:
                    if (mFragmentTag != -1)
                        getFragmentManager().beginTransaction().hide(mFragments[mFragmentTag]).commit();
                    mFragmentTag = -1;
                    break;
            }
        }
    });
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup)

Example 8 with OnCheckedChangeListener

use of android.widget.RadioGroup.OnCheckedChangeListener in project MagicCamera by wuhaoyu1990.

the class ImageEditAdjustView method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRadioGroup = (RadioGroup) getView().findViewById(R.id.fragment_adjust_radiogroup);
    mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            if (checkedId != -1)
                mLinearLayout.setVisibility(View.VISIBLE);
            switch(checkedId) {
                case R.id.fragment_radio_contrast:
                    type = MagicFilterType.CONTRAST;
                    mSeekBar.reset();
                    mSeekBar.setSeekLength(-100, 100, -50, 1);
                    mSeekBar.setValue(contrast);
                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_contrast);
                    break;
                case R.id.fragment_radio_exposure:
                    type = MagicFilterType.EXPOSURE;
                    mSeekBar.reset();
                    mSeekBar.setSeekLength(-100, 100, 0, 1);
                    mSeekBar.setValue(exposure);
                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_exposure);
                    break;
                case R.id.fragment_radio_saturation:
                    type = MagicFilterType.SATURATION;
                    mSeekBar.reset();
                    mSeekBar.setSeekLength(-100, 100, 0, 1);
                    mSeekBar.setValue(saturation);
                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_saturation);
                    break;
                case R.id.fragment_radio_sharpness:
                    type = MagicFilterType.SHARPEN;
                    mSeekBar.reset();
                    mSeekBar.setSeekLength(-100, 100, 0, 1);
                    mSeekBar.setValue(sharpness);
                    mLabel.setBackgroundResource(R.drawable.selector_image_edit_adjust_saturation);
                    break;
                case R.id.fragment_radio_bright:
                    type = MagicFilterType.BRIGHTNESS;
                    mSeekBar.reset();
                    mSeekBar.setSeekLength(-100, 100, 0, 1);
                    mSeekBar.setValue(brightness);
                    break;
                case R.id.fragment_radio_hue:
                    type = MagicFilterType.HUE;
                    mSeekBar.reset();
                    mSeekBar.setSeekLength(0, 360, 0, 1);
                    mSeekBar.setValue(hue);
                    break;
                default:
                    break;
            }
        }
    });
    mSeekBar = (TwoLineSeekBar) view.findViewById(R.id.item_seek_bar);
    mSeekBar.setOnSeekChangeListener(mOnSeekChangeListener);
    mVal = (TextView) view.findViewById(R.id.item_val);
    mLabel = (ImageView) view.findViewById(R.id.item_label);
    mLinearLayout = (LinearLayout) view.findViewById(R.id.seek_bar_item_menu);
    mMagicDisplay.setFilter(MagicFilterType.IMAGE_ADJUST);
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup)

Example 9 with OnCheckedChangeListener

use of android.widget.RadioGroup.OnCheckedChangeListener 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)

Example 10 with OnCheckedChangeListener

use of android.widget.RadioGroup.OnCheckedChangeListener in project ActionBarSherlock by JakeWharton.

the class CustomNavigation method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    //Used for theme switching in samples
    setTheme(SampleList.THEME);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.text);
    ((TextView) findViewById(R.id.text)).setText(R.string.custom_navigation_content);
    //Inflate the custom view
    View customNav = LayoutInflater.from(this).inflate(R.layout.custom_view, null);
    //Bind to its state change
    ((RadioGroup) customNav.findViewById(R.id.radio_nav)).setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            Toast.makeText(CustomNavigation.this, "Navigation selection changed.", Toast.LENGTH_SHORT).show();
        }
    });
    //Attach to the action bar
    getSupportActionBar().setCustomView(customNav);
    getSupportActionBar().setDisplayShowCustomEnabled(true);
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

RadioGroup (android.widget.RadioGroup)13 OnCheckedChangeListener (android.widget.RadioGroup.OnCheckedChangeListener)13 View (android.view.View)5 TextView (android.widget.TextView)5 RadioButton (android.widget.RadioButton)4 Paint (android.graphics.Paint)2 LayoutParams (android.view.ViewGroup.LayoutParams)2 CheckBox (android.widget.CheckBox)2 LinearLayout (android.widget.LinearLayout)2 Account (android.accounts.Account)1 AccountManager (android.accounts.AccountManager)1 SuppressLint (android.annotation.SuppressLint)1 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 Resources (android.content.res.Resources)1 Bundle (android.os.Bundle)1 Button (android.widget.Button)1 CompoundButton (android.widget.CompoundButton)1 ImageView (android.widget.ImageView)1 ListView (android.widget.ListView)1