SeslShowButtonShapesHelper
Helper class for implementing the Samsung "Show button shapes" feature.
This class assists in dynamically changing the background of a View based on the "show_button_background" system setting. It allows specifying different drawables for when the setting is enabled or disabled.
Usage:
SeslShowButtonShapesHelper helper = new SeslShowButtonShapesHelper(
myButton,
ContextCompat.getDrawable(getContext(), R.drawable.button_background_on),
ContextCompat.getDrawable(getContext(), R.drawable.button_background_off)
);
helper.updateButtonBackground(); // Initial update
// To listen for changes in the setting (optional, but recommended for dynamic updates):
ContentObserver observer = new ContentObserver(new Handler()) {
public void onChange(boolean selfChange) {
helper.updateButtonBackground();
}
};
getContentResolver().registerContentObserver(
Settings.Global.getUriFor("show_button_background"),
false,
observer
);
Content copied to clipboard