@Override
    public void onBindViewHolder(@NonNull final PreferenceViewHolder holder) {
        super.onBindViewHolder(holder);
        holder.setDividerAllowedAbove(false);
        button = (ImageView) holder.findViewById(R.id.widget_action);
        hideButton(buttonHidden);
        button.setOnClickListener(v -> {
            if (!buttonHidden) {
                hideButton(true);
                if (callback != null) {
                    callback.run();
                }
            }
        });
    }
ButtonPreference:
Regular preference, displaying a button in the widget area.
<br>
Buttons defaults to "add" symbol, but can be set via app:src="res-id" in preferences xml file.
<br>
Use setCallback() to define a callback function for the widget's button.
Use hideButton() to hide or show the widget's button.
main/src/main/java/cgeo/geocaching/settings/ButtonPreference.java