<?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"
    xmlns:tools="http://schemas.android.com/tools">

    <data>
        <variable
            name="vm"
            type="co.huggingface.android_transformers.gpt2.ml.GPT2Client"/>
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">

        <com.google.android.material.button.MaterialButton
            android:id="@+id/shuffle_button"
            style="@style/Widget.MaterialComponents.Button.TextButton.Icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Shuffle prompt text"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            android:layout_marginTop="30dp"
            app:icon="@drawable/ic_shuffle_black_24dp"
            android:onClick="@{() -> vm.refreshPrompt()}"/>

        <com.google.android.material.button.MaterialButton
            android:id="@+id/autocomplete_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="16sp"
            android:text="Trigger autocomplete"
            app:layout_constraintTop_toBottomOf="@id/shuffle_button"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            android:onClick="@{() -> vm.launchAutocomplete()}"/>

        <TextView
            android:id="@+id/prompt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="50dp"
            android:padding="30dp"
            android:textColor="@color/colorOnPrimary"
            android:textSize="16sp"
            app:completion="@{vm.completion}"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@id/autocomplete_button"
            app:lineHeight="22sp"
            app:prompt="@{vm.prompt}"
            tools:text="@tools:sample/lorem/random" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>
