title: How to create Binding Adapter for material.Slider view?
body: <p>My goal is to 2-way databind material.Slider view to MutableLiveData from my viewmodel:</p>
  
  <pre><code>   &lt;com.google.android.material.slider.Slider
          ...
          android:value="@={viewmodel.fps}"
          ...
      /&gt;
  </code></pre>
  
  <p>Of course, it's not working because there is no databinding adapter for Slider in androidx.databinding library</p>
  
  <pre><code>[databinding] Cannot find a getter for &lt;com.google.android.material.slider.Slider android:value&gt; that accepts parameter type &lt;java.lang.Integer&gt;. If a binding adapter provides the getter, check that the adapter is annotated correctly and that the parameter type matches.
  </code></pre>
  
  <p>But, they have one for SeekBar: <a href="https://android.googlesource.com/platform/frameworks/data-binding/+/refs/heads/studio-master-dev/extensions/baseAdapters/src/main/java/androidx/databinding/adapters/SeekBarBindingAdapter.java" rel="noreferrer">/androidx/databinding/adapters/SeekBarBindingAdapter.java</a></p>
  
  <p>As I understand, 2-way databinding should work only with "progress" attribute, and 1-way databinding requires two attributes: "onChanged" and "progress"</p>
  
  <p>I made a try to adapt SeekBarBindingAdapter for Slider:</p>
  
  <pre><code>    @InverseBindingMethods({
              @InverseBindingMethod(type = Slider.class, attribute = "android:value"),
      })
      public class SliderBindingAdapter {
          @BindingAdapter("android:value")
          public static void setValue(Slider view, int value) {
              if (value != view.getValue()) {
                  view.setValue(value);
              }
          }
  
  @BindingAdapter(value = {"android:valueAttrChanged", "android:onValueChange"}, requireAll = false)
      public static void setOnSliderChangeListener(Slider view, final Slider.OnChangeListener valChanged, final InverseBindingListener attrChanged) {
          if (valChanged == null)
              view.addOnChangeListener(null);
          else
              view.addOnChangeListener((slider, value, fromUser) -&gt; {
                  if (valChanged != null)
                      valChanged.onValueChange(slider, value, fromUser);
              });
  
  
          if (attrChanged != null) {
              attrChanged.onChange();
          }
      }
  
      @Override
      public void onValueChange(@NonNull Slider slider, float value, boolean fromUser) {
  
      }
  </code></pre>
  
  <p>It's not building:</p>
  
  <pre><code>Could not find event android:valueAttrChanged on View type Slider
  </code></pre>
  
  <p>but why it looks for valueAttrChanged if I only use</p>
  
  <pre><code>android:value="@={viewmodel.fps}"
  </code></pre>
  
  <p>?</p>
  
  <p>How do I find the right attribute to add to BindingAdapter, if I don't see valueAttrChanged in Slider class?</p>