<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:transitionGroup="true"
    android:keepScreenOn="true">

    <androidx.cardview.widget.CardView
        android:id="@+id/map_toolbar"
        style="@style/Toolbar"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageButton
            android:id="@+id/map_btn_back"
            style="@style/ToolbarButton"
            android:layout_gravity="start|center_vertical"
            android:contentDescription="@string/btn_back"
            android:src="@drawable/ic_back" />

        <TextView
            android:id="@+id/map_timer"
            style="@style/ToolbarTimer" />

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/map_card"
        style="@style/SurfaceCard"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginStart="@dimen/view_default_margin"
        android:layout_marginTop="@dimen/view_default_margin"
        android:layout_marginEnd="@dimen/view_default_margin"
        android:layout_marginBottom="@dimen/view_default_margin"
        app:layout_constraintBottom_toTopOf="@+id/map_card_info"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/map_toolbar">

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

    </androidx.cardview.widget.CardView>

    <TextView
        android:id="@+id/map_copyright"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="2dp"
        android:layout_marginTop="2dp"
        android:layout_marginEnd="2dp"
        android:ellipsize="end"
        android:gravity="center"
        android:includeFontPadding="false"
        android:maxLines="1"
        android:text="@string/map_copyright"
        android:textColor="@color/textMain"
        android:textSize="@dimen/text_size_copyright"
        app:layout_constraintEnd_toEndOf="@+id/map_card"
        app:layout_constraintStart_toStartOf="@+id/map_card"
        app:layout_constraintTop_toTopOf="@+id/map_card" />

    <androidx.cardview.widget.CardView
        android:id="@+id/map_card_info"
        style="@style/SurfaceCard"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/view_default_margin"
        android:layout_marginEnd="@dimen/view_default_margin"
        android:layout_marginBottom="@dimen/view_default_margin"
        app:layout_constraintBottom_toTopOf="@+id/map_coordinator"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <TextView
                android:id="@+id/map_azimuth"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:text="@string/map_azimuth"
                app:layout_constraintBottom_toTopOf="@+id/map_data_alt"
                app:layout_constraintStart_toStartOf="@+id/map_data_period"
                app:layout_constraintTop_toBottomOf="@+id/map_data_period" />

            <TextView
                android:id="@+id/map_data_lat"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:text="@string/map_latitude"
                app:layout_constraintBottom_toTopOf="@+id/map_data_qth"
                app:layout_constraintStart_toStartOf="@+id/map_data_alt"
                app:layout_constraintTop_toBottomOf="@+id/map_data_alt" />

            <TextView
                android:id="@+id/map_data_lon"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/map_longitude"
                app:layout_constraintBaseline_toBaselineOf="@+id/map_data_lat"
                app:layout_constraintEnd_toEndOf="@+id/map_data_dst" />

            <TextView
                android:id="@+id/map_data_alt"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:text="@string/map_altitude"
                app:layout_constraintBottom_toTopOf="@+id/map_data_lat"
                app:layout_constraintStart_toStartOf="@+id/map_azimuth"
                app:layout_constraintTop_toBottomOf="@+id/map_azimuth" />

            <TextView
                android:id="@+id/map_data_dst"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/map_distance"
                app:layout_constraintBaseline_toBaselineOf="@+id/map_data_alt"
                app:layout_constraintEnd_toEndOf="@+id/map_elevation" />

            <TextView
                android:id="@+id/map_elevation"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/map_elevation"
                app:layout_constraintBaseline_toBaselineOf="@+id/map_azimuth"
                app:layout_constraintEnd_toEndOf="@+id/map_data_phase" />

            <TextView
                android:id="@+id/map_data_period"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="10dp"
                android:layout_marginTop="6dp"
                android:text="@string/map_period"
                app:layout_constraintBottom_toTopOf="@+id/map_azimuth"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/map_data_phase"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="10dp"
                android:text="@string/map_phase"
                app:layout_constraintBaseline_toBaselineOf="@+id/map_data_period"
                app:layout_constraintEnd_toEndOf="parent" />

            <TextView
                android:id="@+id/map_data_qth"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:layout_marginBottom="8dp"
                android:text="@string/map_qth"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintStart_toStartOf="@+id/map_data_lat"
                app:layout_constraintTop_toBottomOf="@+id/map_data_lat" />

            <TextView
                android:id="@+id/map_data_vel"
                style="@style/WorldMapText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/map_velocity"
                app:layout_constraintBaseline_toBaselineOf="@+id/map_data_qth"
                app:layout_constraintEnd_toEndOf="@+id/map_data_lon" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </androidx.cardview.widget.CardView>

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:id="@+id/map_coordinator"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent">

        <com.google.android.material.bottomappbar.BottomAppBar
            android:id="@+id/map_bottom_bar"
            style="@style/BottomBar" />

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

    <Button
        android:id="@+id/map_btn_prev"
        style="@style/NormalButton"
        android:layout_width="@dimen/button_width_max"
        android:layout_marginStart="@dimen/button_margin_side"
        android:text="@string/btn_prev"
        app:icon="@drawable/ic_prev"
        app:layout_constraintBottom_toBottomOf="@+id/map_coordinator"
        app:layout_constraintStart_toStartOf="@+id/map_coordinator"
        app:layout_constraintTop_toTopOf="@+id/map_coordinator" />

    <TextView
        android:id="@+id/map_data_visibility"
        style="@style/WorldMapText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="4dp"
        android:layout_marginEnd="4dp"
        android:ellipsize="end"
        android:gravity="center_horizontal"
        android:maxLines="1"
        android:text="@string/map_visible"
        app:layout_constraintBaseline_toBaselineOf="@+id/map_btn_prev"
        app:layout_constraintEnd_toStartOf="@+id/map_btn_next"
        app:layout_constraintStart_toEndOf="@+id/map_btn_prev" />

    <Button
        android:id="@+id/map_btn_next"
        style="@style/NormalButton"
        android:layout_width="@dimen/button_width_max"
        android:layout_marginEnd="@dimen/button_margin_side"
        android:text="@string/btn_next"
        app:icon="@drawable/ic_next"
        app:iconGravity="end"
        app:layout_constraintBaseline_toBaselineOf="@+id/map_btn_prev"
        app:layout_constraintEnd_toEndOf="@+id/map_coordinator" />

</androidx.constraintlayout.widget.ConstraintLayout>
