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
);

Constructors

Link copied to clipboard
constructor(@NonNull view: View, @Nullable backgroundOn: Drawable, @Nullable backgroundOff: Drawable)

Functions

Link copied to clipboard
open fun setBackgroundOff(@Nullable backgroundOff: Drawable)
Link copied to clipboard
open fun setBackgroundOn(@Nullable backgroundOn: Drawable)
Link copied to clipboard
Link copied to clipboard