use of carbon.widget.CheckBox in project Carbon by ZieIony.
the class Samples method initToolbar.
public static void initToolbar(final Activity activity, String title) {
final DebugOverlay overlay = new DebugOverlay(activity);
Toolbar toolbar = (Toolbar) activity.findViewById(R.id.toolbar);
toolbar.setTitle(title);
final ImageView debug = (ImageView) activity.findViewById(R.id.debug);
if (debug != null) {
debug.setTint(Carbon.getThemeColor(activity, R.attr.carbon_colorDisabled));
debug.setOnClickListener(new View.OnClickListener() {
boolean debugEnabled = false;
@Override
public void onClick(View view) {
if (!debugEnabled) {
debug.setTint(Carbon.getThemeColor(activity, R.attr.carbon_iconColor));
overlay.show();
debugEnabled = true;
} else {
debug.setTint(Carbon.getThemeColor(activity, R.attr.carbon_colorDisabled));
overlay.dismiss();
debugEnabled = false;
}
}
});
}
CheckBox checkBox = (CheckBox) activity.findViewById(R.id.enabled);
if (checkBox != null)
checkBox.setOnCheckedChangeListener((compoundButton, checked) -> {
List<View> views = findViewsWithTag((ViewGroup) activity.getWindow().getDecorView().getRootView(), "enable");
for (View v : views) v.setEnabled(checked);
});
}
use of carbon.widget.CheckBox in project Carbon by ZieIony.
the class SnackbarActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_snackbar);
final CheckBox tapCheckBox = (CheckBox) findViewById(R.id.tap);
final CheckBox swipeCheckBox = (CheckBox) findViewById(R.id.swipe);
final CheckBox floatingCheckBox = (CheckBox) findViewById(R.id.floating);
final CheckBox infiniteCheckBox = (CheckBox) findViewById(R.id.infinite);
final CheckBox pushCheckBox = (CheckBox) findViewById(R.id.push);
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
findViewById(R.id.button).setOnClickListener(view -> {
final Snackbar snackbar = new Snackbar(SnackbarActivity.this, "Hello world!", "dismiss", infiniteCheckBox.isChecked() ? Snackbar.INFINITE : getResources().getInteger(R.integer.carbon_snackbarDuration));
snackbar.setOnClickListener(v -> snackbar.dismiss());
snackbar.setStyle(floatingCheckBox.isChecked() ? Snackbar.Style.Floating : Snackbar.Style.Docked);
snackbar.setTapOutsideToDismissEnabled(tapCheckBox.isChecked());
snackbar.setSwipeToDismissEnabled(swipeCheckBox.isChecked());
if (pushCheckBox.isChecked())
snackbar.addPushedView(fab);
snackbar.show((ViewGroup) getWindow().getDecorView().getRootView());
snackbar.setOnDismissListener(() -> {
});
});
Snackbar.clearQueue();
}
Aggregations