[Android] Remove useless call to chapters in the video player options

Nicolas Pomepuy git at videolan.org
Tue Feb 8 14:39:35 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Jan 24 09:55:29 2022 +0100| [0f000b71b331b41c4c3f166cc0445a58ac89d389] | committer: Nicolas Pomepuy

Remove useless call to chapters in the video player options

> https://code.videolan.org/videolan/vlc-android/commit/0f000b71b331b41c4c3f166cc0445a58ac89d389
---

 .../vlc/gui/helpers/PlayerOptionsDelegate.kt       | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
index b1724b3d6..e4532de07 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/PlayerOptionsDelegate.kt
@@ -289,15 +289,6 @@ class PlayerOptionsDelegate(val activity: FragmentActivity, val service: Playbac
         }
     }
 
-    private fun initChapters(binding: PlayerOptionItemBinding) {
-        val chapters = service.getChapters(-1) ?: return
-        if (chapters.isEmpty()) return
-        val index = service.chapterIdx
-        if (chapters[index].name.isNullOrEmpty())
-            binding.optionTitle.text = String.format("%s %d", res.getString(R.string.chapter), index)
-        else binding.optionTitle.text = chapters[index].name
-    }
-
     private fun initRepeat(binding: PlayerOptionItemBinding) {
         repeatBinding = binding
         AppScope.launch(Dispatchers.Main) {
@@ -335,13 +326,12 @@ class PlayerOptionsDelegate(val activity: FragmentActivity, val service: Playbac
         override fun onBindViewHolder(holder: ViewHolder, position: Int) {
             val option = dataset[position]
             holder.binding.option = option
-            when {
-                option.id == ID_ABREPEAT -> abrBinding = holder.binding
-                option.id == ID_PASSTHROUGH -> ptBinding = holder.binding
-                option.id == ID_REPEAT -> initRepeat(holder.binding)
-                option.id == ID_SHUFFLE -> initShuffle(holder.binding)
-                option.id == ID_SLEEP -> sleepBinding = holder.binding
-                option.id == ID_CHAPTER_TITLE -> initChapters(holder.binding)
+            when (option.id) {
+                ID_ABREPEAT -> abrBinding = holder.binding
+                ID_PASSTHROUGH -> ptBinding = holder.binding
+                ID_REPEAT -> initRepeat(holder.binding)
+                ID_SHUFFLE -> initShuffle(holder.binding)
+                ID_SLEEP -> sleepBinding = holder.binding
             }
             holder.binding.optionIcon.setImageResource(option.icon)
         }



More information about the Android mailing list