<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
    tools:context=".ui.home.HomeFragment">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="25dp"
        android:paddingBottom="20dp"
        android:paddingHorizontal="20dp">

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cv_headline_top"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:cardCornerRadius="0dp"
            app:cardBackgroundColor="@color/white"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:strokeColor="@color/greenGeneral">

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

                <TextView
                    android:id="@+id/tv_headline_top"
                    android:layout_width="250dp"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/margin_component"
                    android:text="SEMBUHKAN TANAMAN SAWIT ANDA!"
                    android:textColor="@color/greenGeneral"
                    android:textSize="18sp"
                    android:textStyle="bold"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <ImageView
                    android:layout_width="78dp"
                    android:layout_height="78dp"
                    android:scaleType="fitXY"
                    android:src="@drawable/hs_top_image"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </androidx.constraintlayout.widget.ConstraintLayout>
        </com.google.android.material.card.MaterialCardView>

        <!--    Jangan lupa tambahin constraint        -->
        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cv_tutorial"
            android:layout_width="150dp"
            android:layout_height="200dp"
            android:layout_marginTop="@dimen/margin_component"
            android:backgroundTint="@color/white"
            app:cardCornerRadius="0dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/cv_headline_top"
            app:strokeColor="@color/greenGeneral">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="@dimen/margin_component">

                <ImageView
                    android:id="@+id/iv_hs_phone_take_pic"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:src="@drawable/hs_phone_take_pic_img"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/tv_hs_phone_take_pic"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="2dp"
                    android:text="Ambil Gambar"
                    android:textColor="@color/greenGeneral"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/iv_hs_phone_take_pic" />

                <ImageView
                    android:id="@+id/iv_hs_down_arrow"
                    android:layout_width="15dp"
                    android:layout_height="15dp"
                    android:layout_marginTop="5dp"
                    android:rotation="270"
                    android:src="@drawable/back_button"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_hs_phone_take_pic" />

                <ImageView
                    android:id="@+id/iv_hs_phone_analyze"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:layout_marginTop="5dp"
                    android:src="@drawable/hs_phone_analyze_img"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/iv_hs_down_arrow" />

                <TextView
                    android:id="@+id/tv_hs_phone_analyze"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Ambil Gambar"
                    android:textColor="@color/greenGeneral"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/iv_hs_phone_analyze" />

            </androidx.constraintlayout.widget.ConstraintLayout>
        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/btn_hs_camera"
            android:layout_width="150dp"
            android:layout_height="90dp"
            android:backgroundTint="@color/white"
            app:cardCornerRadius="0dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/cv_tutorial"
            app:strokeColor="@color/greenGeneral">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="@dimen/margin_component">

                <ImageView
                    android:id="@+id/tv_camera_img"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:scaleType="center"
                    android:src="@drawable/hs_camera_img"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Gunakan Kamera"
                    android:textColor="@color/greenGeneral"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_camera_img" />
            </androidx.constraintlayout.widget.ConstraintLayout>
        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/btn_hs_gallery"
            android:layout_width="150dp"
            android:layout_height="90dp"
            android:backgroundTint="@color/greenGeneral"
            app:cardCornerRadius="0dp"
            app:layout_constraintBottom_toBottomOf="@id/cv_tutorial"
            app:layout_constraintEnd_toEndOf="parent"
            app:strokeColor="@color/greenGeneral">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="@dimen/margin_component">

                <ImageView
                    android:id="@+id/tv_gallery_img"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:scaleType="center"
                    android:src="@drawable/hs_gallery_img"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Ambil Dari Galeri"
                    android:textColor="@color/white"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_gallery_img" />
            </androidx.constraintlayout.widget.ConstraintLayout>
        </com.google.android.material.card.MaterialCardView>


        <!--        <Button-->
        <!--            android:id="@+id/btn_hs_camera"-->
        <!--            android:layout_width="match_parent"-->
        <!--            android:layout_height="50dp"-->
        <!--            android:layout_marginTop="20dp"-->
        <!--            android:backgroundTint="@color/primaryGreen"-->
        <!--            android:text="Gunakan Kamera"-->
        <!--            android:textColor="@color/black"-->
        <!--            android:textSize="16sp"-->
        <!--            android:textStyle="bold"-->
        <!--            app:layout_constraintEnd_toEndOf="parent"-->
        <!--            app:layout_constraintStart_toStartOf="parent"-->
        <!--            app:layout_constraintTop_toBottomOf="@+id/cv_headline" />-->

        <!--        <Button-->
        <!--            android:id="@+id/btn_hs_gallery"-->
        <!--            android:layout_width="match_parent"-->
        <!--            android:layout_height="wrap_content"-->
        <!--            android:layout_marginTop="10dp"-->
        <!--            android:backgroundTint="@color/primaryGreen"-->
        <!--            android:text="Ambil dari Galeri"-->
        <!--            android:textColor="@color/white"-->
        <!--            android:textSize="16sp"-->
        <!--            app:layout_constraintEnd_toEndOf="parent"-->
        <!--            app:layout_constraintStart_toStartOf="parent"-->
        <!--            app:layout_constraintTop_toBottomOf="@+id/bt_use_camera" />-->

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cv_hs_detail_explanation_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/margin_component"
            app:cardCornerRadius="0dp"
            app:cardBackgroundColor="@color/white"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/cv_tutorial"
            app:strokeColor="@color/greenGeneral">

            <TextView
                android:id="@+id/tv_headline_sickness_explanation"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/margin_component"
                android:text="Baca Tentang Penyakit Brown Spots Pada Daun Tanaman Sawit"
                android:textColor="@color/greenGeneral"
                android:textSize="16sp"
                android:textStyle="bold" />
        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cv_hs_detail_explanation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:strokeColor="@color/greenGeneral"
            android:backgroundTint="@color/greenGeneral"
            android:layout_marginTop="@dimen/margin_component"
            app:cardCornerRadius="0dp"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toBottomOf="@id/cv_hs_detail_explanation_title">
            
            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">
                <ImageView
                    android:id="@+id/iv_hs_detail_explanation"
                    android:layout_width="120dp"
                    android:layout_height="100dp"
                    android:scaleType="center"
                    android:src="@drawable/hs_detail_explanation_img"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent" />

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/fl_home_screen_list_disease"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    app:cardCornerRadius="0dp"
                    app:strokeColor="@color/white"
                    android:backgroundTint="@color/greenGeneral"
                    app:layout_constraintTop_toTopOf="parent"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toEndOf="@id/iv_hs_detail_explanation">
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="10dp"
                        android:textSize="14sp"
                        android:textStyle="bold"

                        android:text="Klik Di sini"
                        android:textColor="@color/white" />
                </com.google.android.material.card.MaterialCardView>
            </androidx.constraintlayout.widget.ConstraintLayout>
        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cv_hs_history_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/margin_component"
            app:cardCornerRadius="0dp"
            app:cardBackgroundColor="@color/white"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/cv_hs_detail_explanation"
            app:strokeColor="@color/greenGeneral">

            <TextView
                android:id="@+id/tv_history_title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/margin_component"
                android:layout_gravity="center"
                android:text="Hasil Analisis Terakhir"
                android:textColor="@color/greenGeneral"
                android:textSize="16sp"
                android:textStyle="bold" />
        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/cd_home_screen_analyze"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            app:cardCornerRadius="0dp"
            android:visibility="gone"
            app:strokeColor="@color/greenGeneral"
            app:strokeWidth="1dp"
            android:layout_marginTop="@dimen/margin_component"
            app:layout_constraintTop_toBottomOf="@+id/cv_hs_history_title"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/rl_home_screen_card_analyze"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:gravity="center"
                android:paddingHorizontal="25dp"
                android:paddingVertical="20dp">

                <com.google.android.material.card.MaterialCardView
                    android:id="@+id/card_result_diagnosis"
                    android:layout_width="75dp"
                    android:layout_height="75dp"
                    app:cardCornerRadius="0dp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent">

                    <ImageView
                        android:id="@+id/img_result_diagnosis"
                        android:layout_width="75dp"
                        android:layout_height="75dp"
                        android:scaleType="fitXY"
                        android:src="@drawable/palm_brown_spots_example_img" />
                </com.google.android.material.card.MaterialCardView>

                <TextView
                    android:id="@+id/date_result_diagnosis"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="11 November 2023"
                    android:layout_marginStart="@dimen/margin_component"
                    android:textColor="@color/grayFont"
                    android:textSize="12sp"
                    android:textStyle="bold"
                    app:layout_constraintStart_toEndOf="@id/card_result_diagnosis"
                    app:layout_constraintTop_toTopOf="@id/card_result_diagnosis" />

                <TextView
                    android:id="@+id/title_result_diagnosis"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/date_result_diagnosis"
                    android:text="Algal Leaf"
                    android:textColor="@color/greenGeneral"
                    android:textSize="20sp"
                    android:textStyle="bold"
                    app:layout_constraintTop_toBottomOf="@id/date_result_diagnosis"
                    app:layout_constraintStart_toStartOf="@id/date_result_diagnosis"/>

                <TextView
                    android:id="@+id/confidence_result_diagnosis"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/title_result_diagnosis"
                    android:text="Confidence: "
                    android:textColor="@color/grayFont"
                    android:textSize="12sp"
                    android:textStyle="bold"
                    app:layout_constraintTop_toBottomOf="@id/title_result_diagnosis"
                    app:layout_constraintStart_toStartOf="@id/title_result_diagnosis"/>

                <ImageView
                    android:id="@+id/img_arrow2"
                    android:layout_width="24dp"
                    android:layout_height="24dp"
                    android:layout_below="@id/date_result_diagnosis"
                    android:layout_alignParentEnd="true"
                    android:contentDescription="TODO"
                    android:scaleType="fitXY"
                    android:rotation="180"
                    android:src="@drawable/back_button"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"/>

            </androidx.constraintlayout.widget.ConstraintLayout>
        </com.google.android.material.card.MaterialCardView>

        <ProgressBar
            android:id="@+id/progress_result"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:visibility="invisible"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>