I am writing some BindingAdapters and I have two adapters that need to know same value (Both are meant for same view). So I tried this without success:
@BindingAdapter({"param1", "param2"})
@BindingAdapter({"param3", "param2"})
Is this not possible? It seems like under the hood somehow param2 gets lost before the compiler can create code for the second binding (On the same View instance).
Question: Is this just insanely wrong way to try to use BindingAdapters?
EIDT: This is how i bound the view:
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
app:param1="@{...}"
app:param2="@{...}"
app:param3="@{...}"
/>
And I expected it to match and run both binding adapters. Reading the documentation it seems to me now, each parameter can only be used for one match.
If I understand your problem correctly, you should be able to handle your problem by defining a binding adapter for all three params and delegate it to the other methods. Like this you'll also have the bindings for the param pairs available when one is not set.
@BindingAdapter({"param1", "param2", "param3"})
public static void bind123(TextView view, String param1, String param2, String param3) {
bind12(param1, param2);
bind23(param2, param3);
}
@BindingAdapter({"param1", "param2"})
public static void bind12(TextView view, String param1, String param2) { ... }
@BindingAdapter({"param2", "param3"})
public static void bind23(TextView view, String param2, String param3) { ... }