Fix that multiple comments are hightlighted sometimes

This commit is contained in:
Bnyro 2023-01-30 16:44:50 +01:00
parent 758f559811
commit ec25173503
3 changed files with 11 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.MarginLayoutParams
import android.widget.Toast
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.text.parseAsHtml
import androidx.core.view.updateLayoutParams
import androidx.core.view.updatePadding
@ -79,12 +80,14 @@ class CommentsAdapter(
repliesAvailable.visibility = View.GONE
// highlight the comment that is being replied to
if (position == 0) {
if (comment == comments.firstOrNull()) {
root.setBackgroundColor(
ThemeHelper.getThemeColor(root.context, R.attr.colorSurface)
)
root.updatePadding(top = 20)
root.updateLayoutParams<MarginLayoutParams> { bottomMargin = 20 }
} else {
root.background = AppCompatResources.getDrawable(root.context, R.drawable.rounded_ripple)
}
}

View File

@ -22,7 +22,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.serialization.json.Json
class CommentsRepliesFragment : Fragment() {
private lateinit var binding: FragmentCommentsBinding

View File

@ -524,9 +524,13 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
}
private fun toggleDescription() {
var viewInfo = if (!streams.livestream) TextUtils.SEPARATOR + localizedDate(
streams.uploadDate
) else ""
var viewInfo = if (!streams.livestream) {
TextUtils.SEPARATOR + localizedDate(
streams.uploadDate
)
} else {
""
}
if (binding.descLinLayout.isVisible) {
// hide the description and chapters
binding.playerDescriptionArrow.animate().rotation(0F).setDuration(250).start()