<?xml version="1.0" encoding="utf-8"?>
<layout>
    <data>
        <import type="android.view.View" />
        <import type="android.support.v7.widget.LinearLayoutManager" />
        <variable
            name="vm"
            type="com.aaron.kakao.hospitalmapfortube.ui.main.MainViewModel" />
    </data>
    <android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/white"
        tools:context=".ui.main.MainActivity">

        <RelativeLayout
            android:id="@+id/map_layout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toTopOf="@id/location_recyclerView"/>
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="@id/map_layout"
            app:layout_constraintBottom_toBottomOf="@id/map_layout"
            android:layout_marginEnd="10dp"
            android:layout_marginBottom="10dp"
            android:background="@drawable/background_category"
            android:padding="10dp"
            android:orientation="horizontal">

            <Button
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:background="@drawable/category_hospital_selector"
                android:textColor="@drawable/background_category_text_selector"
                android:text="@string/category_hospital"
                android:selected="@{vm.isHospitalEnabled}"
                android:onClick="@{() -> vm.categoryClick(vm.isHospitalEnabled)}" />
            <Button
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:background="@drawable/category_phamarcy_selector"
                android:textColor="@drawable/background_category_text_selector"
                android:layout_marginStart="10dp"
                android:text="@string/category_pharmacy"
                android:selected="@{vm.isPharmacyEnabled}"
                android:onClick="@{() -> vm.categoryClick(vm.isPharmacyEnabled)}" />
            <Button
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:background="@drawable/category_oil_selector"
                android:textColor="@drawable/background_category_text_selector"
                android:layout_marginStart="10dp"
                android:text="@string/category_oil"
                android:selected="@{vm.isOilEnabled}"
                android:onClick="@{() -> vm.categoryClick(vm.isOilEnabled)}" />
        </LinearLayout>
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintTop_toTopOf="@id/map_layout"
            app:layout_constraintStart_toStartOf="@id/map_layout"
            app:layout_constraintEnd_toEndOf="@id/map_layout"
            android:layout_marginTop="15dp"
            android:background="@drawable/background_category"
            android:textColor="@android:color/white"
            android:text="@string/refresh"
            android:visibility="@{vm.isRefreshEnabled ? View.VISIBLE : View.GONE}"
            android:onClick="@{() -> vm.refreshClick()}"/>
        <android.support.v7.widget.RecyclerView
            android:id="@+id/location_recyclerView"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            app:layout_constraintTop_toBottomOf="@id/map_layout"
            app:layout_constraintBottom_toTopOf="@id/more_button"
            android:paddingStart="15dp"
            android:paddingEnd="15dp"
            app:layoutManager="LinearLayoutManager"
            tools:listitem="@layout/item_location"
            android:visibility="@{vm.isShowLocationList ? View.VISIBLE : View.GONE}" />
        <Button
            android:id="@+id/more_button"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toBottomOf="parent"
            android:paddingTop="15dp"
            android:paddingBottom="15dp"
            android:visibility="@{vm.isShowMore() ? View.VISIBLE : View.GONE}"
            android:background="@drawable/background_category"
            android:textColor="@android:color/white"
            android:text="@string/more"
            android:onClick="@{() -> vm.moreClick()}" />
        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintBottom_toBottomOf="parent"
            android:visibility="@{vm.isLoading ? View.VISIBLE : View.GONE}" />

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