<?xml version="1.0" encoding="utf-8"?>

<!--
 This file is part of TinyWeatherForecastGermany.

 Copyright (c) 2020, 2021, 2022, 2023, 2024 Pawel Dube

 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_layoutholder"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/colorPrimary"
    android:orientation="vertical">

    <RelativeLayout
        android:id="@+id/gps_progress_holder"
        android:layout_width="match_parent"
        android:layout_height="18dp"
        android:visibility="gone"
        android:background="?attr/colorPrimaryLight"
        android:orientation="horizontal">

       <ProgressBar
           android:id="@+id/gps_progress_bar"
           android:layout_width="wrap_content"
           android:layout_height="match_parent"
           android:indeterminate="true"
           android:layout_alignParentLeft="true"
           android:background="?attr/colorPrimaryLight"
       />

        <TextView
            android:id="@+id/wait_for_gps_fix_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:text="@string/main_wait_for_gps_fix"
            android:textColor="?attr/colorText"
            android:layout_gravity="left"
            android:layout_toRightOf="@id/gps_progress_bar"
            android:background="?attr/colorPrimaryLight"
            android:textSize="@dimen/fcmain_textsize_medium"/>

        <Button
            android:id="@+id/cancel_gps"
            android:layout_width="wrap_content"
            android:layout_height="14dp"
            android:background="?attr/colorPrimary"
            android:gravity="center"
            android:layout_gravity="center_vertical"
            android:layout_alignParentRight="true"
            android:layout_margin="2dp"
            android:textSize="@dimen/fcmain_textsize_medium"
            android:text="@string/geoinput_cancel"/>

    </RelativeLayout>

    <RelativeLayout
            android:id="@+id/main_area_progress_holder"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:visibility="gone"
            android:background="?attr/colorPrimaryLight"
            android:orientation="horizontal">

        <TextView
                android:id="@+id/main_area_progress_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:text="@string/areadatabasecreator_title"
                android:textColor="?attr/colorText"
                android:layout_gravity="left"
                android:layout_alignParentBottom="true"
                android:background="?attr/colorPrimaryLight"
                android:textSize="@dimen/fcmain_textsize_medium"/>

        <ProgressBar
                android:id="@+id/main_area_progress_bar"
                style="?android:attr/progressBarStyleHorizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_gravity="center_horizontal"
                android:minHeight="20dp"
                android:maxHeight="20dp"
                android:scaleY="2"
                android:minWidth="100dp"
                android:max="100"
                android:indeterminate="false"
                android:progress="50"/>

    </RelativeLayout>


    <RelativeLayout
        android:id="@+id/main_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TextView
                android:id="@+id/main_dwd_notice_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/dwd_notice_app"
                android:layout_alignParentBottom="true"
                android:textColor="?attr/colorTextDark"
                android:background="?attr/colorPrimaryDark"
                android:textAlignment="center"
                android:gravity="center_horizontal"
                android:layout_gravity="center"
                android:layout_centerVertical="true"
                android:textSize="@dimen/fcmain_textsize_medium"/>

        <RelativeLayout
                android:id="@+id/main_top_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true">

            <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:text="@string/main_selectstation"
                    android:textColor="?attr/colorText"
                    android:layout_gravity="left"
                    android:textSize="@dimen/fcmain_textsize_large"
                    android:id="@+id/main_selectstation_text"/>

            <RelativeLayout
                    android:id="@+id/main_infotext_layout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_alignParentRight="true"
                    android:layout_gravity="right"
                    >

                <TextView
                        android:id="@+id/main_update_time"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentTop="true"
                        android:layout_alignParentRight="true"
                        android:layout_gravity="right"
                        android:textColor="?attr/colorText"
                        android:textSize="@dimen/fcmain_textsize_medium_fixed"
                        android:text="00:00:00">
                </TextView>

                <TextView
                        android:id="@+id/main_station_geo"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/main_update_time"
                        android:layout_alignParentRight="true"
                        android:layout_gravity="right"
                        android:textColor="?attr/colorText"
                        android:textSize="@dimen/fcmain_textsize_medium_fixed"
                        android:text="">
                </TextView>

            </RelativeLayout>

            <LinearLayout
                    android:id="@+id/main_spinner_linearlayout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal"
                    android:weightSum="20"
                    android:layout_marginLeft="6dp"
                    android:layout_marginRight="6dp"
                    android:layout_below="@id/main_infotext_layout">

                <Spinner android:id="@+id/stations_spinner"
                         android:layout_width="0dp"
                         android:layout_weight="18"
                         android:layout_height="wrap_content"/>

                <ImageView android:id="@+id/main_reset_favorites"
                           android:layout_width="0dp"
                           android:layout_weight="2"
                           android:layout_height="wrap_content"
                           android:layout_gravity="center"
                           android:gravity="center"
                           android:tint="?attr/colorText"
                           android:src="?attr/ic_highlight_off"/>
            </LinearLayout>

            <ImageView
                    android:id="@+id/main_overview_chart"
                    android:layout_width="match_parent"
                    android:layout_height="80dp"
                    android:layout_below="@id/main_spinner_linearlayout"
                    android:background="?attr/colorPrimaryDark"/>

        </RelativeLayout>

        <ListView android:id="@+id/main_listview"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:divider="?attr/colorPrimaryLight"
                  android:dividerHeight="0dp"
                  android:layout_below="@id/main_top_container"
                  android:layout_above="@id/main_dwd_notice_text"
                  android:layout_alignWithParentIfMissing="true"
                  android:scrollbars="vertical"
                  android:scrollbarThumbVertical="?attr/colorTextDark"
                  android:verticalScrollbarPosition="right"
                  android:scrollbarSize="6dp"
                  android:footerDividersEnabled="true" android:layout_marginTop="@dimen/slider_marginDouble"
                  android:layout_marginStart="@dimen/slider_marginDouble"
                  android:layout_marginEnd="@dimen/slider_marginDouble"
                  android:layout_marginBottom="@dimen/slider_marginDouble"/>

        <ProgressBar
                android:id="@+id/main_progressbar"
                android:layout_width="120dp"
                android:layout_height="120dp"
                android:layout_gravity="center"
                android:gravity="center"
                android:indeterminate="true"
                android:visibility="invisible" android:layout_centerInParent="true"/>

    </RelativeLayout>

</LinearLayout>