wip: "send comments" interface

This commit is contained in:
aayush262 2024-02-12 21:43:29 +05:30
parent 4be4a0968d
commit b3de2f805f
8 changed files with 172 additions and 38 deletions

View file

@ -108,6 +108,8 @@
<activity
android:name=".others.imagesearch.ImageSearchActivity"
android:parentActivityName=".MainActivity" />
<activity
android:name=".media.CommentsFragment" />
<activity
android:name=".media.SearchActivity"
android:parentActivityName=".MainActivity" />

View file

@ -0,0 +1,34 @@
package ani.dantotsu.media
import android.os.Bundle
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.updateLayoutParams
import ani.dantotsu.connections.anilist.Anilist
import ani.dantotsu.databinding.FragmentCommentsBinding
import ani.dantotsu.loadImage
import ani.dantotsu.navBarHeight
import ani.dantotsu.snackString
import ani.dantotsu.statusBarHeight
import ani.dantotsu.themes.ThemeManager
class CommentsFragment : AppCompatActivity(){
lateinit var binding: FragmentCommentsBinding
//Comments
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ThemeManager(this).applyTheme()
binding = FragmentCommentsBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.CommentsLayout.updateLayoutParams<ViewGroup.MarginLayoutParams> {
topMargin = statusBarHeight
bottomMargin = navBarHeight
}
binding.commentUserAvatar.loadImage(Anilist.avatar)
binding.commentTitle.text = "Work in progress"
binding.commentSend.setOnClickListener {
//TODO
}
}
}

View file

@ -2,10 +2,8 @@ package ani.dantotsu.media.anime
import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import android.view.LayoutInflater
import android.view.View
import android.os.Bundle
import ani.dantotsu.settings.FAQActivity
import android.view.ViewGroup
import android.widget.ArrayAdapter
@ -20,6 +18,7 @@ import ani.dantotsu.*
import ani.dantotsu.databinding.DialogLayoutBinding
import ani.dantotsu.databinding.ItemAnimeWatchBinding
import ani.dantotsu.databinding.ItemChipBinding
import ani.dantotsu.media.CommentsFragment
import ani.dantotsu.media.Media
import ani.dantotsu.media.MediaDetailsActivity
import ani.dantotsu.media.SourceSearchDialogFragment
@ -60,20 +59,22 @@ class AnimeWatchAdapter(
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val binding = holder.binding
_binding = binding
//Youtube
if (media.anime!!.youtube != null && PrefManager.getVal(PrefName.ShowYtButton)) {
binding.animeSourceYT.visibility = View.VISIBLE
binding.animeSourceYT.setOnClickListener {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(media.anime.youtube))
fragment.requireContext().startActivity(intent)
}
//Comments
binding.animeComments.visibility = View.GONE
binding.animeComments.setOnClickListener {
startActivity(
fragment.requireContext(),
Intent(fragment.requireContext(), CommentsFragment::class.java),
null
)
}
//Fuck u launch
binding.faqbutton.setOnClickListener {
val intent = Intent(fragment.requireContext(), FAQActivity::class.java)
startActivity(fragment.requireContext(), intent, null)
startActivity(
fragment.requireContext(),
Intent(fragment.requireContext(), FAQActivity::class.java),
null
)
}
binding.animeSourceDubbed.isChecked = media.selected!!.preferDub

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="M240,560h320v-80L240,480v80ZM240,440h480v-80L240,360v80ZM240,320h480v-80L240,240v80ZM80,880v-720q0,-33 23.5,-56.5T160,80h640q33,0 56.5,23.5T880,160v480q0,33 -23.5,56.5T800,720L240,720L80,880ZM206,640h594v-480L160,160v525l46,-45ZM160,640v-480,480Z"/>
</vector>

View file

@ -0,0 +1,11 @@
<vector android:alpha="0.9"
android:height="24dp"
android:viewportHeight="25"
android:viewportWidth="25"
android:tint="?attr/colorControlNormal"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/white"
android:pathData="M19.117,12.648C19.474,12.858 19.934,12.738 20.143,12.381C20.353,12.024 20.233,11.564 19.876,11.355L19.117,12.648ZM6.943,4.637L6.556,5.279L6.564,5.283L6.943,4.637ZM5.924,4.66L5.508,4.036L5.508,4.036L5.924,4.66ZM5.51,5.592L4.768,5.702C4.776,5.751 4.788,5.8 4.805,5.847L5.51,5.592ZM7.124,12.257C7.265,12.646 7.695,12.848 8.084,12.707C8.474,12.566 8.675,12.136 8.535,11.746L7.124,12.257ZM19.876,12.648C20.233,12.439 20.353,11.979 20.143,11.622C19.934,11.265 19.474,11.145 19.117,11.355L19.876,12.648ZM6.943,19.367L6.564,18.72L6.556,18.724L6.943,19.367ZM5.924,19.343L5.508,19.967L5.508,19.967L5.924,19.343ZM5.51,18.412L4.805,18.156C4.788,18.204 4.776,18.252 4.768,18.302L5.51,18.412ZM8.535,12.257C8.675,11.867 8.474,11.437 8.084,11.296C7.695,11.155 7.265,11.357 7.124,11.746L8.535,12.257ZM19.496,12.752C19.91,12.752 20.246,12.416 20.246,12.002C20.246,11.587 19.91,11.252 19.496,11.252L19.496,12.752ZM7.829,11.252C7.415,11.252 7.079,11.587 7.079,12.002C7.079,12.416 7.415,12.752 7.829,12.752L7.829,11.252ZM19.876,11.355L7.323,3.99L6.564,5.283L19.117,12.648L19.876,11.355ZM7.33,3.994C6.766,3.654 6.056,3.67 5.508,4.036L6.34,5.284C6.405,5.241 6.489,5.239 6.556,5.279L7.33,3.994ZM5.508,4.036C4.96,4.401 4.672,5.05 4.768,5.702L6.252,5.482C6.241,5.404 6.275,5.327 6.34,5.284L5.508,4.036ZM4.805,5.847L7.124,12.257L8.535,11.746L6.216,5.336L4.805,5.847ZM19.117,11.355L6.564,18.72L7.323,20.013L19.876,12.648L19.117,11.355ZM6.556,18.724C6.489,18.764 6.405,18.763 6.34,18.719L5.508,19.967C6.056,20.333 6.766,20.349 7.33,20.009L6.556,18.724ZM6.34,18.719C6.275,18.676 6.241,18.599 6.252,18.521L4.768,18.302C4.672,18.953 4.96,19.602 5.508,19.967L6.34,18.719ZM6.216,18.667L8.535,12.257L7.124,11.746L4.805,18.156L6.216,18.667ZM19.496,11.252L7.829,11.252L7.829,12.752L19.496,12.752L19.496,11.252Z"/>
</vector>

View file

@ -1,21 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout 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">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/commentsLayout">
<TextView
android:id="@+id/itemCommentTitle"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="8dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@drawable/ic_round_comment_24"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/commentTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/poppins_bold"
android:text="@string/comments"
android:textSize="16sp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/commentsList"
android:layout_width="match_parent"
@ -24,5 +45,51 @@
android:layout_marginTop="12dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
tools:listitem="@layout/item_comments" />
tools:listitem="@layout/item_comments"
android:orientation="vertical"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="8dp"
android:layout_gravity="bottom|end"
android:background="@color/nav_bg">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/commentUserAvatar"
android:layout_width="42dp"
android:layout_height="42dp"
android:scaleType="center"
android:layout_marginStart="32dp"
app:srcCompat="@drawable/ic_round_add_circle_24"
tools:ignore="ContentDescription,ImageContrastCheck" />
<EditText
android:id="@+id/commentInput"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textSize="12sp"
android:fontFamily="@font/poppins_semi_bold"
android:hint="Add a comment..."
android:inputType="text"
android:padding="8dp"
android:background="@drawable/card_outline"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
tools:ignore="HardcodedText"
android:autofillHints="The One Piece is real" />
<ImageButton
android:id="@+id/commentSend"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginEnd="32dp"
android:background="@drawable/ic_round_send_24"
tools:ignore="ContentDescription" />
</LinearLayout>
</FrameLayout>

View file

@ -20,21 +20,22 @@
android:padding="32dp">
<Button
android:id="@+id/animeSourceYT"
android:id="@+id/animeComments"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:backgroundTint="@color/yt_red"
android:backgroundTint="?attr/colorSurfaceVariant"
android:fontFamily="@font/poppins_bold"
android:insetTop="0dp"
android:insetBottom="0dp"
android:text="@string/play_yt"
android:text="@string/comments"
android:textColor="@color/bg_white"
android:visibility="gone"
app:cornerRadius="12dp"
app:icon="@drawable/ic_round_play_circle_24"
app:icon="@drawable/ic_round_comment_24"
app:iconTint="@color/bg_white"
tools:ignore="TextContrastCheck" />
tools:ignore="TextContrastCheck"
tools:visibility="visible"/>
<TextView
android:id="@+id/animeSourceTitle"

View file

@ -11,9 +11,10 @@
android:orientation="horizontal"
android:background="@drawable/card_outline"
android:backgroundTint="?attr/colorSurfaceVariant"
android:padding="12dp"
android:padding="6dp"
android:paddingStart="12dp"
android:paddingEnd="12dp">
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/commentUserAvatar"
android:layout_marginTop="4dp"
@ -30,10 +31,12 @@
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"
@ -42,6 +45,7 @@
android:text="Username"
android:textSize="15sp"
tools:ignore="HardcodedText,RtlSymmetry"/>
<TextView
android:id="@+id/commentUserTime"
android:layout_width="wrap_content"
@ -52,7 +56,9 @@
android:text="Time"
android:textSize="12sp"
tools:ignore="HardcodedText,RtlSymmetry" />
</LinearLayout>
<TextView
android:id="@+id/commentText"
android:layout_width="match_parent"
@ -70,7 +76,9 @@
android:layout_gravity="end"
android:fontFamily="@font/poppins_semi_bold"
app:srcCompat="@drawable/ic_round_reply_24"
android:textSize="12sp" />
android:textSize="12sp"
android:layout_marginTop="-6dp"
tools:ignore="ContentDescription" />
</LinearLayout>