meili-epfl/Meili

View on GitHub
app/src/main/res/layout/activity_forum.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=".posts.forum.ForumActivity">

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

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/edit_post"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintTop_toTopOf="parent">

            <EditText
                android:id="@+id/post_edit_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autofillHints=""
                android:ems="10"
                android:gravity="start|top"
                android:hint="@string/post_edit_title_hint"
                android:inputType="textMultiLine"
                android:maxLength="70"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <EditText
                android:id="@+id/post_edit_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:autofillHints=""
                android:ems="10"
                android:gravity="start|top"
                android:hint="@string/post_edit_text_hint"
                android:inputType="textMultiLine"
                android:maxLength="500"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/post_edit_title" />

            <ImageView
                android:id="@+id/post_display_image"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:contentDescription="@string/images"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHeight_percent="0.5"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/post_edit_text" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/post_display_image">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">

                    <ImageView
                        android:id="@+id/post_use_camera"
                        android:layout_width="100dp"
                        android:layout_height="50dp"
                        android:contentDescription="@string/use_camera"
                        android:onClick="onClick"
                        app:srcCompat="@android:drawable/ic_menu_camera" />

                    <ImageView
                        android:id="@+id/post_use_gallery"
                        android:layout_width="100dp"
                        android:layout_height="50dp"
                        android:contentDescription="@string/use_gallery"
                        android:onClick="onClick"
                        app:srcCompat="@android:drawable/ic_menu_gallery" />

                </LinearLayout>

                <Button
                    android:id="@+id/cancel_post"
                    style="@style/Theme.Meili.button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="onClick"
                    android:text="@string/cancel"
                    android:theme="@style/Theme.Meili.button" />

                <Button
                    android:id="@+id/submit_post"
                    style="@style/Theme.Meili.button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="onClick"
                    android:text="@string/create_post"
                    android:theme="@style/Theme.Meili.button" />

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

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

            <TextView
                android:id="@+id/sort_by"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:lineSpacingExtra="3sp"
                android:text="@string/sort_by"
                android:textSize="16sp" />

            <Spinner
                android:id="@+id/sort_spinner"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toEndOf="@+id/sort_by" />

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/forum_recycler_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_below="@id/sort_spinner"
                tools:layout_editor_absoluteX="12dp"
                tools:layout_editor_absoluteY="33dp" />

            <com.google.android.material.floatingactionbutton.FloatingActionButton
                android:id="@+id/create_post"
                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/create_post"
                android:focusable="true"
                android:foregroundGravity="center"
                android:onClick="onClick"
                app:srcCompat="@android:drawable/ic_input_add" />
        </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>