ソースを参照

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

yattoz 4 年 前
コミット
f28487b07c

+ 1 - 0
app/src/main/java/fr/forum_thalie/tsumugi/planning/Planning.kt ファイルの表示

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

+ 2 - 2
app/src/main/java/fr/forum_thalie/tsumugi/ui/programme/ProgrammeDayFragment.kt ファイルの表示

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