use of android.widget.CompoundButton in project ActionBarSherlock by JakeWharton.
the class ListMenuItemView method setChecked.
public void setChecked(boolean checked) {
CompoundButton compoundButton;
if (mItemData.isExclusiveCheckable()) {
if (mRadioButton == null) {
insertRadioButton();
}
compoundButton = mRadioButton;
} else {
if (mCheckBox == null) {
insertCheckBox();
}
compoundButton = mCheckBox;
}
compoundButton.setChecked(checked);
}
use of android.widget.CompoundButton in project LeafPic by HoraApps.
the class SettingsActivity method customizePictureViewer.
private void customizePictureViewer() {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_media_viewer_theme, null);
final SwitchCompat swApplyTheme_Viewer = (SwitchCompat) dialogLayout.findViewById(R.id.apply_theme_3th_act_enabled);
((CardView) dialogLayout.findViewById(R.id.third_act_theme_card)).setCardBackgroundColor(getCardBackgroundColor());
//or GetPrimary
dialogLayout.findViewById(R.id.third_act_theme_title).setBackgroundColor(getPrimaryColor());
((TextView) dialogLayout.findViewById(R.id.apply_theme_3thAct_title)).setTextColor(getTextColor());
((TextView) dialogLayout.findViewById(R.id.apply_theme_3thAct_title_Sub)).setTextColor(getSubTextColor());
((IconicsImageView) dialogLayout.findViewById(R.id.ll_apply_theme_3thAct_icon)).setColor(getIconColor());
swApplyTheme_Viewer.setChecked(isApplyThemeOnImgAct());
swApplyTheme_Viewer.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
updateSwitchColor(swApplyTheme_Viewer, getAccentColor());
}
});
updateSwitchColor(swApplyTheme_Viewer, getAccentColor());
final LineColorPicker transparencyColorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.pickerTransparent);
transparencyColorPicker.setColors(ColorPalette.getTransparencyShadows(getPrimaryColor()));
transparencyColorPicker.setSelectedColor(ColorPalette.getTransparentColor(getPrimaryColor(), getTransparency()));
/**TEXT VIEWS**/
((TextView) dialogLayout.findViewById(R.id.seek_bar_alpha_title)).setTextColor(getTextColor());
((TextView) dialogLayout.findViewById(R.id.seek_bar_alpha_title_Sub)).setTextColor(getSubTextColor());
dialogBuilder.setView(dialogLayout);
dialogBuilder.setNeutralButton(getString(R.string.cancel).toUpperCase(), null);
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
SharedPreferences.Editor editor = SP.getEditor();
editor.putBoolean(getString(R.string.preference_apply_theme_pager), swApplyTheme_Viewer.isChecked());
int c = Color.alpha(transparencyColorPicker.getColor());
editor.putInt(getString(R.string.preference_transparency), 255 - c);
editor.commit();
updateTheme();
}
});
dialogBuilder.show();
}
use of android.widget.CompoundButton in project wifikeyboard by IvanVolosyuk.
the class WidgetConfigure method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
setContentView(R.layout.configure);
final EditText editText = (EditText) findViewById(R.id.text);
final CheckBox enabled = (CheckBox) findViewById(R.id.enabled);
Button ok = (Button) findViewById(R.id.ok);
Button cancel = (Button) findViewById(R.id.cancel);
ok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences prefs = getSharedPreferences(PREFS_WIDGETS, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(textEnableProperty(mAppWidgetId), enabled.isChecked());
editor.putString(textStringProperty(mAppWidgetId), editText.getText().toString());
editor.commit();
WidgetProvider.log(WidgetConfigure.this, "Widget " + mAppWidgetId + " configured");
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(WidgetConfigure.this);
updateWidget(WidgetConfigure.this, appWidgetManager, mAppWidgetId);
Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
setResult(RESULT_OK, resultValue);
finish();
}
});
cancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
enabled.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
editText.setEnabled(isChecked);
}
});
Intent resultValue = new Intent();
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
setResult(RESULT_CANCELED, resultValue);
}
use of android.widget.CompoundButton in project android-bootstrap by AndroidBootstrap.
the class ViewUpdater method setChecked.
/**
* Set the checked state of the {@link CompoundButton} with at index
*
* @param childViewIndex
* @param checked
* @return check box
*/
public CompoundButton setChecked(final int childViewIndex, final boolean checked) {
final CompoundButton button = view(childViewIndex);
button.setChecked(checked);
return button;
}
use of android.widget.CompoundButton in project android-bootstrap by AndroidBootstrap.
the class ViewUpdater method setChecked.
/**
* Set the checked state of the {@link CompoundButton} with at index
*
* @param parentView
* @param childViewIndex
* @param checked
* @return check box
*/
public CompoundButton setChecked(final View parentView, final int childViewIndex, final boolean checked) {
final CompoundButton button = view(parentView, childViewIndex);
button.setChecked(checked);
return button;
}
Aggregations