Merge pull request #2264 from Kruna1Pate1/feat/exact-view-count

Show/Hide exact view count with description toggle
This commit is contained in:
Bnyro 2022-12-06 11:13:08 +01:00 committed by GitHub
commit 72ac9c5f4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -457,15 +457,24 @@ class PlayerFragment : BaseFragment(), OnlinePlayerOptions {
}
private fun toggleDescription() {
var viewInfo = if (!isLive) TextUtils.SEPARATOR + streams.uploadDate else ""
if (binding.descLinLayout.isVisible) {
// hide the description and chapters
binding.playerDescriptionArrow.animate().rotation(0F).setDuration(250).start()
binding.descLinLayout.visibility = View.GONE
// show formated short view count
viewInfo = getString(R.string.views, streams.views.formatShort()) + viewInfo
} else {
// show the description and chapters
binding.playerDescriptionArrow.animate().rotation(180F).setDuration(250).start()
binding.descLinLayout.visibility = View.VISIBLE
// show exact view count
viewInfo = getString(R.string.views, String.format("%,d", streams.views)) + viewInfo
}
binding.playerViewsInfo.text = viewInfo
if (this::chapters.isInitialized && chapters.isNotEmpty()) {
val chapterIndex = getCurrentChapterIndex()
// scroll to the current chapter in the chapterRecView in the description