<?xml version="1.0" encoding="utf-8"?><!--
    Copyright 2022 Thomas Schneider

    This file is a part of Fedilab

    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.

    Fedilab 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 Fedilab; if not,
    see <http://www.gnu.org/licenses>.
-->
<androidx.appcompat.widget.LinearLayoutCompat 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="wrap_content"
    android:orientation="vertical">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/main_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <androidx.appcompat.widget.AppCompatImageView
                android:id="@+id/background_image"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:alpha="0.2"
                android:scaleType="centerCrop"
                app:layout_constraintDimensionRatio="1:1"
                app:layout_constraintTop_toTopOf="parent"
                tools:src="@tools:sample/backgrounds/scenic" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="6dp"
                android:textAlignment="center"
                android:textAppearance="@style/TextAppearance.Material3.TitleLarge"
                app:layout_constraintBottom_toTopOf="@id/description_container"
                app:layout_constraintTop_toTopOf="@id/background_image"
                app:layout_constraintVertical_chainStyle="packed"
                tools:text="Instance" />

            <androidx.core.widget.NestedScrollView
                android:id="@+id/description_container"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                app:layout_constraintBottom_toTopOf="@id/version"
                app:layout_constraintTop_toBottomOf="@id/name">

                <com.google.android.material.textview.MaterialTextView
                    android:id="@+id/description"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginHorizontal="6dp"
                    android:layout_marginTop="6dp"
                    android:textAlignment="center"
                    android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
                    tools:maxLines="6"
                    tools:text="@tools:sample/lorem/random" />
            </androidx.core.widget.NestedScrollView>


            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/version"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="6dp"
                android:textAlignment="center"
                android:textAppearance="@style/TextAppearance.Material3.LabelMedium"
                app:layout_constraintBottom_toTopOf="@id/uri"
                app:layout_constraintTop_toBottomOf="@id/description_container"
                tools:text="4.0" />

            <com.google.android.material.button.MaterialButton
                android:id="@+id/uri"
                style="@style/Fedilab.OutlinedButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="6dp"
                app:cornerRadius="0dp"
                app:icon="@drawable/ic_open_external"
                app:iconGravity="end"
                app:layout_constraintBottom_toTopOf="@id/contact"
                tools:text="instance.test" />

            <com.google.android.material.button.MaterialButton
                android:id="@+id/contact"
                style="@style/Fedilab.OutlinedButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="6dp"
                android:text="@string/contact_instance_admin"
                app:cornerRadius="0dp"
                app:icon="@drawable/ic_baseline_mail_outline_24"
                app:iconGravity="end"
                app:layout_constraintBottom_toBottomOf="@id/background_image" />

            <androidx.constraintlayout.widget.Group
                android:id="@+id/instance_data"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:visibility="gone"
                app:constraint_referenced_ids="name,description_container,version,uri,contact"
                tools:visibility="visible" />

            <com.google.android.material.progressindicator.CircularProgressIndicator
                android:id="@+id/loader"
                style="@style/Widget.Material3.LinearProgressIndicator"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:indeterminate="true"
                android:indeterminateOnly="true"
                app:layout_constraintBottom_toBottomOf="@id/background_image"
                app:layout_constraintEnd_toEndOf="@id/background_image"
                app:layout_constraintStart_toStartOf="@id/background_image"
                app:layout_constraintTop_toTopOf="@id/background_image" />

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/max_char_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="6dp"
                android:layout_marginTop="12dp"
                android:hint="@string/set_your_max_char_count"
                app:layout_constraintTop_toBottomOf="@id/background_image">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/max_char"
                    style="@style/Widget.Material3.TextInputEditText.OutlinedBox.Dense"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="number"
                    tools:text="500" />

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

            <com.google.android.material.button.MaterialButton
                android:id="@+id/about"
                style="@style/Fedilab.OutlinedButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="6dp"
                android:layout_marginTop="12dp"
                android:text="@string/action_about_instance"
                app:icon="@drawable/ic_open_external"
                app:iconGravity="end"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/max_char_container" />

            <com.google.android.material.button.MaterialButton
                android:id="@+id/privacy"
                style="@style/Fedilab.OutlinedButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="6dp"
                android:layout_marginTop="6dp"
                android:text="@string/action_privacy_policy"
                app:icon="@drawable/ic_open_external"
                app:iconGravity="end"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/about" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </ScrollView>

    <com.google.android.material.button.MaterialButton
        android:id="@+id/close"
        style="@style/Widget.Material3.Button.OutlinedButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginTop="24dp"
        android:layout_marginBottom="12dp"
        android:text="@string/close" />

</androidx.appcompat.widget.LinearLayoutCompat>