diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/BookmarksFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/BookmarksFragment.kt index aa0166a15..3d3b2b7fc 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/BookmarksFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/BookmarksFragment.kt @@ -30,7 +30,7 @@ import org.koitharu.kotatsu.core.util.ext.observe import org.koitharu.kotatsu.core.util.ext.observeEvent import org.koitharu.kotatsu.databinding.FragmentListSimpleBinding import org.koitharu.kotatsu.details.ui.DetailsActivity -import org.koitharu.kotatsu.list.ui.MangaListSpanResolver +import org.koitharu.kotatsu.list.ui.GridSpanResolver import org.koitharu.kotatsu.list.ui.adapter.ListHeaderClickListener import org.koitharu.kotatsu.list.ui.adapter.ListItemType import org.koitharu.kotatsu.list.ui.adapter.ListStateHolderListener @@ -86,7 +86,7 @@ class BookmarksFragment : val spanSizeLookup = SpanSizeLookup() with(binding.recyclerView) { setHasFixedSize(true) - val spanResolver = MangaListSpanResolver(resources) + val spanResolver = GridSpanResolver(resources) addItemDecoration(TypedListSpacingDecoration(context, false)) adapter = bookmarksAdapter addOnLayoutChangeListener(spanResolver) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/sheet/BookmarksSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/sheet/BookmarksSheet.kt index 6b4fb8490..a087d73c2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/sheet/BookmarksSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/bookmarks/ui/sheet/BookmarksSheet.kt @@ -25,7 +25,7 @@ import org.koitharu.kotatsu.core.util.ext.plus import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.core.util.ext.withArgs import org.koitharu.kotatsu.databinding.SheetPagesBinding -import org.koitharu.kotatsu.list.ui.MangaListSpanResolver +import org.koitharu.kotatsu.list.ui.GridSpanResolver import org.koitharu.kotatsu.list.ui.adapter.ListItemType import org.koitharu.kotatsu.list.ui.adapter.TypedListSpacingDecoration import org.koitharu.kotatsu.list.ui.model.ListModel @@ -53,7 +53,7 @@ class BookmarksSheet : lateinit var settings: AppSettings private var bookmarksAdapter: BookmarksAdapter? = null - private var spanResolver: MangaListSpanResolver? = null + private var spanResolver: GridSpanResolver? = null private val spanSizeLookup = SpanSizeLookup() private val listCommitCallback = Runnable { @@ -67,7 +67,7 @@ class BookmarksSheet : override fun onViewBindingCreated(binding: SheetPagesBinding, savedInstanceState: Bundle?) { super.onViewBindingCreated(binding, savedInstanceState) addSheetCallback(this) - spanResolver = MangaListSpanResolver(binding.root.resources) + spanResolver = GridSpanResolver(binding.root.resources) bookmarksAdapter = BookmarksAdapter( coil = coil, lifecycleOwner = viewLifecycleOwner, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/sheet/BaseAdaptiveSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/sheet/BaseAdaptiveSheet.kt index b043c7470..82d209335 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/sheet/BaseAdaptiveSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/sheet/BaseAdaptiveSheet.kt @@ -9,6 +9,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.ViewGroup.LayoutParams +import androidx.activity.ComponentDialog import androidx.activity.OnBackPressedDispatcher import androidx.annotation.CallSuper import androidx.appcompat.app.AppCompatDialog @@ -52,7 +53,7 @@ abstract class BaseAdaptiveSheet : AppCompatDialogFragment() { get() = behavior?.state == AdaptiveSheetBehavior.STATE_EXPANDED val onBackPressedDispatcher: OnBackPressedDispatcher - get() = requireComponentDialog().onBackPressedDispatcher + get() = (dialog as? ComponentDialog)?.onBackPressedDispatcher ?: requireActivity().onBackPressedDispatcher var isLocked = false private set diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt index 62a58933d..be6e02ac2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity.kt @@ -71,6 +71,7 @@ import java.lang.ref.WeakReference import javax.inject.Inject import com.google.android.material.R as materialR +@Deprecated("") @AndroidEntryPoint class DetailsActivity : BaseActivity(), diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity2.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity2.kt index 62cad625e..fa374b2f3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity2.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/DetailsActivity2.kt @@ -12,6 +12,7 @@ import android.transition.TransitionManager import android.view.Menu import android.view.MenuItem import android.view.View +import android.view.ViewGroup.MarginLayoutParams import android.view.ViewTreeObserver import android.widget.Toast import androidx.activity.viewModels @@ -22,6 +23,7 @@ import androidx.core.text.inSpans import androidx.core.text.method.LinkMovementMethodCompat import androidx.core.view.isGone import androidx.core.view.isVisible +import androidx.core.view.updateLayoutParams import androidx.core.view.updatePadding import androidx.swiperefreshlayout.widget.CircularProgressDrawable import coil.ImageLoader @@ -133,7 +135,7 @@ class DetailsActivity2 : viewBinding.buttonRead.setOnClickListener(this) viewBinding.buttonRead.setOnLongClickListener(this) viewBinding.buttonRead.setOnContextClickListenerCompat(this) - viewBinding.buttonChapters.setOnClickListener(this) + viewBinding.buttonChapters?.setOnClickListener(this) viewBinding.infoLayout.chipBranch.setOnClickListener(this) viewBinding.infoLayout.chipSize.setOnClickListener(this) viewBinding.infoLayout.chipSource.setOnClickListener(this) @@ -155,7 +157,7 @@ class DetailsActivity2 : ) TitleScrollCoordinator(viewBinding.textViewTitle).attach(viewBinding.scrollView) - chaptersBadge = ViewBadge(viewBinding.buttonChapters, this) + chaptersBadge = ViewBadge(viewBinding.buttonChapters ?: viewBinding.buttonRead, this) viewModel.details.filterNotNull().observe(this, ::onMangaUpdated) viewModel.onMangaRemoved.observeEvent(this, ::onMangaRemoved) @@ -426,7 +428,7 @@ class DetailsActivity2 : } private fun onLoadingStateChanged(isLoading: Boolean) { - val button = viewBinding.buttonChapters + val button = viewBinding.buttonChapters ?: return if (isLoading) { button.setImageDrawable( CircularProgressDrawable(this).also { @@ -507,7 +509,7 @@ class DetailsActivity2 : .enqueueWith(coil) } - buttonChapters.isEnabled = hasChapters + buttonChapters?.isEnabled = hasChapters title = manga.title buttonRead.isEnabled = hasChapters invalidateOptionsMenu() @@ -527,7 +529,14 @@ class DetailsActivity2 : viewBinding.root.updatePadding( left = insets.left, right = insets.right, - bottom = insets.bottom + ) + viewBinding.cardChapters?.updateLayoutParams { + val baseOffset = leftMargin + bottomMargin = insets.bottom + baseOffset + topMargin = insets.bottom + baseOffset + } + viewBinding.scrollView.updatePadding( + bottom = insets.bottom, ) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/ChapterPagesMenuProvider.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChapterPagesMenuProvider.kt similarity index 94% rename from app/src/main/kotlin/org/koitharu/kotatsu/details/ui/ChapterPagesMenuProvider.kt rename to app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChapterPagesMenuProvider.kt index af8aaff7b..f6857484f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/ChapterPagesMenuProvider.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChapterPagesMenuProvider.kt @@ -1,4 +1,4 @@ -package org.koitharu.kotatsu.details.ui +package org.koitharu.kotatsu.details.ui.pager import android.view.Menu import android.view.MenuInflater @@ -14,6 +14,8 @@ import org.koitharu.kotatsu.core.prefs.AppSettings import org.koitharu.kotatsu.core.ui.sheet.BaseAdaptiveSheet import org.koitharu.kotatsu.core.util.ext.setValueRounded import org.koitharu.kotatsu.core.util.progress.IntPercentLabelFormatter +import org.koitharu.kotatsu.details.ui.DetailsViewModel +import org.koitharu.kotatsu.details.ui.pager.ChaptersPagesSheet.Companion.TAB_BOOKMARKS import org.koitharu.kotatsu.details.ui.pager.ChaptersPagesSheet.Companion.TAB_CHAPTERS import org.koitharu.kotatsu.details.ui.pager.ChaptersPagesSheet.Companion.TAB_PAGES import java.lang.ref.WeakReference @@ -42,7 +44,7 @@ class ChapterPagesMenuProvider( menu.findItem(R.id.action_grid_view)?.isChecked = viewModel.isChaptersInGridView.value == true } - TAB_PAGES -> { + TAB_PAGES, TAB_BOOKMARKS -> { menuInflater.inflate(R.menu.opt_pages, menu) menu.findItem(R.id.action_grid_size)?.run { setOnActionExpandListener(this@ChapterPagesMenuProvider) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChaptersPagesSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChaptersPagesSheet.kt index 52d0d0f47..5727167ab 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChaptersPagesSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/ChaptersPagesSheet.kt @@ -19,7 +19,6 @@ import org.koitharu.kotatsu.core.util.ext.setTabsEnabled import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.core.util.ext.withArgs import org.koitharu.kotatsu.databinding.SheetChaptersPagesBinding -import org.koitharu.kotatsu.details.ui.ChapterPagesMenuProvider import org.koitharu.kotatsu.details.ui.DetailsViewModel import javax.inject.Inject diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/bookmarks/MangaBookmarksFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/bookmarks/MangaBookmarksFragment.kt index e01c2edd0..d52f9c719 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/bookmarks/MangaBookmarksFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/bookmarks/MangaBookmarksFragment.kt @@ -20,14 +20,11 @@ import org.koitharu.kotatsu.core.util.ext.findParentCallback import org.koitharu.kotatsu.core.util.ext.observe import org.koitharu.kotatsu.databinding.FragmentMangaBookmarksBinding import org.koitharu.kotatsu.details.ui.DetailsViewModel -import org.koitharu.kotatsu.list.ui.MangaListSpanResolver +import org.koitharu.kotatsu.list.ui.GridSpanResolver import org.koitharu.kotatsu.list.ui.adapter.ListItemType import org.koitharu.kotatsu.list.ui.adapter.TypedListSpacingDecoration import org.koitharu.kotatsu.reader.ui.ReaderActivity.IntentBuilder import org.koitharu.kotatsu.reader.ui.ReaderNavigationCallback -import org.koitharu.kotatsu.reader.ui.ReaderState -import org.koitharu.kotatsu.reader.ui.pager.ReaderPage -import org.koitharu.kotatsu.reader.ui.thumbnails.OnPageSelectListener import javax.inject.Inject @AndroidEntryPoint @@ -44,7 +41,7 @@ class MangaBookmarksFragment : BaseFragment(), lateinit var settings: AppSettings private var bookmarksAdapter: BookmarksAdapter? = null - private var spanResolver: MangaListSpanResolver? = null + private var spanResolver: GridSpanResolver? = null private val spanSizeLookup = SpanSizeLookup() private val listCommitCallback = Runnable { @@ -62,19 +59,22 @@ class MangaBookmarksFragment : BaseFragment(), override fun onViewBindingCreated(binding: FragmentMangaBookmarksBinding, savedInstanceState: Bundle?) { super.onViewBindingCreated(binding, savedInstanceState) - spanResolver = MangaListSpanResolver(binding.root.resources) + spanResolver = GridSpanResolver(binding.root.resources) bookmarksAdapter = BookmarksAdapter( coil = coil, lifecycleOwner = viewLifecycleOwner, clickListener = this@MangaBookmarksFragment, headerClickListener = null, ) + viewModel.gridScale.observe(viewLifecycleOwner, ::onGridScaleChanged) // before rv initialization with(binding.recyclerView) { addItemDecoration(TypedListSpacingDecoration(context, false)) adapter = bookmarksAdapter addOnLayoutChangeListener(spanResolver) - spanResolver?.setGridSize(settings.gridSize / 100f, this) - (layoutManager as GridLayoutManager).spanSizeLookup = spanSizeLookup + (layoutManager as GridLayoutManager).let { + it.spanSizeLookup = spanSizeLookup + it.spanCount = checkNotNull(spanResolver).spanCount + } } viewModel.content.observe(viewLifecycleOwner, checkNotNull(bookmarksAdapter)) } @@ -113,6 +113,11 @@ class MangaBookmarksFragment : BaseFragment(), } } + private fun onGridScaleChanged(scale: Float) { + spanSizeLookup.invalidateCache() + spanResolver?.setGridSize(scale, requireViewBinding().recyclerView) + } + private inner class SpanSizeLookup : GridLayoutManager.SpanSizeLookup() { init { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/bookmarks/MangaBookmarksViewModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/bookmarks/MangaBookmarksViewModel.kt index d1590960e..b198f1b84 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/bookmarks/MangaBookmarksViewModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/bookmarks/MangaBookmarksViewModel.kt @@ -15,6 +15,8 @@ import kotlinx.coroutines.plus import org.koitharu.kotatsu.R import org.koitharu.kotatsu.bookmarks.domain.Bookmark import org.koitharu.kotatsu.bookmarks.domain.BookmarksRepository +import org.koitharu.kotatsu.core.prefs.AppSettings +import org.koitharu.kotatsu.core.prefs.observeAsStateFlow import org.koitharu.kotatsu.core.ui.BaseViewModel import org.koitharu.kotatsu.list.ui.model.EmptyState import org.koitharu.kotatsu.list.ui.model.ListHeader @@ -26,10 +28,17 @@ import javax.inject.Inject @HiltViewModel class MangaBookmarksViewModel @Inject constructor( bookmarksRepository: BookmarksRepository, + settings: AppSettings, ) : BaseViewModel(), FlowCollector { private val manga = MutableStateFlow(null) + val gridScale = settings.observeAsStateFlow( + scope = viewModelScope + Dispatchers.Default, + key = AppSettings.KEY_GRID_SIZE_PAGES, + valueProducer = { gridSizePages / 100f }, + ) + val content: StateFlow> = manga.filterNotNull().flatMapLatest { m -> bookmarksRepository.observeBookmarks(m) .map { mapList(m, it) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesFragment.kt index 510c6d23f..d827c0a38 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesFragment.kt @@ -30,6 +30,7 @@ import org.koitharu.kotatsu.core.util.ext.observeEvent import org.koitharu.kotatsu.core.util.ext.showOrHide import org.koitharu.kotatsu.databinding.FragmentPagesBinding import org.koitharu.kotatsu.details.ui.DetailsViewModel +import org.koitharu.kotatsu.list.ui.GridSpanResolver import org.koitharu.kotatsu.list.ui.adapter.ListItemType import org.koitharu.kotatsu.list.ui.adapter.TypedListSpacingDecoration import org.koitharu.kotatsu.list.ui.model.ListModel @@ -56,7 +57,7 @@ class PagesFragment : lateinit var settings: AppSettings private var thumbnailsAdapter: PageThumbnailAdapter? = null - private var spanResolver: PagesGridSpanResolver? = null + private var spanResolver: GridSpanResolver? = null private var scrollListener: ScrollListener? = null private val spanSizeLookup = SpanSizeLookup() @@ -83,7 +84,7 @@ class PagesFragment : override fun onViewBindingCreated(binding: FragmentPagesBinding, savedInstanceState: Bundle?) { super.onViewBindingCreated(binding, savedInstanceState) - spanResolver = PagesGridSpanResolver(binding.root.resources) + spanResolver = GridSpanResolver(binding.root.resources) thumbnailsAdapter = PageThumbnailAdapter( coil = coil, lifecycleOwner = viewLifecycleOwner, diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesGridSpanResolver.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesGridSpanResolver.kt deleted file mode 100644 index 1f88c459a..000000000 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/pager/pages/PagesGridSpanResolver.kt +++ /dev/null @@ -1,59 +0,0 @@ -package org.koitharu.kotatsu.details.ui.pager.pages - -import android.content.res.Resources -import android.view.View -import androidx.recyclerview.widget.GridLayoutManager -import androidx.recyclerview.widget.RecyclerView -import org.koitharu.kotatsu.R -import kotlin.math.abs -import kotlin.math.roundToInt - -class PagesGridSpanResolver( - resources: Resources, -) : View.OnLayoutChangeListener { - - var spanCount = 3 - private set - - private val gridWidth = resources.getDimension(R.dimen.preferred_grid_width) - private val spacing = resources.getDimension(R.dimen.grid_spacing) - private var cellWidth = -1f - - override fun onLayoutChange( - v: View?, - left: Int, - top: Int, - right: Int, - bottom: Int, - oldLeft: Int, - oldTop: Int, - oldRight: Int, - oldBottom: Int, - ) { - if (cellWidth <= 0f) { - return - } - val rv = v as? RecyclerView ?: return - val width = abs(right - left) - if (width == 0) { - return - } - resolveGridSpanCount(width) - (rv.layoutManager as? GridLayoutManager)?.spanCount = spanCount - } - - fun setGridSize(scaleFactor: Float, rv: RecyclerView) { - cellWidth = (gridWidth * scaleFactor) + spacing - val lm = rv.layoutManager as? GridLayoutManager ?: return - val innerWidth = lm.width - lm.paddingEnd - lm.paddingStart - if (innerWidth > 0) { - resolveGridSpanCount(innerWidth) - lm.spanCount = spanCount - } - } - - private fun resolveGridSpanCount(width: Int) { - val estimatedCount = (width / cellWidth).roundToInt() - spanCount = estimatedCount.coerceAtLeast(2) - } -} diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListSpanResolver.kt b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/GridSpanResolver.kt similarity index 98% rename from app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListSpanResolver.kt rename to app/src/main/kotlin/org/koitharu/kotatsu/list/ui/GridSpanResolver.kt index c3c534e8f..3682dd996 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListSpanResolver.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/GridSpanResolver.kt @@ -4,11 +4,11 @@ import android.content.res.Resources import android.view.View import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView +import org.koitharu.kotatsu.R import kotlin.math.abs import kotlin.math.roundToInt -import org.koitharu.kotatsu.R -class MangaListSpanResolver( +class GridSpanResolver( resources: Resources, ) : View.OnLayoutChangeListener { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListFragment.kt b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListFragment.kt index e9ff288ff..c5df6e3fc 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListFragment.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/MangaListFragment.kt @@ -78,7 +78,7 @@ abstract class MangaListFragment : private var listAdapter: MangaListAdapter? = null private var paginationListener: PaginationScrollListener? = null private var selectionController: ListSelectionController? = null - private var spanResolver: MangaListSpanResolver? = null + private var spanResolver: GridSpanResolver? = null private val spanSizeLookup = SpanSizeLookup() open val isSwipeRefreshEnabled = true @@ -98,7 +98,7 @@ abstract class MangaListFragment : override fun onViewBindingCreated(binding: FragmentListBinding, savedInstanceState: Bundle?) { super.onViewBindingCreated(binding, savedInstanceState) listAdapter = onCreateAdapter() - spanResolver = MangaListSpanResolver(binding.root.resources) + spanResolver = GridSpanResolver(binding.root.resources) selectionController = ListSelectionController( appCompatDelegate = checkNotNull(findAppCompatDelegate()), decoration = MangaSelectionDecoration(binding.root.context), diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PagesThumbnailsSheet.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PagesThumbnailsSheet.kt index a2c91d876..adf82e7e5 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PagesThumbnailsSheet.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PagesThumbnailsSheet.kt @@ -27,7 +27,7 @@ import org.koitharu.kotatsu.core.util.ext.showDistinct import org.koitharu.kotatsu.core.util.ext.showOrHide import org.koitharu.kotatsu.core.util.ext.withArgs import org.koitharu.kotatsu.databinding.SheetPagesBinding -import org.koitharu.kotatsu.list.ui.MangaListSpanResolver +import org.koitharu.kotatsu.list.ui.GridSpanResolver import org.koitharu.kotatsu.list.ui.adapter.ListItemType import org.koitharu.kotatsu.list.ui.adapter.TypedListSpacingDecoration import org.koitharu.kotatsu.list.ui.model.ListModel @@ -54,7 +54,7 @@ class PagesThumbnailsSheet : lateinit var settings: AppSettings private var thumbnailsAdapter: PageThumbnailAdapter? = null - private var spanResolver: MangaListSpanResolver? = null + private var spanResolver: GridSpanResolver? = null private var scrollListener: ScrollListener? = null private val spanSizeLookup = SpanSizeLookup() @@ -69,7 +69,7 @@ class PagesThumbnailsSheet : override fun onViewBindingCreated(binding: SheetPagesBinding, savedInstanceState: Bundle?) { super.onViewBindingCreated(binding, savedInstanceState) addSheetCallback(this) - spanResolver = MangaListSpanResolver(binding.root.resources) + spanResolver = GridSpanResolver(binding.root.resources) thumbnailsAdapter = PageThumbnailAdapter( coil = coil, lifecycleOwner = viewLifecycleOwner, diff --git a/app/src/main/res/layout-w600dp-land/activity_details_new.xml b/app/src/main/res/layout-w600dp-land/activity_details_new.xml new file mode 100644 index 000000000..f3aca9679 --- /dev/null +++ b/app/src/main/res/layout-w600dp-land/activity_details_new.xml @@ -0,0 +1,410 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +