Search in sources :

Example 51 with RadioGroup

use of android.widget.RadioGroup in project android_frameworks_base by DirtyUnicorns.

the class HugeBackupActivity method populateUI.

/**
     * Configure the UI based on our persistent data, creating the
     * data file and establishing defaults if necessary.
     */
void populateUI() {
    RandomAccessFile file;
    // Default values in case there's no data file yet
    int whichFilling = R.id.pastrami;
    boolean addMayo = false;
    boolean addTomato = false;
    /** Hold the data-access lock around access to the file */
    synchronized (HugeBackupActivity.sDataLock) {
        boolean exists = mDataFile.exists();
        try {
            file = new RandomAccessFile(mDataFile, "rw");
            if (exists) {
                Log.v(TAG, "datafile exists");
                whichFilling = file.readInt();
                addMayo = file.readBoolean();
                addTomato = file.readBoolean();
                Log.v(TAG, "  mayo=" + addMayo + " tomato=" + addTomato + " filling=" + whichFilling);
            } else {
                // The default values were configured above: write them
                // to the newly-created file.
                Log.v(TAG, "creating default datafile");
                writeDataToFileLocked(file, addMayo, addTomato, whichFilling);
                // We also need to perform an initial backup; ask for one
                mBackupManager.dataChanged();
            }
        } catch (IOException ioe) {
        }
    }
    /** Now that we've processed the file, build the UI outside the lock */
    mFillingGroup.check(whichFilling);
    mAddMayoCheckbox.setChecked(addMayo);
    mAddTomatoCheckbox.setChecked(addTomato);
    /**
         * We also want to record the new state when the user makes changes,
         * so install simple observers that do this
         */
    mFillingGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        public void onCheckedChanged(RadioGroup group, int checkedId) {
            // As with the checkbox listeners, rewrite the
            // entire state file
            Log.v(TAG, "New radio item selected: " + checkedId);
            recordNewUIState();
        }
    });
    CompoundButton.OnCheckedChangeListener checkListener = new CompoundButton.OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // Whichever one is altered, we rewrite the entire UI state
            Log.v(TAG, "Checkbox toggled: " + buttonView);
            recordNewUIState();
        }
    };
    mAddMayoCheckbox.setOnCheckedChangeListener(checkListener);
    mAddTomatoCheckbox.setOnCheckedChangeListener(checkListener);
}
Also used : RandomAccessFile(java.io.RandomAccessFile) RadioGroup(android.widget.RadioGroup) IOException(java.io.IOException) CompoundButton(android.widget.CompoundButton)

Example 52 with RadioGroup

use of android.widget.RadioGroup in project android_frameworks_base by DirtyUnicorns.

the class NotificationBuilderTest method getRadioTag.

private String getRadioTag(int id) {
    final RadioGroup g = (RadioGroup) findViewById(id);
    final View v = findViewById(g.getCheckedRadioButtonId());
    return (String) v.getTag();
}
Also used : RadioGroup(android.widget.RadioGroup) View(android.view.View)

Example 53 with RadioGroup

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

the class ImageEditBeautyView method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    mSkinSmoothView = (RelativeLayout) getView().findViewById(R.id.fragment_beauty_skin);
    mSkinColorView = (RelativeLayout) getView().findViewById(R.id.fragment_beauty_color);
    mRadioGroup = (RadioGroup) getView().findViewById(R.id.fragment_beauty_radiogroup);
    mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            switch(checkedId) {
                case R.id.fragment_beauty_btn_skinsmooth:
                    mSkinSmoothView.setVisibility(View.VISIBLE);
                    mSkinColorView.setVisibility(View.GONE);
                    break;
                case R.id.fragment_beauty_btn_skincolor:
                    mSkinColorView.setVisibility(View.VISIBLE);
                    mSkinSmoothView.setVisibility(View.GONE);
                    break;
                default:
                    break;
            }
        }
    });
    mMagicSDK = MagicSDK.getInstance();
    mMagicSDK.setMagicSDKListener(mMagicSDKListener);
    mSmoothBubbleSeekBar = (BubbleSeekBar) view.findViewById(R.id.fragment_beauty_skin_seekbar);
    mSmoothBubbleSeekBar.setOnBubbleSeekBarChangeListener(mOnSmoothBubbleSeekBarChangeListener);
    mWhiteBubbleSeekBar = (BubbleSeekBar) view.findViewById(R.id.fragment_beauty_white_seekbar);
    mWhiteBubbleSeekBar.setOnBubbleSeekBarChangeListener(mOnColorBubbleSeekBarChangeListener);
    init();
    super.onViewCreated(view, savedInstanceState);
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup)

Example 54 with RadioGroup

use of android.widget.RadioGroup 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);
    MagicEngine.getInstance().setFilter(MagicFilterType.IMAGE_ADJUST);
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup)

Example 55 with RadioGroup

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

the class ImageEditBeautyView method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    mSkinSmoothView = (RelativeLayout) getView().findViewById(R.id.fragment_beauty_skin);
    mSkinColorView = (RelativeLayout) getView().findViewById(R.id.fragment_beauty_color);
    mRadioGroup = (RadioGroup) getView().findViewById(R.id.fragment_beauty_radiogroup);
    mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            switch(checkedId) {
                case R.id.fragment_beauty_btn_skinsmooth:
                    mSkinSmoothView.setVisibility(View.VISIBLE);
                    mSkinColorView.setVisibility(View.GONE);
                    break;
                case R.id.fragment_beauty_btn_skincolor:
                    mSkinColorView.setVisibility(View.VISIBLE);
                    mSkinSmoothView.setVisibility(View.GONE);
                    break;
                default:
                    break;
            }
        }
    });
    mSmoothBubbleSeekBar = (TwoLineSeekBar) view.findViewById(R.id.fragment_beauty_skin_seekbar);
    mWhiteBubbleSeekBar = (TwoLineSeekBar) view.findViewById(R.id.fragment_beauty_white_seekbar);
    init();
    super.onViewCreated(view, savedInstanceState);
}
Also used : OnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener) RadioGroup(android.widget.RadioGroup)

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