[Android] Fix network server editing

Geoffrey Métais git at videolan.org
Fri Mar 27 07:48:35 CET 2020


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 24 16:25:53 2020 +0100| [dd92646263f6cc791526b6e1995503a54ccfd93b] | committer: Nicolas Pomepuy

Fix network server editing

Fix #1072

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

 .../src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt      | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
index f41ecdabb..8c39c44a7 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
@@ -14,7 +14,10 @@ import android.widget.*
 import androidx.appcompat.app.AppCompatDialog
 import androidx.fragment.app.DialogFragment
 import com.google.android.material.textfield.TextInputLayout
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
 import org.videolan.medialibrary.interfaces.media.MediaWrapper
+import org.videolan.tools.AppScope
 import org.videolan.tools.runIO
 import org.videolan.vlc.R
 import org.videolan.vlc.gui.DialogActivity
@@ -122,10 +125,10 @@ class NetworkServerDialog : DialogFragment(), AdapterView.OnItemSelectedListener
         else
             editServername.text.toString()
         val uri = Uri.parse(url.text.toString())
-        if (::networkUri.isInitialized) {
-            runIO(Runnable { browserFavRepository.deleteBrowserFav(networkUri) })
+        AppScope.launch(Dispatchers.IO) {
+            if (::networkUri.isInitialized) browserFavRepository.deleteBrowserFav(networkUri)
+            browserFavRepository.addNetworkFavItem(uri, name, null)
         }
-        browserFavRepository.addNetworkFavItem(uri, name, null)
     }
 
     private fun updateUrl() {



More information about the Android mailing list