meili-epfl/Meili

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

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout 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"
    android:orientation="vertical"
    tools:context=".review.ReviewsActivity">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        app:layout_constraintBottom_toTopOf="@id/navigation">

        <LinearLayout
            android:id="@+id/edit_review"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            app:layout_constraintTop_toTopOf="parent">

            <RatingBar
                android:id="@+id/rating_bar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center" />

            <EditText
                android:id="@+id/review_edit_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autofillHints=""
                android:hint="@string/title_hint"
                android:inputType="textShortMessage"
                android:textSize="25sp" />


            <EditText
                android:id="@+id/review_edit_summary"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="2"
                android:autofillHints=""
                android:gravity="top"
                android:hint="@string/summary_hint"
                android:inputType="textMultiLine"
                android:textSize="15sp" />


            <androidx.constraintlayout.widget.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="top"
                android:layout_weight="2">

                <Button
                    android:id="@+id/submit_review"
                    style="@style/Theme.Meili.button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="onReviewButtonClick"
                    android:text="@string/submit_text"
                    android:theme="@style/Theme.Meili.button"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintHorizontal_bias="0.75"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <Button
                    android:id="@+id/cancel_review"
                    style="@style/Theme.Meili.button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="onReviewButtonClick"
                    android:text="@string/cancel_text"
                    android:theme="@style/Theme.Meili.button"
                    app:layout_constraintBottom_toBottomOf="parent"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintHorizontal_bias="0.25"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

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

        <RelativeLayout
            android:id="@+id/list_reviews"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintTop_toTopOf="parent">

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

                <TextView
                    android:id="@+id/average_rating"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:textSize="25sp"
                    app:layout_constraintBottom_toBottomOf="parent"
                    android:layout_marginStart="16dp"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <RatingBar
                    android:id="@+id/average_ratingbar"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:isIndicator="true"
                    android:theme="@style/RatingBar"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />
            </androidx.constraintlayout.widget.ConstraintLayout>

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/reviews_recycler_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@id/average_rating_container" />

            <com.google.android.material.floatingactionbutton.FloatingActionButton
                android:id="@+id/fab_add_edit_review"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="40dp"
                android:clickable="true"
                android:contentDescription="@string/fab_review_content_description"
                android:focusable="true"
                android:foregroundGravity="center"
                android:onClick="onReviewButtonClick" />

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

    <com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:itemIconTint="@drawable/navigation_selector"
        app:itemTextColor="@drawable/navigation_selector"
        app:layout_constraintBottom_toBottomOf="parent"
        app:menu="@menu/poi_navigation_menu" />

</LinearLayout>