<?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:id="@+id/setup_box"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="0dp"
    android:padding="0dp"
    app:fitsSystemWindowsInsets="start|end|bottom|top"
    tools:context=".SetupActivity">

    <ScrollView
        android:id="@+id/setupNestedScrollView"
        android:layout_width="match_parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
        android:layout_marginHorizontal="12dp"
        android:layout_height="0dp">

        <LinearLayout
            android:id="@+id/setup_box_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
            app:layout_constraintTop_toTopOf="@id/setup_box">

            <!-- Title -->
            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/setup_title"
                android:layout_width="match_parent"
                android:paddingTop="16dp"
                android:layout_height="wrap_content"
                android:text="@string/setup_title"
                android:textAppearance="@style/TextAppearance.Material3.HeadlineLarge" />

            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/setup_summary"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                android:text="@string/setup_message"
                android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

            <!-- inform user that to finish setup, they need to scroll down -->
            <com.google.android.material.textview.MaterialTextView
                android:id="@+id/setup_scroll_down"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="2dp"
                android:layout_marginVertical="4dp"
                android:text="@string/setup_scroll_down_v2"
                android:textAppearance="@style/TextAppearance.Material3.BodyMedium" />

            <!-- Theme radio select. Options are system, light, dark, black, transparent_light -->

            <!-- Button to trigger theme selection, half width, and in container with language -->
            <LinearLayout
                android:id="@+id/LinearLayout02"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/setup_theme_button"
                    style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:layout_marginEnd="4dp"
                    android:layout_weight="1"
                    android:padding="12dp"
                    android:text="@string/theme"
                    android:textSize="16sp"
                    app:icon="@drawable/ic_baseline_palette_24"
                    app:iconGravity="textStart"
                    app:iconPadding="8dp"
                    app:iconTintMode="src_in"
                    app:rippleColor="@color/gray_800"
                    tools:ignore="DuplicateSpeakableTextCheck" />

                <com.google.android.material.button.MaterialButton
                    android:id="@+id/setup_language_button"
                    style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="4dp"
                    android:layout_marginTop="4dp"
                    android:layout_weight="1"
                    android:padding="12dp"
                    android:text="@string/language"
                    android:textSize="16sp"
                    app:icon="@drawable/ic_baseline_language_24"
                    app:iconGravity="textStart"
                    app:iconPadding="8dp"
                    app:iconTintMode="src_in"
                    app:rippleColor="@color/gray_800"
                    tools:ignore="DuplicateSpeakableTextCheck" />

            </LinearLayout>

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="4dp"
                android:layout_marginVertical="12dp"
                android:text="@string/repos"
                android:textAppearance="@android:style/TextAppearance.Material.Headline" />

            <com.google.android.material.materialswitch.MaterialSwitch
                android:id="@+id/setup_androidacy_repo"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:checked="false"
                android:key="pref_androidacy_repo_enabled"
                android:text="@string/setup_androidacy_repo"
                android:textSize="18sp" />

            <!-- Small summary for above switch -->
            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:drawableStart="@drawable/ic_baseline_info_24"
                android:drawablePadding="8dp"
                android:text="@string/setup_androidacy_repo_summary"
                android:textAppearance="@android:style/TextAppearance.Material.Small" />

            <com.google.android.material.materialswitch.MaterialSwitch
                android:id="@+id/setup_magisk_alt_repo"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:checked="false"
                android:key="pref_magisk_alt_repo_enabled"
                android:text="@string/setup_magisk_alt_repo"
                android:textSize="18sp" />

            <!-- Small summary for above switch -->
            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:drawableStart="@drawable/ic_baseline_info_24"
                android:drawablePadding="8dp"
                android:text="@string/setup_magisk_alt_repo_summary"
                android:textAppearance="@android:style/TextAppearance.Material.Small" />

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                android:text="@string/setup_custom_repos"
                android:textAppearance="@android:style/TextAppearance.Material.Caption" />

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="4dp"
                android:layout_marginVertical="12dp"
                android:text="@string/pref_category_privacy"
                android:textAppearance="@android:style/TextAppearance.Material.Headline" />

            <com.google.android.material.materialswitch.MaterialSwitch
                android:id="@+id/setup_crash_reporting"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:checked="false"
                android:key="pref_crash_reporting_enabled"
                android:text="@string/setup_crash_reporting"
                android:textAppearance="@android:style/TextAppearance.Material.Subhead"
                android:textSize="18sp" />

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:drawableStart="@drawable/ic_baseline_info_24"
                android:drawablePadding="8dp"
                android:text="@string/setup_crash_reporting_summary"
                android:textAppearance="@android:style/TextAppearance.Material.Small" />

            <!-- pii toggle -->
            <com.google.android.material.materialswitch.MaterialSwitch
                android:id="@+id/setup_crash_reporting_pii"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:checked="false"
                android:key="pref_crash_reporting_pii"
                android:text="@string/setup_crash_reporting_pii"
                android:textSize="18sp" />

            <!-- Small summary for above switch -->
            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:drawableStart="@drawable/ic_baseline_info_24"
                android:drawablePadding="8dp"
                android:text="@string/setup_crash_reporting_pii_summary"
                android:textAppearance="@android:style/TextAppearance.Material.Small" />



            <!-- Placeholder for future settings -->
            <com.google.android.material.materialswitch.MaterialSwitch
                android:id="@+id/setup_app_analytics"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:checked="false"
                android:key="pref_app_analytics"
                android:text="@string/setup_app_analytics"
                android:textSize="18sp"
                android:visibility="visible" />

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="2dp"
                android:text="@string/analytics_desc"
                android:drawableStart="@drawable/ic_baseline_info_24"
                android:drawablePadding="8dp" />

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="4dp"
                android:layout_marginVertical="12dp"
                android:text="@string/setup_update_check_headline"
                android:textAppearance="@android:style/TextAppearance.Material.Headline" />

            <com.google.android.material.materialswitch.MaterialSwitch
                android:id="@+id/setup_background_update_check"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:checked="false"
                android:key="pref_background_update_check"
                android:text="@string/setup_background_update_check"
                android:textSize="18sp" />

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:drawableStart="@drawable/ic_baseline_info_24"
                android:drawablePadding="8dp"
                android:text="@string/setup_background_update_check_summary"
                android:textAppearance="@android:style/TextAppearance.Material.Small"
                app:dependency="pref_background_update_check"
                app:icon="@drawable/ic_baseline_info_24" />

            <!-- require wifi switch -->
            <com.google.android.material.materialswitch.MaterialSwitch
                android:id="@+id/setup_background_update_check_require_wifi"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:checked="true"
                android:key="pref_background_update_check_require_wifi"
                android:text="@string/setup_background_update_check_require_wifi"
                android:textSize="18sp" />

            <!-- description for require wifi switch -->
            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="4dp"
                android:drawableStart="@drawable/ic_baseline_info_24"
                android:drawablePadding="8dp"
                android:text="@string/setup_background_update_check_require_wifi_summary"
                android:textAppearance="@android:style/TextAppearance.Material.Small"
                app:icon="@drawable/ic_baseline_info_24" />

            <!-- licenses, disclaimers, and EULA -->
            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginHorizontal="4dp"
                android:layout_marginVertical="12dp"
                android:text="@string/other_section"
                android:textAppearance="@android:style/TextAppearance.Material.Headline" />

            <com.google.android.material.materialswitch.MaterialSwitch
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:checked="false"
                android:id="@+id/setup_agree_eula"
                android:layout_marginHorizontal="2dp"
                android:layout_marginVertical="4dp"
                android:text="@string/eula_sum"
                android:textAppearance="@android:style/TextAppearance.Material.Small"
                android:drawableStart="@drawable/baseline_library_add_check_24"
                android:drawablePadding="8dp" />

            <com.google.android.material.textview.MaterialTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autoLink="web"
                android:textColorLink="@color/blue"
                android:text="@string/eula_agree_v2"
                android:textAppearance="@android:style/TextAppearance.Material.Small" />

        </LinearLayout>

    </ScrollView>


    <!-- bottom nav for cancel and finish -->
    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="0dp"
        android:visibility="visible"
        app:compatShadowEnabled="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/setupNestedScrollView"
        app:menu="@menu/setup_bottom_nav" />

</androidx.constraintlayout.widget.ConstraintLayout>