wip: UI for comments

This commit is contained in:
aayush262 2024-02-12 01:44:36 +05:30
parent 9dbc3db1b8
commit 97b957a0ab
5 changed files with 126 additions and 1 deletions

View file

@ -504,6 +504,16 @@ class MediaInfoFragment : Fragment() {
)
parent.addView(bind.root)
}
// Comments Section
if (!offline) {
val bind = FragmentCommentsBinding.inflate(
LayoutInflater.from(context),
parent,
false
)
bind.commentsList.adapter // rebel take over
parent.addView(bind.root)
}
}
}

View file

@ -0,0 +1,10 @@
<vector android:alpha="0.9" android:height="24dp"
android:viewportHeight="960"
android:viewportWidth="960"
android:tint="?attr/colorControlNormal"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/white"
android:pathData="M760,760v-160q0,-50 -35,-85t-85,-35L273,480l144,144 -57,56 -240,-240 240,-240 57,56 -144,144h367q83,0 141.5,58.5T840,600v160h-80Z"/>
</vector>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/itemCommentTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="32dp"
android:fontFamily="@font/poppins_bold"
android:text="@string/comments"
android:textSize="16sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/commentsList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
tools:listitem="@layout/item_comments" />
</LinearLayout>

View file

@ -0,0 +1,77 @@
<?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:id="@+id/commentsCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="12dp"
android:orientation="horizontal"
android:background="@drawable/card_outline"
android:backgroundTint="?attr/colorSurfaceVariant"
android:padding="12dp"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/commentUserAvatar"
android:layout_marginTop="4dp"
android:layout_width="36dp"
android:layout_height="36dp"
android:scaleType="center"
app:srcCompat="@drawable/ic_round_add_circle_24"
tools:ignore="ContentDescription,ImageContrastCheck" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/commentUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_semi_bold"
android:text="Username"
android:textSize="15sp"
tools:ignore="HardcodedText,RtlSymmetry"/>
<TextView
android:id="@+id/commentUserTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="6dp"
android:alpha="0.6"
android:fontFamily="@font/poppins_semi_bold"
android:text="Time"
android:textSize="12sp"
tools:ignore="HardcodedText,RtlSymmetry" />
</LinearLayout>
<TextView
android:id="@+id/commentText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_semi_bold"
android:maxLines="3"
android:ellipsize="end"
android:text="@string/slogan"
android:textSize="12sp" />
<ImageView
android:id="@+id/commentReply"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_gravity="end"
android:fontFamily="@font/poppins_semi_bold"
app:srcCompat="@drawable/ic_round_reply_24"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>

View file

@ -657,5 +657,5 @@
<string name="import_export_settings">Import/Export Settings</string>
<string name="import_settings">Import Settings</string>
<string name="try_internal_cast_experimental">Try Internal Cast (Experimental)</string>
<string name="comments">Comments</string>
</resources>