Fix marking sources as new
This commit is contained in:
@@ -152,7 +152,7 @@ class AppSettings(context: Context) {
|
||||
}
|
||||
|
||||
fun markKnownSources(sources: Collection<MangaSource>) {
|
||||
sourcesOrder = sourcesOrder + sources.map { it.name }
|
||||
sourcesOrder = (sourcesOrder + sources.map { it.name }).distinct()
|
||||
}
|
||||
|
||||
val isPagesNumbersEnabled: Boolean
|
||||
|
||||
@@ -21,7 +21,8 @@ import org.koitharu.kotatsu.settings.sources.adapter.SourceConfigAdapter
|
||||
import org.koitharu.kotatsu.settings.sources.adapter.SourceConfigListener
|
||||
import org.koitharu.kotatsu.settings.sources.model.SourceConfigItem
|
||||
|
||||
class SourcesSettingsFragment : BaseFragment<FragmentSettingsSourcesBinding>(),
|
||||
class SourcesSettingsFragment :
|
||||
BaseFragment<FragmentSettingsSourcesBinding>(),
|
||||
SourceConfigListener,
|
||||
SearchView.OnQueryTextListener,
|
||||
MenuItem.OnActionExpandListener,
|
||||
@@ -53,7 +54,6 @@ class SourcesSettingsFragment : BaseFragment<FragmentSettingsSourcesBinding>(),
|
||||
val sourcesAdapter = SourceConfigAdapter(this, get(), viewLifecycleOwner)
|
||||
with(binding.recyclerView) {
|
||||
setHasFixedSize(true)
|
||||
// addItemDecoration(SourceConfigItemDecoration(view.context))
|
||||
adapter = sourcesAdapter
|
||||
reorderHelper = ItemTouchHelper(SourcesReorderCallback()).also {
|
||||
it.attachToRecyclerView(this)
|
||||
|
||||
@@ -51,6 +51,9 @@ class SourcesSettingsViewModel(
|
||||
} else {
|
||||
settings.hiddenSources + source.name
|
||||
}
|
||||
if (isEnabled) {
|
||||
settings.markKnownSources(setOf(source))
|
||||
}
|
||||
buildList()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.koitharu.kotatsu.settings.sources.adapter
|
||||
|
||||
import android.content.Context
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import org.koitharu.kotatsu.base.ui.list.decor.AbstractDividerItemDecoration
|
||||
|
||||
class SourceConfigItemDecoration(context: Context) : AbstractDividerItemDecoration(context) {
|
||||
|
||||
override fun shouldDrawDivider(
|
||||
above: RecyclerView.ViewHolder,
|
||||
below: RecyclerView.ViewHolder,
|
||||
): Boolean {
|
||||
return above.itemViewType != 0 && below.itemViewType != 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user