PolyBooks/sdp_polyBooks

View on GitHub
app/src/main/res/layout/activity_filtering_books.xml

Summary

Maintainability
Test Coverage
<?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"
    tools:context=".activities.FilteringBooksActivity">

    <!--    Reset default filtering values-->
    <Button
        android:id="@+id/reset_button"
        android:text= "@string/reset"
        android:onClick="resetParameters"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="9dp"
        android:layout_marginEnd="9dp"
        android:textAllCaps="false"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        style="@style/Button" />


    <!--    Go to results -->
    <Button
        android:id="@+id/results_button"
        android:text="@string/results"
        android:onClick="getResults"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="9dp"
        app:layout_constraintBottom_toTopOf="@id/bottom_navigation"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        style="@style/Button" />

    <ScrollView
        android:id="@+id/main_scroll"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@id/results_button"
        app:layout_constraintTop_toBottomOf="@+id/reset_button"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintVertical_bias="1.0"
        app:layout_goneMarginBottom="9dp"
        >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:padding="9dp">

            <!-- Search a book name and or isbn -->
            <LinearLayout
                android:id="@+id/name_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/name"
                    android:textAllCaps="false"
                    android:textSize="20sp" />

                <EditText
                    android:id="@+id/book_name"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:hint="@string/enter_book_name"
                    android:importantForAutofill="no"
                    android:inputType="textFilter" />

            </LinearLayout>

            <!-- Search an ISBN  -->
            <LinearLayout
                android:id="@+id/isbn_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/book_isbn"
                    android:textAllCaps="false"
                    android:textSize="20sp" />

                <EditText
                    android:id="@+id/book_isbn"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:hint="@string/enter_book_isbn"
                    android:importantForAutofill="no"
                    android:inputType="textFilter" />
            </LinearLayout>

            <!-- Sort by parameter -->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:text="@string/sort_by"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAllCaps="false"
                    android:textSize="20sp" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/book_sort_parameter"
                    android:nestedScrollingEnabled="false"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                </androidx.recyclerview.widget.RecyclerView>

            </LinearLayout>


            <!-- Field parameter (eg. Computer Science, Biology) -->
            <LinearLayout
                android:id="@+id/field_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:text="@string/interest_field"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAllCaps="false"
                    android:textSize="20sp" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/field_parameter"
                    android:nestedScrollingEnabled="false"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                </androidx.recyclerview.widget.RecyclerView>
            </LinearLayout>

            <!-- Semester Parameter (eg. IC-BA1, MA-BA6) -->
            <LinearLayout
                android:id="@+id/semester_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:text="@string/interest_semester"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAllCaps="false"
                    android:textSize="20sp" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/semester_parameter"
                    android:nestedScrollingEnabled="false"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                </androidx.recyclerview.widget.RecyclerView>
            </LinearLayout>


            <!-- Course parameter (eg. CS306) -->
            <LinearLayout
                android:id="@+id/course_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <TextView
                    android:text="@string/interest_course"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textAllCaps="false"
                    android:textSize="20sp" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/course_parameter"
                    android:nestedScrollingEnabled="false"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">
                </androidx.recyclerview.widget.RecyclerView>
            </LinearLayout>

        </LinearLayout>

    </ScrollView>
    <!--    Lists of parameters -->

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:menu="@menu/bottom_navigation_menu"
        app:layout_constraintBottom_toBottomOf="parent"
        app:labelVisibilityMode="labeled"
        />
</androidx.constraintlayout.widget.ConstraintLayout>