Sfoglia il codice sorgente

fixed bug in Planning displayed multiple times (not cleared in-between)

yattoz 4 anni fa
parent
commit
f28487b07c

+ 1 - 0
app/src/main/java/fr/forum_thalie/tsumugi/planning/Planning.kt Vedi File

@@ -64,6 +64,7 @@ class Planning {
64 64
             if (result.has("planning"))
65 65
             {
66 66
                 val programList = result.getJSONArray("planning")
67
+                programmes.clear()
67 68
                 for (i in 0 until programList.length())
68 69
                 {
69 70
                     val item = programList[i] as JSONObject

+ 2 - 2
app/src/main/java/fr/forum_thalie/tsumugi/ui/programme/ProgrammeDayFragment.kt Vedi File

@@ -32,13 +32,13 @@ class ProgrammeDayFragment : Fragment() {
32 32
         viewModel.day = arguments?.getString("day") ?: ""
33 33
 
34 34
         val root = inflater.inflate(R.layout.fragment_programme_day, container, false)
35
+
35 36
         Planning.instance.programmes.forEach {
36 37
             if (it.isThisDay(day = weekdays.indexOf(viewModel.day)))
37 38
                 programmeOfTheDay.add(it)
38 39
         }
39 40
         viewManager = LinearLayoutManager(context)
40
-        viewAdapter =
41
-            ProgrammeAdapter(programmeOfTheDay, viewModel.day)
41
+        viewAdapter = ProgrammeAdapter(programmeOfTheDay, viewModel.day)
42 42
         recyclerView = root.findViewById<RecyclerView>(R.id.programme_recycler).apply {
43 43
             // use this setting to improve performance if you know that changes
44 44
             // in content do not change the layout size of the RecyclerView