fix warnings

This commit is contained in:
Bnyro 2022-11-06 10:27:53 +01:00
parent 8707059d6e
commit 1808bbceee
2 changed files with 35 additions and 31 deletions

View File

@ -5,6 +5,7 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@ -71,8 +72,7 @@ class CommentsAdapter(
if (comment.hearted == true) heartedImageView.visibility = View.VISIBLE
if (comment.repliesPage != null) repliesAvailable.visibility = View.VISIBLE
if ((comment.replyCount ?: -1L) > 0L) {
repliesCount.text =
comment.replyCount?.formatShort()
repliesCount.text = comment.replyCount?.formatShort()
}
commentorImage.setOnClickListener {
@ -89,16 +89,29 @@ class CommentsAdapter(
repliesRecView.adapter = repliesAdapter
if (!isRepliesAdapter && comment.repliesPage != null) {
root.setOnClickListener {
showMoreReplies(comment.repliesPage, showMore, repliesAdapter)
}
}
root.setOnLongClickListener {
ClipboardHelper(root.context).save(comment.commentText.toString())
Toast.makeText(root.context, R.string.copied, Toast.LENGTH_SHORT).show()
true
}
}
}
private fun showMoreReplies(nextPage: String, showMoreBtn: Button, repliesAdapter: CommentsAdapter) {
when {
repliesAdapter.itemCount.equals(0) -> {
fetchReplies(comment.repliesPage) {
fetchReplies(nextPage) {
repliesAdapter.updateItems(it.comments)
if (repliesPage.nextpage == null) {
showMore.visibility = View.GONE
showMoreBtn.visibility = View.GONE
return@fetchReplies
}
showMore.visibility = View.VISIBLE
showMore.setOnClickListener {
showMoreBtn.visibility = View.VISIBLE
showMoreBtn.setOnClickListener {
if (repliesPage.nextpage == null) {
it.visibility = View.GONE
return@setOnClickListener
@ -113,16 +126,7 @@ class CommentsAdapter(
}
else -> {
repliesAdapter.clear()
showMore.visibility = View.GONE
}
}
}
}
root.setOnLongClickListener {
ClipboardHelper(root.context).save(comment.commentText.toString())
Toast.makeText(root.context, R.string.copied, Toast.LENGTH_SHORT).show()
true
showMoreBtn.visibility = View.GONE
}
}
}

View File

@ -30,11 +30,11 @@ class PlaybackSpeedSheet(
binding.speed.value = player.playbackParameters.speed
binding.pitch.value = player.playbackParameters.pitch
binding.speed.addOnChangeListener { _, value, _ ->
binding.speed.addOnChangeListener { _, _, _ ->
onChange()
}
binding.pitch.addOnChangeListener { _, value, _ ->
binding.pitch.addOnChangeListener { _, _, _ ->
onChange()
}