Newer
Older
RxSprout / app / src / main / res / layout / rf_activity_room_create.xml
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">

    <data>

        <variable
            name="viewModel"
            type="com.example.sprout.refactor.viewmodel.RoomCreateViewModel" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="@dimen/margin_small"
        android:orientation="vertical">

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/room_name"
            android:text="@={viewModel.roomName}" />

        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="@={viewModel.hasPass}"
            android:text="@string/password" />

        <EditText
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/password"
            android:text="@={viewModel.pass}"
            android:visibility="@{viewModel.hasPass.get() ? android.view.View.VISIBLE : android.view.View.GONE}" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="@{() -> viewModel.onClickCreate(viewModel.roomName.get(),viewModel.pass.get())}"
            android:text="@string/create" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="@{() -> viewModel.onClickBack()}"
            android:text="@string/back" />
    </LinearLayout>
</layout>