<?xml version="1.0" encoding="utf-8"?>
<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">

    <org.osmdroid.views.MapView
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <com.google.android.material.button.MaterialButton
        android:id="@+id/mapStyleButton"
        android:layout_width="48sp"
        android:layout_height="56sp"
        android:layout_margin="8dp"
        android:backgroundTint="@color/colorAdvancedBackground"
        android:contentDescription="@string/map_style_selection"
        app:icon="@drawable/ic_twotone_layers_24"
        app:iconGravity="textStart"
        app:iconPadding="0dp"
        app:iconTint="@color/unselectedColor"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/cache_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/map_select_download_region"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="@color/colourGrey"
            app:layout_constraintBottom_toTopOf="@id/toggleButton"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

        <com.google.android.material.button.MaterialButtonToggleGroup
            android:id="@+id/toggleButton"
            style="?attr/materialButtonToggleGroupStyle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            app:layout_constraintBottom_toTopOf="@id/cache_estimate">

            <Button
                android:id="@+id/box5miles"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/map_5_miles"
                app:layout_constraintBottom_toTopOf="@id/cache_estimate"
                app:layout_constraintEnd_toStartOf="@id/box10miles"
                app:layout_constraintStart_toStartOf="parent" />

            <Button
                android:id="@+id/box10miles"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/map_10_miles"
                app:layout_constraintBottom_toTopOf="@id/cache_estimate"
                app:layout_constraintEnd_toStartOf="@id/box15miles"
                app:layout_constraintStart_toEndOf="@id/box5miles" />

            <Button
                android:id="@+id/box15miles"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/map_15_miles"
                app:layout_constraintBottom_toTopOf="@id/cache_estimate"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toEndOf="@id/box10miles" />
        </com.google.android.material.button.MaterialButtonToggleGroup>

        <TextView
            android:id="@+id/cache_estimate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/map_tile_download_estimate"
            android:textColor="@color/colourGrey"
            app:layout_constraintBottom_toTopOf="@id/executeJob"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

        <Button
            android:id="@+id/executeJob"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/map_start_download"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="parent" />

        <Button
            android:id="@+id/cancelDownload"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/cancel"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/downloadButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="8dp"
        android:backgroundTint="@color/buttonColor"
        android:contentDescription="@string/map_download_region"
        android:orientation="vertical"
        android:src="@android:drawable/stat_sys_download"
        android:visibility="visible"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        tools:background="@color/buttonColor" />
</androidx.constraintlayout.widget.ConstraintLayout>