Skip to content

Instantly share code, notes, and snippets.

@TheBotBox
Created June 7, 2020 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TheBotBox/e7a985fce7f8fb375f0c541d900a61fe to your computer and use it in GitHub Desktop.
Save TheBotBox/e7a985fce7f8fb375f0c541d900a61fe to your computer and use it in GitHub Desktop.
<layout>
<data>
<variable
name="viewModel"
type="com.thebotbox.letsmvvm.presentation.viewmodel.MainViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".presentation.activity.MainActivity">
<TextView
android:id="@+id/quote"
android:layout_width="0dp"
android:layout_height="0dp"
android:gravity="center"
android:textColor="@android:color/black"
app:layout_constraintDimensionRatio="W,1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/fetchQuote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="@{_->viewModel.fetchQuoteFromServer()}"
android:text="@string/fetch_quote"
app:layout_constraintBottom_toTopOf="@id/addToDb"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/addToDb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="@{_->viewModel.addQuoteToDB()}"
android:text="@string/save_to_db"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment