Compare commits
No commits in common. "0b7f8325730100b17d7d84ce911df4ee2be6e966" and "ceae91206db62a1ad66404603b33850d83bcc331" have entirely different histories.
0b7f832573
...
ceae91206d
@ -120,7 +120,6 @@ class HomeActivity :
|
||||
binding.swipeRefreshLayout.setOnRefreshListener {
|
||||
repository.offlineOverride = false
|
||||
lastFetchDone = false
|
||||
items.clear()
|
||||
getElementsAccordingToTab()
|
||||
binding.swipeRefreshLayout.isRefreshing = false
|
||||
}
|
||||
@ -459,8 +458,6 @@ class HomeActivity :
|
||||
appendResults: Boolean,
|
||||
itemType: ItemType,
|
||||
) {
|
||||
@Suppress("detekt:ComplexCondition")
|
||||
if ((appendResults && items.size > 0) || (!appendResults && items.size == 0)) {
|
||||
CountingIdlingResourceSingleton.increment()
|
||||
binding.swipeRefreshLayout.isRefreshing = true
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
@ -479,9 +476,6 @@ class HomeActivity :
|
||||
}
|
||||
CountingIdlingResourceSingleton.decrement()
|
||||
}
|
||||
} else {
|
||||
handleListResult()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleListResult(appendResults: Boolean = false) {
|
||||
@ -540,10 +534,7 @@ class HomeActivity :
|
||||
}
|
||||
|
||||
private fun reloadBadges() {
|
||||
if (appSettingsService.isInfiniteLoadingEnabled() ||
|
||||
appSettingsService.isDisplayUnreadCountEnabled() ||
|
||||
appSettingsService.isDisplayAllCountEnabled()
|
||||
) {
|
||||
if (appSettingsService.isDisplayUnreadCountEnabled() || appSettingsService.isDisplayAllCountEnabled()) {
|
||||
CountingIdlingResourceSingleton.increment()
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
repository.reloadBadges()
|
||||
|
@ -30,7 +30,7 @@ import org.kodein.di.instance
|
||||
|
||||
class ItemCardAdapter(
|
||||
override val app: Activity,
|
||||
override var items: ArrayList<SelfossModel.Item>,
|
||||
override val items: ArrayList<SelfossModel.Item>,
|
||||
override val updateHomeItems: (ArrayList<SelfossModel.Item>) -> Unit,
|
||||
) : ItemsAdapter<ItemCardAdapter.ViewHolder>() {
|
||||
override lateinit var binding: CardItemBinding
|
||||
|
@ -21,7 +21,7 @@ import org.kodein.di.instance
|
||||
|
||||
class ItemListAdapter(
|
||||
override val app: Activity,
|
||||
override var items: ArrayList<SelfossModel.Item>,
|
||||
override val items: ArrayList<SelfossModel.Item>,
|
||||
override val updateHomeItems: (ArrayList<SelfossModel.Item>) -> Unit,
|
||||
) : ItemsAdapter<ItemListAdapter.ViewHolder>() {
|
||||
override lateinit var binding: ListItemBinding
|
||||
|
@ -21,7 +21,7 @@ import org.kodein.di.DIAware
|
||||
abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> :
|
||||
RecyclerView.Adapter<VH>(),
|
||||
DIAware {
|
||||
abstract var items: ArrayList<SelfossModel.Item>
|
||||
abstract val items: ArrayList<SelfossModel.Item>
|
||||
abstract val repository: Repository
|
||||
abstract val binding: ViewBinding
|
||||
abstract val appSettingsService: AppSettingsService
|
||||
@ -31,7 +31,8 @@ abstract class ItemsAdapter<VH : RecyclerView.ViewHolder?> :
|
||||
protected val c: Context get() = app.baseContext
|
||||
|
||||
fun updateAllItems(items: ArrayList<SelfossModel.Item>) {
|
||||
this.items = items
|
||||
this.items.clear()
|
||||
this.items.addAll(items)
|
||||
updateHomeItems(items)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user