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);
}
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();
}
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);
}
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);
}
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);
}
Aggregations