|
|
|
@ -68,7 +68,7 @@ abstract class MangaListFragment :
|
|
|
|
|
|
|
|
|
|
|
|
override fun onInflateView(
|
|
|
|
override fun onInflateView(
|
|
|
|
inflater: LayoutInflater,
|
|
|
|
inflater: LayoutInflater,
|
|
|
|
container: ViewGroup?
|
|
|
|
container: ViewGroup?,
|
|
|
|
) = FragmentListBinding.inflate(inflater, container, false)
|
|
|
|
) = FragmentListBinding.inflate(inflater, container, false)
|
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
@ -76,13 +76,13 @@ abstract class MangaListFragment :
|
|
|
|
listAdapter = MangaListAdapter(
|
|
|
|
listAdapter = MangaListAdapter(
|
|
|
|
coil = get(),
|
|
|
|
coil = get(),
|
|
|
|
lifecycleOwner = viewLifecycleOwner,
|
|
|
|
lifecycleOwner = viewLifecycleOwner,
|
|
|
|
listener = this,
|
|
|
|
listener = this
|
|
|
|
)
|
|
|
|
)
|
|
|
|
selectionController = ListSelectionController(
|
|
|
|
selectionController = ListSelectionController(
|
|
|
|
activity = requireActivity(),
|
|
|
|
activity = requireActivity(),
|
|
|
|
decoration = MangaSelectionDecoration(view.context),
|
|
|
|
decoration = MangaSelectionDecoration(view.context),
|
|
|
|
registryOwner = this,
|
|
|
|
registryOwner = this,
|
|
|
|
callback = this,
|
|
|
|
callback = this
|
|
|
|
)
|
|
|
|
)
|
|
|
|
paginationListener = PaginationScrollListener(4, this)
|
|
|
|
paginationListener = PaginationScrollListener(4, this)
|
|
|
|
with(binding.recyclerView) {
|
|
|
|
with(binding.recyclerView) {
|
|
|
|
@ -97,7 +97,7 @@ abstract class MangaListFragment :
|
|
|
|
setOnRefreshListener(this@MangaListFragment)
|
|
|
|
setOnRefreshListener(this@MangaListFragment)
|
|
|
|
isEnabled = isSwipeRefreshEnabled
|
|
|
|
isEnabled = isSwipeRefreshEnabled
|
|
|
|
}
|
|
|
|
}
|
|
|
|
addMenuProvider(MangaListMenuProvider(childFragmentManager))
|
|
|
|
addMenuProvider(MangaListMenuProvider(this))
|
|
|
|
|
|
|
|
|
|
|
|
viewModel.listMode.observe(viewLifecycleOwner, ::onListModeChanged)
|
|
|
|
viewModel.listMode.observe(viewLifecycleOwner, ::onListModeChanged)
|
|
|
|
viewModel.gridScale.observe(viewLifecycleOwner, ::onGridScaleChanged)
|
|
|
|
viewModel.gridScale.observe(viewLifecycleOwner, ::onGridScaleChanged)
|
|
|
|
@ -171,21 +171,21 @@ abstract class MangaListFragment :
|
|
|
|
val headerHeight = (activity as? AppBarOwner)?.appBar?.measureHeight() ?: insets.top
|
|
|
|
val headerHeight = (activity as? AppBarOwner)?.appBar?.measureHeight() ?: insets.top
|
|
|
|
binding.root.updatePadding(
|
|
|
|
binding.root.updatePadding(
|
|
|
|
left = insets.left,
|
|
|
|
left = insets.left,
|
|
|
|
right = insets.right,
|
|
|
|
right = insets.right
|
|
|
|
)
|
|
|
|
)
|
|
|
|
if (activity is MainActivity) {
|
|
|
|
if (activity is MainActivity) {
|
|
|
|
binding.recyclerView.updatePadding(
|
|
|
|
binding.recyclerView.updatePadding(
|
|
|
|
top = headerHeight,
|
|
|
|
top = headerHeight,
|
|
|
|
bottom = insets.bottom,
|
|
|
|
bottom = insets.bottom
|
|
|
|
)
|
|
|
|
)
|
|
|
|
binding.swipeRefreshLayout.setProgressViewOffset(
|
|
|
|
binding.swipeRefreshLayout.setProgressViewOffset(
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
headerHeight + resources.resolveDp(-72),
|
|
|
|
headerHeight + resources.resolveDp(-72),
|
|
|
|
headerHeight + resources.resolveDp(10),
|
|
|
|
headerHeight + resources.resolveDp(10)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
binding.recyclerView.updatePadding(
|
|
|
|
binding.recyclerView.updatePadding(
|
|
|
|
bottom = insets.bottom,
|
|
|
|
bottom = insets.bottom
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|