|
1 | 1 | /* |
2 | 2 | * Infomaniak Mail - Android |
3 | | - * Copyright (C) 2022-2024 Infomaniak Network SA |
| 3 | + * Copyright (C) 2022-2025 Infomaniak Network SA |
4 | 4 | * |
5 | 5 | * This program is free software: you can redistribute it and/or modify |
6 | 6 | * it under the terms of the GNU General Public License as published by |
@@ -41,7 +41,6 @@ import androidx.navigation.fragment.findNavController |
41 | 41 | import androidx.navigation.fragment.navArgs |
42 | 42 | import androidx.recyclerview.widget.LinearLayoutManager |
43 | 43 | import androidx.recyclerview.widget.RecyclerView.Adapter.StateRestorationPolicy |
44 | | -import androidx.swiperefreshlayout.widget.SwipeRefreshLayout |
45 | 44 | import com.ernestoyaquello.dragdropswiperecyclerview.DragDropSwipeRecyclerView.ListOrientation |
46 | 45 | import com.ernestoyaquello.dragdropswiperecyclerview.DragDropSwipeRecyclerView.ListOrientation.DirectionFlag |
47 | 46 | import com.ernestoyaquello.dragdropswiperecyclerview.listener.OnItemSwipeListener |
@@ -91,7 +90,7 @@ import com.infomaniak.lib.core.R as RCore |
91 | 90 | import com.infomaniak.lib.core.utils.Utils as UtilsCore |
92 | 91 |
|
93 | 92 | @AndroidEntryPoint |
94 | | -class ThreadListFragment : TwoPaneFragment(), SwipeRefreshLayout.OnRefreshListener { |
| 93 | +class ThreadListFragment : TwoPaneFragment() { |
95 | 94 |
|
96 | 95 | private var _binding: FragmentThreadListBinding? = null |
97 | 96 | val binding get() = _binding!! // This property is only valid between onCreateView and onDestroyView |
@@ -278,18 +277,16 @@ class ThreadListFragment : TwoPaneFragment(), SwipeRefreshLayout.OnRefreshListen |
278 | 277 | if (rightIsSet) enableSwipeDirection(DirectionFlag.RIGHT) else disableSwipeDirection(DirectionFlag.RIGHT) |
279 | 278 | } |
280 | 279 |
|
281 | | - override fun onRefresh() { |
282 | | - if (mainViewModel.isDownloadingChanges.value == true) return |
283 | | - mainViewModel.forceRefreshThreads() |
284 | | - } |
285 | | - |
286 | 280 | private fun setupDensityDependentUi() = with(binding) { |
287 | 281 | val paddingTop = resources.getDimension(RCore.dimen.marginStandardMedium).toInt() |
288 | 282 | threadsList.setPaddingRelative(top = if (localSettings.threadDensity == COMPACT) paddingTop else 0) |
289 | 283 | } |
290 | 284 |
|
291 | 285 | private fun setupOnRefresh() { |
292 | | - binding.swipeRefreshLayout.setOnRefreshListener(this) |
| 286 | + binding.swipeRefreshLayout.setOnRefreshListener { |
| 287 | + if (mainViewModel.isDownloadingChanges.value == true) return@setOnRefreshListener |
| 288 | + mainViewModel.forceRefreshThreads() |
| 289 | + } |
293 | 290 | } |
294 | 291 |
|
295 | 292 | private fun setupAdapter() { |
|
0 commit comments