<?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"
    android:id="@+id/content"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_vertical"
        android:layout_marginBottom="?attr/actionBarSize"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="@dimen/tablet_additional_padding_left_right"
            android:layout_marginRight="@dimen/tablet_additional_padding_left_right"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="16dp"
                android:orientation="vertical">

                <com.google.android.material.card.MaterialCardView
                    style="@style/Widget.Material3.CardView.Filled"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="16dp"
                    app:strokeWidth="0dp">

                    <FrameLayout
                        android:id="@+id/storage_full"
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:background="@color/material_indigo">

                        <FrameLayout
                            android:id="@+id/storage_threema"
                            android:layout_width="1dp"
                            android:layout_height="match_parent"
                            android:layout_gravity="left"
                            android:background="@color/material_red"
                            android:minWidth="1dp" />

                        <FrameLayout
                            android:id="@+id/storage_empty"
                            android:layout_width="0dp"
                            android:layout_height="match_parent"
                            android:layout_gravity="right"
                            android:background="@color/material_green" />

                        <com.google.android.material.progressindicator.CircularProgressIndicator
                            android:id="@+id/progressbar"
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:layout_gravity="center"
                            android:indeterminate="true"
                            android:padding="2dp" />

                    </FrameLayout>

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

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <FrameLayout
                        android:id="@+id/legend_total"
                        android:layout_width="12dp"
                        android:layout_height="12dp"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="6dp"
                        android:background="?attr/colorOnBackground">

                        <View
                            android:layout_width="9dp"
                            android:layout_height="9dp"
                            android:layout_gravity="center"
                            android:background="?android:attr/colorBackground" />

                    </FrameLayout>

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toLeftOf="@+id/total_view"
                        android:layout_toRightOf="@id/legend_total"
                        android:ellipsize="end"
                        android:text="@string/storage_total"
                        android:textAppearance="?android:textAppearanceMedium" />

                    <TextView
                        android:id="@+id/total_view"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:text=""
                        android:textAppearance="?android:textAppearanceMedium" />

                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <View
                        android:id="@+id/legend_in_use"
                        android:layout_width="12dp"
                        android:layout_height="12dp"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="6dp"
                        android:background="@color/material_indigo" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toLeftOf="@+id/in_use_view"
                        android:layout_toRightOf="@id/legend_in_use"
                        android:ellipsize="end"
                        android:text="@string/storage_total_in_use"
                        android:textAppearance="?android:textAppearanceMedium" />

                    <TextView
                        android:id="@+id/in_use_view"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:text=""
                        android:textAppearance="?android:textAppearanceMedium" />

                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <View
                        android:id="@+id/legend_free"
                        android:layout_width="12dp"
                        android:layout_height="12dp"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="6dp"
                        android:background="@color/material_green" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toLeftOf="@+id/free_view"
                        android:layout_toRightOf="@id/legend_free"
                        android:ellipsize="end"
                        android:text="@string/storage_total_free"
                        android:textAppearance="?android:textAppearanceMedium" />

                    <TextView
                        android:id="@+id/free_view"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:text=""
                        android:textAppearance="?android:textAppearanceMedium" />

                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <View
                        android:id="@+id/legend_usage"
                        android:layout_width="12dp"
                        android:layout_height="12dp"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="6dp"
                        android:background="@color/material_red" />

					<TextView
						android:id="@+id/used_by_threema"
						android:layout_width="wrap_content"
						android:layout_height="wrap_content"
						android:layout_toLeftOf="@+id/usage_view"
						android:layout_toRightOf="@id/legend_usage"
						android:ellipsize="end"
						android:textAppearance="?android:textAppearanceMedium" />

                    <TextView
                        android:id="@+id/usage_view"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:text=""
                        android:textAppearance="?android:textAppearanceMedium" />

                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <View
                        android:id="@+id/legend_num_msgs"
                        android:layout_width="12dp"
                        android:layout_height="12dp"
                        android:layout_alignParentLeft="true"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="6dp"
                        android:background="?attr/colorSecondaryContainer" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@id/legend_num_msgs"
                        android:layout_toLeftOf="@+id/num_messages_view"
                        android:ellipsize="end"
                        android:text="@string/num_messages"
                        android:textAppearance="?android:textAppearanceMedium" />

                    <TextView
                        android:id="@+id/num_messages_view"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:text=""
                        android:textAppearance="?android:textAppearanceMedium" />

                </RelativeLayout>

                <androidx.appcompat.widget.LinearLayoutCompat
                    android:id="@+id/auto_delete_container"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content">

                    <TextView
                        style="@style/Threema.Text.Overline"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="16dp"
                        android:layout_marginBottom="16dp"
                        android:text="@string/delete_automatically" />

                    <ImageButton
                        android:id="@+id/auto_delete_info"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_gravity="center_vertical"
                        android:background="?attr/selectableItemBackgroundBorderless"
                        android:contentDescription="@string/new_wizard_more_information"
                        android:padding="8dp"
                        app:srcCompat="@drawable/ic_info_outline"
                        app:tint="?attr/colorOnSurface" />

                </androidx.appcompat.widget.LinearLayoutCompat>

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/keep_messages_spinner_layout"
                    style="@style/Widget.Material3.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp"
                    android:hint="@string/keep_messages"
                    app:expandedHintEnabled="false">

                    <com.google.android.material.textfield.MaterialAutoCompleteTextView
                        android:id="@+id/keep_messages_spinner"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textColor="@color/textview_colorstatelist"
                        android:focusable="false"
                        android:inputType="none" />

                </com.google.android.material.textfield.TextInputLayout>

                <TextView
                    android:id="@+id/disabled_by_policy"
                    style="@style/Threema.TextAppearance.BodySmall"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/set_by_administrator"
                    android:visibility="gone" />

                <com.google.android.material.divider.MaterialDivider
                    android:id="@+id/manual_divider"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:layout_marginBottom="16dp" />

                <TextView
                    style="@style/Threema.Text.Overline"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/clean_up_manually" />

                <TextView
                    android:id="@+id/storage_explain"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="16dp"
                    android:text="@string/storage_explain"
                    android:textAppearance="?android:textAppearanceMedium" />

                <com.google.android.material.textfield.TextInputLayout
                    style="@style/Widget.Material3.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="16dp"
                    android:layout_marginBottom="8dp"
                    android:hint="@string/delete_media_files_time"
                    app:expandedHintEnabled="false">

                    <com.google.android.material.textfield.MaterialAutoCompleteTextView
                        android:id="@+id/time_spinner"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:focusable="false"
                        android:inputType="none" />

                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/delete_button"
                    style="@style/Threema.MaterialButton.Action"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:text="@string/delete_data" />

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/messages_delete_explain"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/messages_delete_explain"
                    android:textAppearance="?android:textAppearanceMedium" />

                <com.google.android.material.textfield.TextInputLayout
                    style="@style/Widget.Material3.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="16dp"
                    android:layout_marginBottom="8dp"
                    android:hint="@string/delete_messages_explain"
                    app:expandedHintEnabled="false">

                    <com.google.android.material.textfield.MaterialAutoCompleteTextView
                        android:id="@+id/time_spinner_messages"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:focusable="false"
                        android:inputType="none" />

                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/delete_button_messages"
                    style="@style/Threema.MaterialButton.Action"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="right"
                    android:text="@string/delete_message" />

                <com.google.android.material.divider.MaterialDivider
                    android:id="@+id/groupack_divider"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="8dp"
                    android:layout_marginBottom="8dp" />

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/delete_everything_button"
                    style="@style/Threema.MaterialButton.Fatal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="left"
                    android:layout_marginBottom="16dp"
                    android:text="@string/delete_id_title" />

            </LinearLayout>
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>

    <include layout="@layout/toolbar_view" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
