use of carbon.internal.DebugOverlay 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);
});
}
Aggregations