Restore preview padding

This commit is contained in:
tarsin committed 2023-03-17 17:32:11 +08:00
1 parent 0b45c41a99
commit f5577d45c5
2 files changed
+18 -22

No files matched your search

@@ -19,6 +19,8 @@ import android.content.SharedPreferences
import android.net.Uri
import android.util.Log
import androidx.annotation.DimenRes
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.preference.PreferenceManager
import com.hippo.ehviewer.EhApplication.Companion.application
import com.hippo.ehviewer.client.data.FavListUrlBuilder
@@ -365,6 +367,9 @@ object Settings {
val thumbSize: Int
get() = dip2px(getInt(KEY_THUMB_SIZE, DEFAULT_THUMB_SIZE))
val thumbSizeDp: Dp
get() = getInt(KEY_THUMB_SIZE, DEFAULT_THUMB_SIZE).dp
private fun dip2px(dpValue: Int): Int {
val scale = application.resources.displayMetrics.density
return (dpValue * scale + 0.5f).toInt()
@@ -379,27 +379,6 @@ class GalleryDetailScene : BaseScene(), DownloadInfoListener {
} else {
DownloadInfo.STATE_INVALID
}
/*
binding.content.recyclerView.run {
previewsAdapter = GalleryPreviewsAdapter {
mainActivity!!.startReaderActivity(composeBindingGD!!, it.position)
}
footerAdapter = HintAdapter { navigateToPreview(true) }
headerAdapter = HintAdapter { navigateToPreview() }
adapter = ConcatAdapter(headerAdapter, previewsAdapter, footerAdapter)
val columnWidth = Settings.thumbSize
layoutManager = AutoGridLayoutManager(context, columnWidth).apply {
setStrategy(SimpleGridAutoSpanLayout.STRATEGY_SUITABLE_SIZE)
}
val padding = LayoutUtils.dp2pix(context, 8f)
val decoration = MarginItemDecoration(padding, padding, padding, padding, padding)
addItemDecoration(decoration)
val lp = layoutParams
lp.height = resources.displayMetrics.heightPixels * 8 / 7
layoutParams = lp
}
*/
readButtonText = getString(R.string.read)
composeBindingGI?.let { gi ->
if (mAction == ACTION_GALLERY_INFO) {
@@ -528,8 +507,20 @@ class GalleryDetailScene : BaseScene(), DownloadInfoListener {
galleryDetail: GalleryDetail?,
modifier: Modifier
) {
/*
binding.content.recyclerView.run {
previewsAdapter = GalleryPreviewsAdapter {
mainActivity!!.startReaderActivity(composeBindingGD!!, it.position)
}
footerAdapter = HintAdapter { navigateToPreview(true) }
headerAdapter = HintAdapter { navigateToPreview() }
adapter = ConcatAdapter(headerAdapter, previewsAdapter, footerAdapter)
val padding = LayoutUtils.dp2pix(context, 8f)
}
*/
LazyVerticalStaggeredGrid(
columns = StaggeredGridCells.Adaptive(160.dp),
columns = StaggeredGridCells.Adaptive(Settings.thumbSizeDp),
modifier = modifier.padding(horizontal = dimensionResource(id = R.dimen.keyline_margin))
) {
item(span = StaggeredGridItemSpan.FullLine) {