DishDelish/dishdelish-app

View on GitHub
app/src/main/res/layout/comment_item.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="wrap_content">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/commentLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/comment_box"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/profilePhoto"
            android:layout_width="75dp"
            android:layout_height="105dp"
            android:layout_marginStart="15dp"
            android:background="@drawable/comment_box"
            android:clipToOutline="true"
            app:layout_constraintStart_toStartOf="parent"

            app:layout_constraintTop_toTopOf="parent"
            tools:srcCompat="@tools:sample/avatars" />

        <LinearLayout
            android:id="@+id/textLayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@id/profilePhoto"
            android:layout_marginStart="16dp"
            android:layout_toEndOf="@id/profilePhoto"
            android:orientation="vertical"
            app:layout_constraintStart_toEndOf="@+id/profilePhoto"
            app:layout_constraintTop_toTopOf="@+id/profilePhoto">

            <TextView
                android:id="@+id/userName"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignStart="@id/textLayout"
                android:layout_marginStart="10dp"
                android:layout_marginTop="5dp"
                android:fontFamily="@font/poppins"
                android:text="User"
                android:textColor="@color/black" />

            <TextView
                android:id="@+id/commentText"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignStart="@id/textLayout"
                android:layout_marginTop="5dp"
                android:layout_marginEnd="15dp"
                android:layout_marginBottom="5dp"
                android:fontFamily="@font/poppins"
                android:text="This is a comment"
                android:textColor="@color/black" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/thumbLayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@id/textLayout"
            android:layout_marginBottom="4dp"
            android:layout_toEndOf="@id/profilePhoto"
            android:gravity="end"
            android:orientation="horizontal"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintStart_toStartOf="@+id/textLayout">

            <ToggleButton
                android:id="@+id/thumbButton"
                android:layout_width="25dp"
                android:layout_height="25dp"
                android:background="@drawable/ic_thumb_empty"
                android:textOff=""
                android:textOn="" />

            <TextView
                android:id="@+id/likeCount"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="4dp"
                android:fontFamily="@font/poppins"
                android:text="5"
                android:textColor="#333333"
                android:textSize="16sp"
                app:layout_constraintStart_toEndOf="@+id/thumbButton" />

            <Button
                android:id="@+id/replyButton"
                android:layout_width="25dp"
                android:layout_height="25dp"
                android:layout_alignBottom="@id/thumbLayout"
                android:layout_marginStart="20dp"
                android:background="@drawable/ic_reply"
                android:text=""
                app:layout_constraintStart_toEndOf="@+id/likeCount"
                tools:layout_editor_absoluteY="76dp" />


        </LinearLayout>


    </androidx.constraintlayout.widget.ConstraintLayout>



    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/repliesRecyclerView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="40dp"
        android:layout_marginTop="5dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="@+id/commentLayout"
        app:layout_constraintStart_toStartOf="@+id/commentLayout"
        app:layout_constraintTop_toBottomOf="@+id/commentLayout" />

    <EditText
        android:id="@+id/enterReply"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/repliesRecyclerView"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="15dp"
        android:background="@drawable/write_comment_box"
        android:hint="Reply"
        android:paddingStart="10dp"
        android:paddingLeft="15dp"
        android:paddingTop="5dp"
        android:paddingEnd="45dp"
        android:paddingBottom="5dp"
        android:text=""
        android:textColor="@color/black"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="@+id/repliesRecyclerView"
        app:layout_constraintStart_toStartOf="@+id/repliesRecyclerView"
        app:layout_constraintTop_toBottomOf="@+id/repliesRecyclerView" />

    <Button
        android:id="@+id/sendReplyButton"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_marginEnd="10dp"
        android:layout_marginBottom="5dp"
        android:background="@drawable/ic_send"
        android:text=""
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="@+id/enterReply"
        app:layout_constraintEnd_toEndOf="@+id/enterReply"
        app:layout_constraintTop_toTopOf="@+id/enterReply" />

</androidx.constraintlayout.widget.ConstraintLayout>