<?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"
tools:context="app.gedama.tutorial.cruddiary.fragment.HomeFragment">
<data>
<variable
name="viewModel"
type="app.gedama.tutorial.cruddiary.viewmodel.HomeViewModel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:rowCount="1"
android:columnCount="2"
android:layout_margin="6dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="fill_horizontal|start|center_vertical"
android:layout_row="0"
android:layout_column="0"
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:text="@string/welcome"
android:textStyle="bold" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_row="0"
android:layout_column="1"
android:gravity="end"
android:layout_marginEnd="0dp"
android:layout_gravity="center_vertical"
android:contentDescription="@string/logo_description"
android:src="@mipmap/ic_launcher" />
</GridLayout>
<androidx.cardview.widget.CardView
android:id="@+id/cardViewTasks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="6dp"
app:cardBackgroundColor="?attr/active_background_color"
app:cardElevation="4dp"
app:cardCornerRadius="4dp"
android:onClick="@{ () -> viewModel.onEntriesClicked() }">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:stretchColumns="*">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/numberOfDiaryEntriesLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:textStyle="bold"
android:text="@string/home_heading_diary_entries" />
<TextView
android:id="@+id/numberOfDiaryEntries"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:layout_gravity="end"
android:textStyle="bold"
tools:text="12"
android:text="@{viewModel.numberOfDiaryEntries.toString()}"/>
</TableRow>
</TableLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="bottom|center"
android:orientation="vertical">
<com.google.android.material.button.MaterialButton
android:id="@+id/reward_ad_button"
android:visibility="visible"
android:layout_marginBottom="10dp"
android:text="@string/ad_reward_button"
tools:visibility="visible"
app:icon="@drawable/baseline_ads_click_24"
style="@style/CrudDiary_Button" />
<TextView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Banner Ad" />
</LinearLayout>
</LinearLayout>
</layout>