<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto">
    <data>
        <variable
            name="viewModel"
            type="com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel" />
        <variable
            name="isWeatherVisible"
            type="Boolean" />
    </data>
    <com.tommasoberlose.anotherwidget.components.FixedFocusScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/scrollView"
        android:scrollbarThumbVertical="@color/colorPrimary"
        android:background="@color/colorPrimaryDark">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingTop="8dp"
            android:paddingBottom="8dp"
            android:orientation="vertical">
            <com.google.android.material.card.MaterialCardView
                android:layout_width="match_parent"
                app:cardElevation="0dp"
                app:cardCornerRadius="9dp"
                android:layout_marginTop="8dp"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:id="@+id/weather_warning"
                android:backgroundTint="@color/disabledButtonBackground"
                android:layout_height="wrap_content">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                    <androidx.appcompat.widget.AppCompatTextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingTop="16dp"
                        android:paddingLeft="16dp"
                        android:paddingRight="16dp"
                        android:duplicateParentState="true"
                        android:id="@+id/label"
                        android:textSize="16sp"
                        android:text="@string/weather_warning"
                        android:textColor="@color/colorPrimaryText"
                        android:letterSpacing="0"
                        android:textAppearance="@style/AnotherWidget.Settings.Title"
                        app:textAllCaps="false" />
                    <com.google.android.material.button.MaterialButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/Widget.MaterialComponents.Button.TextButton"
                        android:text="@android:string/ok"
                        android:id="@+id/action_hide_weather_warning"
                        android:textColor="@color/colorPrimaryText"
                        android:layout_gravity="end" />
                </LinearLayout>
            </com.google.android.material.card.MaterialCardView>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingTop="16dp"
                android:paddingBottom="16dp"
                android:paddingLeft="8dp"
                android:paddingRight="8dp"
                android:clickable="true"
                android:focusable="true"
                android:background="?android:attr/selectableItemBackground"
                android:gravity="center_vertical"
                android:id="@+id/action_show_weather"
                android:orientation="horizontal">
                <ImageView
                    android:layout_width="48dp"
                    android:layout_height="48dp"
                    android:padding="10dp"
                    android:id="@+id/weather_icon_pack"
                    android:src="@drawable/clear_day_3"/>
                <LinearLayout
                    android:layout_width="0dp"
                    android:layout_weight="1"
                    android:layout_height="wrap_content"
                    android:paddingLeft="8dp"
                    android:paddingRight="8dp"
                    android:orientation="vertical">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        style="@style/AnotherWidget.Settings.Title"
                        android:text="@string/title_permission_location"/>
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/show_weather_label"
                        android:text="@string/description_permission_location"
                        style="@style/AnotherWidget.Settings.Subtitle"/>
                </LinearLayout>
                <com.google.android.material.switchmaterial.SwitchMaterial
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="16dp"
                    android:checked="@{isWeatherVisible}"
                    android:id="@+id/show_weather_switch"
                    android:buttonTint="@color/colorAccent" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/weather_settings"
                android:alpha="@{isWeatherVisible ? 1f : 0.2f, default=1}"
                android:orientation="vertical">
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:text="@string/provider_header"
                    android:textAlignment="viewStart"
                    android:paddingLeft="20dp"
                    android:paddingRight="20dp"
                    android:textSize="16sp"
                    android:textColor="@color/colorAccent"
                    android:textAppearance="@style/AnotherWidget.Settings.Header"
                    app:textAllCaps="false" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:paddingBottom="16dp"
                    android:paddingLeft="8dp"
                    android:paddingRight="8dp"
                    android:clickable="true"
                    android:focusable="true"
                    android:background="?android:attr/selectableItemBackground"
                    android:gravity="center_vertical"
                    android:id="@+id/action_weather_provider_api_key"
                    android:orientation="horizontal">
                    <ImageView
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:padding="12dp"
                        android:src="@drawable/round_vpn_key"
                        app:tint="@color/colorPrimaryText"/>
                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="wrap_content"
                        android:paddingLeft="8dp"
                        android:paddingRight="8dp"
                        android:orientation="vertical">
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            style="@style/AnotherWidget.Settings.Title"
                            android:text="@string/settings_weather_provider_api_key_title"/>
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/label_weather_provider_api_key"
                            style="@style/AnotherWidget.Settings.Subtitle"/>
                    </LinearLayout>
                    <ImageView
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:padding="12dp"
                        android:visibility="gone"
                        android:id="@+id/api_key_alert_icon"
                        android:src="@drawable/round_error"
                        app:tint="@color/errorColorText"/>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:paddingBottom="16dp"
                    android:paddingLeft="8dp"
                    android:paddingRight="8dp"
                    android:clickable="true"
                    android:focusable="true"
                    android:background="?android:attr/selectableItemBackground"
                    android:gravity="center_vertical"
                    android:id="@+id/action_custom_location"
                    android:orientation="horizontal">
                    <ImageView
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:padding="12dp"
                        android:src="@drawable/round_place"
                        app:tint="@color/colorPrimaryText"/>
                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:layout_height="wrap_content"
                        android:paddingLeft="8dp"
                        android:paddingRight="8dp"
                        android:orientation="vertical">
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            style="@style/AnotherWidget.Settings.Title"
                            android:text="@string/settings_custom_location_title"/>
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/label_custom_location"
                            style="@style/AnotherWidget.Settings.Subtitle"/>
                        <com.google.android.material.button.MaterialButton
                            android:layout_width="wrap_content"
                            android:layout_height="36dp"
                            style="@style/Widget.MaterialComponents.Button.TextButton"
                            android:letterSpacing="0"
                            android:textAllCaps="false"
                            android:clickable="true"
                            android:layout_marginStart="-8dp"
                            android:layout_marginBottom="-8dp"
                            android:paddingBottom="0dp"
                            android:paddingTop="0dp"
                            android:focusable="true"
                            android:visibility="gone"
                            android:id="@+id/location_permission_alert"
                            android:textColor="@color/errorColorText"
                            android:text="@string/action_grant_permission"/>
                    </LinearLayout>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/background_location_warning"
                    android:paddingStart="64dp"
                    android:paddingEnd="16dp"
                    android:paddingBottom="8dp"
                    android:orientation="horizontal">
                    <androidx.appcompat.widget.AppCompatTextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:duplicateParentState="true"
                        android:textSize="14sp"
                        android:text="@string/background_location_warning"
                        android:textColor="@color/colorSecondaryText"
                        android:letterSpacing="0"
                        android:fontFamily="@font/product_sans"
                        android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                        app:textAllCaps="false" />
                </LinearLayout>
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:text="@string/preferences_header"
                    android:textAlignment="viewStart"
                    android:paddingLeft="20dp"
                    android:paddingRight="20dp"
                    android:textSize="16sp"
                    android:textColor="@color/colorAccent"
                    android:textAppearance="@style/AnotherWidget.Settings.Header"
                    app:textAllCaps="false" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:paddingBottom="16dp"
                    android:paddingLeft="8dp"
                    android:paddingRight="8dp"
                    android:clickable="true"
                    android:focusable="true"
                    android:background="?android:attr/selectableItemBackground"
                    android:gravity="center_vertical"
                    android:id="@+id/action_weather_refresh_period"
                    android:orientation="horizontal">
                    <ImageView
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:padding="12dp"
                        android:src="@drawable/round_update"
                        app:tint="@color/colorPrimaryText"/>
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="8dp"
                        android:paddingRight="8dp"
                        android:orientation="vertical">
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            style="@style/AnotherWidget.Settings.Title"
                            android:text="@string/settings_weather_refresh_period_title"/>
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/label_weather_refresh_period"
                            style="@style/AnotherWidget.Settings.Subtitle"/>
                    </LinearLayout>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:paddingBottom="16dp"
                    android:paddingLeft="8dp"
                    android:paddingRight="8dp"
                    android:clickable="true"
                    android:focusable="true"
                    android:background="?android:attr/selectableItemBackground"
                    android:gravity="center_vertical"
                    android:id="@+id/action_change_unit"
                    android:orientation="horizontal">
                    <ImageView
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:padding="10dp"
                        android:src="@drawable/round_text_format"
                        app:tint="@color/colorPrimaryText"/>
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="8dp"
                        android:paddingRight="8dp"
                        android:orientation="vertical">
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            style="@style/AnotherWidget.Settings.Title"
                            android:text="@string/settings_unit_title"/>
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/temp_unit"
                            style="@style/AnotherWidget.Settings.Subtitle"/>
                    </LinearLayout>
                </LinearLayout>
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:paddingBottom="16dp"
                    android:paddingLeft="8dp"
                    android:paddingRight="8dp"
                    android:clickable="true"
                    android:focusable="true"
                    android:background="?android:attr/selectableItemBackground"
                    android:gravity="center_vertical"
                    android:id="@+id/action_weather_icon_pack"
                    android:orientation="horizontal">
                    <ImageView
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:padding="12dp"
                        android:src="@drawable/round_style"
                        app:tint="@color/colorPrimaryText"/>
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="8dp"
                        android:paddingRight="8dp"
                        android:orientation="vertical">
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            style="@style/AnotherWidget.Settings.Title"
                            android:text="@string/settings_weather_icon_pack_title"/>
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/label_weather_icon_pack"
                            style="@style/AnotherWidget.Settings.Subtitle"/>
                    </LinearLayout>
                </LinearLayout>
                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:text="@string/actions_header"
                    android:textAlignment="viewStart"
                    android:paddingLeft="20dp"
                    android:paddingRight="20dp"
                    android:textSize="16sp"
                    android:textColor="@color/colorAccent"
                    android:textAppearance="@style/AnotherWidget.Settings.Header"
                    app:textAllCaps="false" />
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="16dp"
                    android:paddingBottom="16dp"
                    android:paddingLeft="8dp"
                    android:paddingRight="8dp"
                    android:clickable="true"
                    android:focusable="true"
                    android:background="?android:attr/selectableItemBackground"
                    android:gravity="center_vertical"
                    android:id="@+id/action_weather_app"
                    android:orientation="horizontal">
                    <ImageView
                        android:layout_width="48dp"
                        android:layout_height="48dp"
                        android:padding="12dp"
                        android:src="@drawable/round_add_to_home_screen"
                        app:tint="@color/colorPrimaryText"/>
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="8dp"
                        android:paddingRight="8dp"
                        android:orientation="vertical">
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            style="@style/AnotherWidget.Settings.Title"
                            android:text="@string/settings_weather_app_title"/>
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:id="@+id/weather_app_label"
                            style="@style/AnotherWidget.Settings.Subtitle"/>
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </com.tommasoberlose.anotherwidget.components.FixedFocusScrollView>
</layout>