Reputation: 7060
I am trying to integrate this library. I got an issue of "missing attributes", so I added these attributes to my project:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<declare-styleable name="app">
<attr name="isDone" format="boolean"/>
<attr name="isVisible" format="boolean"/>
</declare-styleable>
</resources>
After that I when I cleaned the project and run the build process again, I got this issue:
error: '@{viewModel.hasStartDate}' is incompatible with attribute com.example:isVisible (attr) reference [weak].
Message{kind=ERROR, text=error: '@{viewModel.hasStartDate}' is incompatible with attribute com.example:isVisible (attr) reference [weak]., sources=[/home/local/<USER_NAME>/.gradle/caches/transforms-1/files-1.1/DateTimeRangePicker-v1.3.aar/524561517fca999eba7db795be3a768d/res/layout/date_time_range_picker.xml:52], original message=, tool name=Optional.of(AAPT)}
At some places, one of which is this line in layout file generated by that library which used Data binding:
app:isDone="@{viewModel.isCompletable}"
Inside the Kotlin code generated by that library, it is declared:
val isCompletable = ObservableBoolean()
This library is in Kotlin. What is causing it?
Is it KAPT? Is it Data binding?
Upvotes: 0
Views: 2554
Reputation: 73
Xml layout
<android.support.design.widget.TextInputLayout
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
app:error=”@{loginInfo.passwordError}”>
<EditText
android:id=”@+id/password”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:enabled=”@{loginInfo.existingUser}”
android:hint=”@string/password”
android:inputType=”textPassword”
app:binding=”@{loginInfo.password}”/>
</android.support.design.widget.TextInputLayout>
Model class
public class LoginInfo {
public BindableBoolean existingUser = new BindableBoolean();
}
BindableBoolean class
import org.parceler.Parcel;
@Parcel
public class BindableBoolean extends BaseObservable {
boolean mValue;
public boolean get() {
return mValue;
}
public void set(boolean value) {
if (mValue != value) {
this.mValue = value;
notifyChange();
}
}
}
Upvotes: 0
Reputation: 7060
Declared attributes must be of the string
type
<attr name="isDone" format="string"/>
<attr name="isVisible" format="string"/>
Upvotes: 1