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

    <data>

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

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="@dimen/margin_small">

        <android.support.v7.widget.RecyclerView
            setRoomMainAdapter="@{viewModel.adapter}"
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_marginBottom="@dimen/margin_tiny"
            app:layout_constraintBottom_toTopOf="@id/btn_exit"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <Button
            android:id="@+id/btn_exit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:enabled="@{viewModel.ready.get()?false:true}"
            android:onClick="@{() -> viewModel.onClickExit()}"
            android:text="退出"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent" />

        <Button
            android:id="@+id/btn_ready"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginEnd="@dimen/margin_tiny"
            android:onClick="@{() -> viewModel.onClickReady()}"
            android:text="@{viewModel.ready.get() ? @string/unReady:@string/ready}"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@id/btn_exit" />

        <Button
            android:id="@+id/btn_gunman"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="@{() -> viewModel.onClickGunman()}"
            android:text="ガンマン"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/margin_tiny"
            android:onClick="@{() -> viewModel.onClickWitch()}"
            android:text="ウィッチ"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toEndOf="@id/btn_gunman" />

    </android.support.constraint.ConstraintLayout>
</layout>