瀏覽代碼

fixed initialization error (no postValue!), last played works again now

yattoz 5 年之前
父節點
當前提交
931b46c496
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      app/src/main/java/fr/forum_thalie/tsumugi/playerstore/Song.kt

+ 4 - 2
app/src/main/java/fr/forum_thalie/tsumugi/playerstore/Song.kt 查看文件

@@ -1,6 +1,7 @@
1 1
 package fr.forum_thalie.tsumugi.playerstore
2 2
 
3 3
 import androidx.lifecycle.MutableLiveData
4
+import fr.forum_thalie.tsumugi.noConnectionValue
4 5
 
5 6
 class Song(artistTitle: String = "", _id : Int = 0) {
6 7
 
@@ -35,9 +36,10 @@ class Song(artistTitle: String = "", _id : Int = 0) {
35 36
                 title.value = data.substring(hyphenPos + 3)
36 37
         } catch (e: Exception) {
37 38
             if (artist.value != "")
38
-                artist.postValue("")
39
+                artist.value = ""
39 40
             if (title.value != data)
40
-                title.postValue(data)
41
+                title.value = data
42
+            // else : do nothing
41 43
         }
42 44
     }
43 45