[Android] Remove debug logs stop button to improve the UI

Nicolas Pomepuy git at videolan.org
Tue Jul 7 12:23:37 UTC 2026


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Mar 28 07:44:24 2025 +0100| [270055ceebdf2f346917ea849fbca8d4d0d57d5e] | committer: Nicolas Pomepuy

Remove debug logs stop button to improve the UI

> https://code.videolan.org/videolan/vlc-android/commit/270055ceebdf2f346917ea849fbca8d4d0d57d5e
---

 application/vlc-android/res/layout/debug_log.xml   | 31 +++++++++++-----------
 .../src/org/videolan/vlc/DebugLogService.kt        |  7 +++++
 .../src/org/videolan/vlc/gui/DebugLogActivity.kt   | 28 ++++++-------------
 3 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/application/vlc-android/res/layout/debug_log.xml b/application/vlc-android/res/layout/debug_log.xml
index e20903278b..5ab2ef46c9 100644
--- a/application/vlc-android/res/layout/debug_log.xml
+++ b/application/vlc-android/res/layout/debug_log.xml
@@ -13,17 +13,20 @@
 
             <Button
                     android:id="@+id/start_log"
-                    android:layout_width="wrap_content"
+                    style="@style/Widget.MaterialComponents.Button.TextButton.Dialog"
+                    android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    android:layout_weight="0.50"
+                    android:layout_weight="1"
                     android:text="@string/start_logging" />
 
             <Button
-                    android:id="@+id/stop_log"
-                    android:layout_width="wrap_content"
+                    android:id="@+id/clear_log"
+                    style="@style/Widget.MaterialComponents.Button.TextButton.Dialog"
+                    android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    android:layout_weight="0.50"
-                    android:text="@string/stop_logging" />
+                    android:layout_weight="1"
+                    android:text="@string/clear_log" />
+
         </LinearLayout>
 
         <LinearLayout
@@ -32,25 +35,21 @@
 
             <Button
                     android:id="@+id/copy_to_clipboard"
-                    android:layout_width="wrap_content"
+                    style="@style/Widget.MaterialComponents.Button.TextButton.Dialog"
+                    android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    android:layout_weight="0.50"
+                    android:layout_weight="1"
                     android:text="@string/copy_to_clipboard" />
 
             <Button
                     android:id="@+id/save_to_file"
-                    android:layout_width="wrap_content"
+                    style="@style/Widget.MaterialComponents.Button.TextButton.Dialog"
+                    android:layout_width="0dp"
                     android:layout_height="wrap_content"
-                    android:layout_weight="0.50"
+                    android:layout_weight="1"
                     android:text="@string/dump_logcat" />
         </LinearLayout>
 
-        <Button
-                android:id="@+id/clear_log"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:text="@string/clear_log" />
-
         <ListView
                 android:id="@+id/log_list"
                 android:layout_width="match_parent"
diff --git a/application/vlc-android/src/org/videolan/vlc/DebugLogService.kt b/application/vlc-android/src/org/videolan/vlc/DebugLogService.kt
index fdf46aac6d..5460a3bba8 100644
--- a/application/vlc-android/src/org/videolan/vlc/DebugLogService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/DebugLogService.kt
@@ -54,6 +54,8 @@ import java.io.FileOutputStream
 import java.io.IOException
 import java.io.OutputStreamWriter
 import java.util.LinkedList
+import org.videolan.vlc.gui.preferences.search.PreferenceParser
+import org.videolan.vlc.util.Permissions
 
 class DebugLogService : Service(), Logcat.Callback, Runnable {
 
@@ -248,16 +250,19 @@ class DebugLogService : Service(), Logcat.Callback, Runnable {
         private var mBound = false
         private var mIDebugLogService: IDebugLogService? = null
         private val mHandler = Handler(Looper.getMainLooper())
+        private var isStarted = false
 
         private val mICallback = object : IDebugLogServiceCallback.Stub() {
             @Throws(RemoteException::class)
             override fun onStopped() {
                 mHandler.post { mCallback.onStopped() }
+                isStarted = false
             }
 
             @Throws(RemoteException::class)
             override fun onStarted(logList: List<String>) {
                 mHandler.post { mCallback.onStarted(logList) }
+                isStarted = true
             }
 
             @Throws(RemoteException::class)
@@ -377,6 +382,8 @@ class DebugLogService : Service(), Logcat.Callback, Runnable {
             }
             mHandler.removeCallbacksAndMessages(null)
         }
+
+        fun isStarted() = isStarted
     }
 
     companion object {
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/DebugLogActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/DebugLogActivity.kt
index 7f2faa0ff5..72467ef749 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/DebugLogActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/DebugLogActivity.kt
@@ -47,18 +47,6 @@ class DebugLogActivity : FragmentActivity(), DebugLogService.Client.Callback {
     private lateinit var binding: DebugLogBinding
 
 
-    private val startClickListener = View.OnClickListener {
-        binding.startLog.isEnabled = false
-        binding.stopLog.isEnabled = false
-        client.start()
-    }
-
-    private val stopClickListener = View.OnClickListener {
-        binding.startLog.isEnabled = false
-        binding.stopLog.isEnabled = false
-        client.stop()
-    }
-
     private val clearClickListener = View.OnClickListener {
         if (::client.isInitialized) client.clear()
         logList.clear()
@@ -90,12 +78,14 @@ class DebugLogActivity : FragmentActivity(), DebugLogService.Client.Callback {
 
         client = DebugLogService.Client(this, this)
 
-        binding.startLog.isEnabled = false
-        binding.stopLog.isEnabled = false
         setOptionsButtonsEnabled(false)
 
-        binding.startLog.setOnClickListener(startClickListener)
-        binding.stopLog.setOnClickListener(stopClickListener)
+        binding.startLog.setOnClickListener {
+            if (client.isStarted())
+                client.stop()
+            else
+                client.start()
+        }
         binding.clearLog.setOnClickListener(clearClickListener)
         binding.saveToFile.setOnClickListener(saveClickListener)
 
@@ -114,8 +104,7 @@ class DebugLogActivity : FragmentActivity(), DebugLogService.Client.Callback {
     }
 
     override fun onStarted(logList: List<String>) {
-        binding.startLog.isEnabled = false
-        binding.stopLog.isEnabled = true
+        binding.startLog.text = getString(R.string.stop_logging)
         if (logList.isNotEmpty())
             setOptionsButtonsEnabled(true)
         this.logList = ArrayList(logList)
@@ -127,8 +116,7 @@ class DebugLogActivity : FragmentActivity(), DebugLogService.Client.Callback {
     }
 
     override fun onStopped() {
-        binding.startLog.isEnabled = true
-        binding.stopLog.isEnabled = false
+        binding.startLog.text = getString(R.string.start_logging)
     }
 
     override fun onLog(msg: String) {



More information about the Android mailing list