<?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">

    <FrameLayout
        android:id="@+id/headerFrameLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:background="?attr/colorPrimary"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHeight_percent="0.25"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

    </FrameLayout>

    <TextView
        android:id="@+id/versionTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:textAlignment="viewEnd"
        android:textAppearance="@style/TextAppearance.AppCompat.Medium"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:text="Version" />

    <ImageView
        android:id="@+id/logoImageView"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_margin="16dp"
        android:contentDescription="@string/app_logo"
        app:layout_constraintBottom_toTopOf="@+id/allowedHostCardView"
        app:layout_constraintDimensionRatio="1"
        app:layout_constraintHeight_percent="0.1"
        app:layout_constraintStart_toStartOf="@+id/headerFrameLayout"
        app:layout_constraintTop_toTopOf="@+id/headerFrameLayout"
        app:srcCompat="@mipmap/icon_round" />

    <TextView
        android:id="@+id/appNameTextView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginEnd="8dp"
        android:text="@string/app_name"
        android:textAppearance="@style/TextAppearance.AppCompat.Large"
        app:layout_constraintBottom_toTopOf="@+id/appDescriptionTextView"
        app:layout_constraintEnd_toEndOf="@+id/headerFrameLayout"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/logoImageView"
        app:layout_constraintTop_toTopOf="@+id/allowedHostCardView" />

    <TextView
        android:id="@+id/appDescriptionTextView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:text="@string/app_description"
        android:textAppearance="@style/TextAppearance.AppCompat.Medium"
        app:layout_constraintBottom_toTopOf="@+id/headerFrameLayout"
        app:layout_constraintEnd_toEndOf="@+id/headerFrameLayout"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/logoImageView"
        app:layout_constraintTop_toBottomOf="@+id/appNameTextView" />

    <androidx.cardview.widget.CardView
        android:id="@+id/blockedHostCardView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:elevation="10dp"
        app:cardCornerRadius="8dp"
        app:contentPaddingBottom="16dp"
        app:contentPaddingLeft="8dp"
        app:contentPaddingRight="8dp"
        app:contentPaddingTop="16dp"
        app:layout_constraintBottom_toBottomOf="@+id/headerFrameLayout"
        app:layout_constraintEnd_toStartOf="@+id/badge1Space"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_weight="1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/headerFrameLayout">

        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TextView
                android:id="@+id/blockedHostCounterTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:textAppearance="@style/TextAppearance.AppCompat.Large"
                android:textStyle="bold"
                tools:text="2250" />

            <TextView
                android:id="@+id/blockedHostTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:text="@string/blocked_hosts_label" />

        </androidx.appcompat.widget.LinearLayoutCompat>

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:elevation="10dp"
        android:shape="ring"
        app:cardCornerRadius="75dp"
        app:layout_constraintBottom_toTopOf="@+id/blockedHostCardView"
        app:layout_constraintEnd_toEndOf="@+id/blockedHostCardView"
        app:layout_constraintStart_toStartOf="@+id/blockedHostCardView"
        app:layout_constraintTop_toTopOf="@+id/blockedHostCardView">

        <ImageView
            android:id="@+id/blockedHostImageView"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_margin="5dp"
            android:contentDescription="@string/blocked_hosts_label"
            android:elevation="15dp"
            app:srcCompat="@drawable/baseline_block_24"
            app:tint="@color/blocked" />
    </androidx.cardview.widget.CardView>

    <Space
        android:id="@+id/badge1Space"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="@+id/headerFrameLayout"
        app:layout_constraintEnd_toStartOf="@id/allowedHostCardView"
        app:layout_constraintHorizontal_weight="0.2"
        app:layout_constraintStart_toEndOf="@id/blockedHostCardView"
        app:layout_constraintTop_toBottomOf="@+id/headerFrameLayout" />

    <androidx.cardview.widget.CardView
        android:id="@+id/allowedHostCardView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:elevation="10dp"
        app:cardCornerRadius="8dp"
        app:contentPaddingBottom="16dp"
        app:contentPaddingLeft="8dp"
        app:contentPaddingRight="8dp"
        app:contentPaddingTop="16dp"
        app:layout_constraintBottom_toBottomOf="@+id/headerFrameLayout"
        app:layout_constraintEnd_toStartOf="@+id/badge2Space"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_weight="1"
        app:layout_constraintStart_toEndOf="@+id/badge1Space"
        app:layout_constraintTop_toBottomOf="@+id/headerFrameLayout">

        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TextView
                android:id="@+id/allowedHostCounterTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:textAppearance="@style/TextAppearance.AppCompat.Large"
                android:textStyle="bold"
                tools:text="25" />

            <TextView
                android:id="@+id/allowedHostTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:text="@string/allowed_hosts_label" />

        </androidx.appcompat.widget.LinearLayoutCompat>

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:elevation="10dp"
        android:shape="ring"
        app:cardCornerRadius="75dp"
        app:layout_constraintBottom_toTopOf="@+id/allowedHostCardView"
        app:layout_constraintEnd_toEndOf="@+id/allowedHostCardView"
        app:layout_constraintStart_toStartOf="@+id/allowedHostCardView"
        app:layout_constraintTop_toTopOf="@+id/allowedHostCardView">

        <ImageView
            android:id="@+id/allowedHostImageView"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_margin="5dp"
            android:contentDescription="@string/allowed_hosts_label"
            android:elevation="15dp"
            app:srcCompat="@drawable/baseline_check_24"
            app:tint="@color/allowed" />
    </androidx.cardview.widget.CardView>

    <Space
        android:id="@+id/badge2Space"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="@+id/headerFrameLayout"
        app:layout_constraintEnd_toStartOf="@id/redirectHostCardView"
        app:layout_constraintHorizontal_weight="0.2"
        app:layout_constraintStart_toEndOf="@id/allowedHostCardView"
        app:layout_constraintTop_toBottomOf="@+id/headerFrameLayout" />

    <androidx.cardview.widget.CardView
        android:id="@+id/redirectHostCardView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:elevation="10dp"
        app:cardCornerRadius="8dp"
        app:contentPaddingBottom="16dp"
        app:contentPaddingLeft="8dp"
        app:contentPaddingRight="8dp"
        app:contentPaddingTop="16dp"
        app:layout_constraintBottom_toBottomOf="@+id/headerFrameLayout"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_weight="1"
        app:layout_constraintStart_toEndOf="@+id/badge2Space"
        app:layout_constraintTop_toBottomOf="@+id/headerFrameLayout">

        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <TextView
                android:id="@+id/redirectHostCounterTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:textAppearance="@style/TextAppearance.AppCompat.Large"
                android:textStyle="bold"
                tools:text="2" />

            <TextView
                android:id="@+id/redirectHostTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:text="@string/redirect_hosts_label" />

        </androidx.appcompat.widget.LinearLayoutCompat>

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:elevation="10dp"
        android:shape="ring"
        app:cardCornerRadius="75dp"
        app:layout_constraintBottom_toTopOf="@+id/redirectHostCardView"
        app:layout_constraintEnd_toEndOf="@+id/redirectHostCardView"
        app:layout_constraintStart_toStartOf="@+id/redirectHostCardView"
        app:layout_constraintTop_toTopOf="@+id/redirectHostCardView">

        <ImageView
            android:id="@+id/redirectHostImageView"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_margin="5dp"
            android:contentDescription="@string/redirect_hosts_label"
            android:elevation="15dp"
            app:srcCompat="@drawable/baseline_compare_arrows_24"
            app:tint="@color/redirected" />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/sourcesCardView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="24dp"
        android:layout_marginRight="16dp"
        app:cardCornerRadius="8dp"
        app:contentPadding="16dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/allowedHostCardView">

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

            <ImageView
                android:id="@+id/sourceImageView"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:layout_marginBottom="16dp"
                android:contentDescription="@string/icon_update_status"
                app:layout_constraintBottom_toTopOf="@id/stateTextView"
                app:layout_constraintHorizontal_weight="1"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintWidth_percent="0.25"
                app:srcCompat="@drawable/ic_collections_bookmark_24dp">

            </ImageView>

            <TextView
                android:id="@+id/upToDateSourcesTextView"
                android:layout_width="0dp"
                android:layout_height="32dp"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp"
                android:gravity="center"
                app:layout_constraintEnd_toStartOf="@id/checkForUpdateImageView"
                app:layout_constraintHorizontal_bias="0.66"
                app:layout_constraintHorizontal_weight="2"
                app:layout_constraintStart_toEndOf="@id/sourceImageView"
                app:layout_constraintTop_toTopOf="parent"
                tools:text="3 up-to-date sources" />

            <ImageView
                android:id="@+id/checkForUpdateImageView"
                android:layout_width="32dp"
                android:layout_height="32dp"
                android:contentDescription="@string/check_hosts_update_description"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toTopOf="parent"
                app:srcCompat="@drawable/ic_sync_24dp" />

            <TextView
                android:id="@+id/outdatedSourcesTextView"
                android:layout_width="0dp"
                android:layout_height="32dp"
                android:layout_marginStart="8dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="8dp"
                android:gravity="center"
                app:layout_constraintEnd_toStartOf="@id/updateImageView"
                app:layout_constraintHorizontal_bias="0.66"
                app:layout_constraintHorizontal_weight="2"
                app:layout_constraintStart_toEndOf="@id/sourceImageView"
                app:layout_constraintTop_toBottomOf="@id/upToDateSourcesTextView"
                tools:text="2 outdated sources" />

            <ImageView
                android:id="@+id/updateImageView"
                android:layout_width="32dp"
                android:layout_height="32dp"
                android:layout_marginTop="16dp"
                android:contentDescription="@string/update_hosts_description"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@id/checkForUpdateImageView"
                app:srcCompat="@drawable/ic_get_app_24dp" />

            <com.google.android.material.progressindicator.LinearProgressIndicator
                android:id="@+id/sourcesProgressBar"
                android:layout_width="match_parent"
                android:layout_height="2dp"
                android:indeterminate="true"
                android:visibility="gone"
                app:layout_constraintBottom_toTopOf="@+id/stateTextView"
                app:layout_constraintTop_toBottomOf="@+id/outdatedSourcesTextView"
                tools:visibility="visible" />

            <TextView
                android:id="@+id/stateTextView"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:background="#00F00909"
                android:visibility="gone"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/outdatedSourcesTextView"
                tools:text="@string/status_check_source"
                tools:visibility="visible" />

        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/logCardView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="16dp"
        android:layout_marginTop="34dp"
        android:elevation="10dp"
        app:cardCornerRadius="8dp"
        app:contentPaddingBottom="16dp"
        app:contentPaddingLeft="8dp"
        app:contentPaddingRight="8dp"
        app:contentPaddingTop="16dp"
        app:layout_constraintBottom_toBottomOf="@+id/helpCardView"
        app:layout_constraintEnd_toStartOf="@+id/badge1Space"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_weight="1"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/sourcesCardView">

        <TextView
            android:id="@+id/logTextView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="@string/log_label" />

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:elevation="10dp"
        android:shape="ring"
        app:cardCornerRadius="75dp"
        app:layout_constraintBottom_toTopOf="@+id/logCardView"
        app:layout_constraintEnd_toEndOf="@+id/logCardView"
        app:layout_constraintStart_toStartOf="@+id/logCardView"
        app:layout_constraintTop_toTopOf="@+id/logCardView">

        <ImageView
            android:id="@+id/helpImageView"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_margin="5dp"
            android:contentDescription="@string/log_label"
            android:elevation="15dp"
            app:srcCompat="@drawable/ic_outline_rule_24" />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/helpCardView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="34dp"
        android:elevation="10dp"
        app:cardCornerRadius="8dp"
        app:contentPaddingBottom="16dp"
        app:contentPaddingLeft="8dp"
        app:contentPaddingRight="8dp"
        app:contentPaddingTop="16dp"
        app:layout_constraintBottom_toTopOf="@+id/guideline"
        app:layout_constraintEnd_toStartOf="@+id/badge2Space"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_weight="1"
        app:layout_constraintStart_toEndOf="@+id/badge1Space"
        app:layout_constraintTop_toBottomOf="@+id/sourcesCardView"
        app:layout_constraintVertical_bias="0.0">

        <TextView
            android:id="@+id/helpTextView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="@string/help_label" />

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:elevation="10dp"
        android:shape="ring"
        app:cardCornerRadius="75dp"
        app:layout_constraintBottom_toTopOf="@+id/helpCardView"
        app:layout_constraintEnd_toEndOf="@+id/helpCardView"
        app:layout_constraintStart_toStartOf="@+id/helpCardView"
        app:layout_constraintTop_toTopOf="@+id/helpCardView">

        <ImageView
            android:id="@+id/projectImageView"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_margin="5dp"
            android:contentDescription="@string/help_label"
            android:elevation="15dp"
            app:srcCompat="@drawable/ic_help_24dp" />
    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:id="@+id/supportCardView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="34dp"
        android:layout_marginEnd="16dp"
        android:elevation="10dp"
        app:cardCornerRadius="8dp"
        app:contentPaddingBottom="16dp"
        app:contentPaddingLeft="8dp"
        app:contentPaddingRight="8dp"
        app:contentPaddingTop="16dp"
        app:layout_constraintBottom_toBottomOf="@+id/helpCardView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintHorizontal_weight="1"
        app:layout_constraintStart_toEndOf="@+id/badge2Space"
        app:layout_constraintTop_toBottomOf="@+id/sourcesCardView">

        <TextView
            android:id="@+id/supportTextView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:text="@string/support_label" />

    </androidx.cardview.widget.CardView>

    <androidx.cardview.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:elevation="10dp"
        android:shape="ring"
        app:cardCornerRadius="75dp"
        app:layout_constraintBottom_toTopOf="@+id/supportCardView"
        app:layout_constraintEnd_toEndOf="@+id/supportCardView"
        app:layout_constraintStart_toStartOf="@+id/supportCardView"
        app:layout_constraintTop_toTopOf="@+id/supportCardView">

        <ImageView
            android:id="@+id/supportImageView"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_margin="5dp"
            android:contentDescription="@string/support_label"
            android:elevation="15dp"
            app:srcCompat="@drawable/baseline_favorite_24" />
    </androidx.cardview.widget.CardView>

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="top"
        app:layout_constraintTop_toBottomOf="@id/helpCardView"
        tools:layout_editor_absoluteX="411dp" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_end="32dp" />

</androidx.constraintlayout.widget.ConstraintLayout>
