<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:id="@+id/coordinator"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:fitsSystemWindows="true">

  <com.google.android.material.appbar.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="?attr/overlay_theme">

    <com.google.android.material.appbar.CollapsingToolbarLayout
      android:id="@+id/collapsing_toolbar_layout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:fitsSystemWindows="true"
      android:theme="@style/ToolbarTheme"
      app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"
      app:contentScrim="@color/content_background"
      app:statusBarScrim="@color/content_background"
      app:titleEnabled="false">

      <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/window_background"
        android:fitsSystemWindows="true"
        app:layout_collapseMode="parallax"
        app:layout_collapseParallaxMultiplier="0.4">

        <FrameLayout
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="0dp"
          app:layout_constraintBottom_toTopOf="@id/select_this_location"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"/>

        <ImageView
          android:id="@+id/google_marker"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="center"
          android:paddingBottom="48dp"
          android:src="@drawable/ic_map_marker_select_red_48dp"
          android:visibility="gone"
          app:layout_constraintBottom_toBottomOf="@id/map"
          app:layout_constraintLeft_toLeftOf="@id/map"
          app:layout_constraintRight_toRightOf="@id/map"
          app:layout_constraintTop_toTopOf="@id/map"/>

        <com.google.android.material.floatingactionbutton.FloatingActionButton
          android:id="@+id/current_location"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="@dimen/keyline_first"
          android:layout_gravity="end|bottom"
          android:padding="0dp"
          android:src="@drawable/ic_outline_gps_fixed_24px"
          app:backgroundTint="?attr/colorAccent"
          app:borderWidth="0dp"
          app:layout_constraintBottom_toBottomOf="@id/map"
          app:layout_constraintEnd_toEndOf="@id/map"/>

        <RelativeLayout
          android:id="@+id/select_this_location"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="?attr/selectableItemBackground"
          android:clickable="true"
          android:focusable="true"
          android:orientation="horizontal"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toBottomOf="@id/map">

          <ImageView
            android:id="@+id/place_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/keyline_first"
            android:layout_alignParentStart="true"
            android:paddingTop="@dimen/keyline_first"
            android:paddingBottom="@dimen/keyline_first"
            android:contentDescription="@string/pick_this_location"
            android:src="@drawable/ic_outline_place_24px"
            app:tint="@color/icon_tint"/>

          <androidx.core.widget.ContentLoadingProgressBar
            android:id="@+id/loading_indicator"
            style="@style/Widget.AppCompat.ProgressBar"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_marginEnd="@dimen/keyline_first"
            android:layout_alignParentEnd="true"
            android:paddingTop="@dimen/keyline_first"
            android:paddingBottom="@dimen/keyline_first"
            android:indeterminate="true"
            android:visibility="gone"/>

          <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/keyline_second"
            android:layout_toEndOf="@id/place_icon"
            android:layout_toStartOf="@id/loading_indicator"
            android:paddingTop="@dimen/keyline_first"
            android:paddingBottom="@dimen/keyline_first"
            android:gravity="start|center_vertical"
            android:text="@string/pick_this_location"
            android:textAlignment="viewStart"
            android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
            android:textColor="@color/text_primary"/>

          <TextView
            android:id="@+id/choose_recent_location"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/keyline_first"
            android:layout_below="@id/place_icon"
            android:paddingTop="8dp"
            android:paddingBottom="8dp"
            android:gravity="start"
            android:text="@string/or_choose_a_location"
            android:textAlignment="viewStart"
            android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
            android:textColor="@color/text_primary"/>

        </RelativeLayout>

      </androidx.constraintlayout.widget.ConstraintLayout>

      <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:theme="@style/ToolbarTheme"
        app:layout_collapseMode="pin"
        app:popupTheme="@style/popup_overlay"
        app:title="@string/choose_a_location"/>

      <com.google.android.material.card.MaterialCardView
        android:id="@+id/search"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_marginTop="@dimen/keyline_first"
        android:layout_marginStart="@dimen/card_view_margin"
        android:layout_marginEnd="@dimen/card_view_margin"
        app:cardBackgroundColor="@color/window_background"
        app:cardElevation="@dimen/elevation_app_bar"
        app:layout_collapseMode="parallax"
        app:layout_collapseParallaxMultiplier=".7">

        <ImageView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginStart="@dimen/card_view_margin"
          android:layout_marginEnd="@dimen/card_view_margin"
          android:layout_gravity="start|center_vertical"
          android:contentDescription="@string/TLA_menu_search"
          android:src="@drawable/ic_outline_search_24px"
          app:tint="@color/icon_tint"/>

        <TextView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginStart="64dp"
          android:layout_gravity="center_vertical"
          android:gravity="start"
          android:text="@string/TLA_menu_search"
          android:textAlignment="viewStart"
          android:textAppearance="@style/TextAppearance.MaterialComponents.Body1"
          android:textColor="@color/text_primary"/>

      </com.google.android.material.card.MaterialCardView>

    </com.google.android.material.appbar.CollapsingToolbarLayout>

  </com.google.android.material.appbar.AppBarLayout>

  <androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recent_locations"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/window_background"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:listitem="@layout/row_place"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>