Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- `Other` - for technical stuff.

## [Unreleased]
### Fixed
- Make the scrollbar on the anime screen less buggy ([@Secozzi](https://github.com/Secozzi)) ([#118](https://github.com/quickdesh/Animiru/pull/118))

## [v0.19.3.0] - 2025-12-25
### Fixed
Expand Down
23 changes: 13 additions & 10 deletions app/src/main/java/eu/kanade/presentation/anime/AnimeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.domain.source.model.StubSource
import tachiyomi.i18n.MR
import tachiyomi.i18n.aniyomi.AYMR
import tachiyomi.presentation.core.components.FastScrollLazyVerticalGrid
import tachiyomi.presentation.core.components.FastScrollIrregularLazyVerticalGrid
import tachiyomi.presentation.core.components.Scroller.EXACT_HEIGHT_KEY_PREFIX
import tachiyomi.presentation.core.components.TwoPanelBox
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.components.material.PullRefresh
Expand Down Expand Up @@ -511,7 +512,7 @@ private fun AnimeScreenSmallImpl(
) {
val layoutDirection = LocalLayoutDirection.current
// AY -->
FastScrollLazyVerticalGrid(
FastScrollIrregularLazyVerticalGrid(
modifier = Modifier.fillMaxHeight(),
state = itemListState,
columns = if (gridSize == 0) GridCells.Adaptive(128.dp) else GridCells.Fixed(gridSize),
Expand All @@ -520,10 +521,11 @@ private fun AnimeScreenSmallImpl(
end = GRID_PADDING + contentPadding.calculateEndPadding(layoutDirection),
bottom = contentPadding.calculateBottomPadding(),
),
topContentPadding = contentPadding.calculateTopPadding(),
) {
// <-- AY
item(
key = AnimeScreenItem.INFO_BOX,
key = EXACT_HEIGHT_KEY_PREFIX + AnimeScreenItem.INFO_BOX,
contentType = AnimeScreenItem.INFO_BOX,
// AY -->
span = { GridItemSpan(maxLineSpan) },
Expand All @@ -544,7 +546,7 @@ private fun AnimeScreenSmallImpl(
}

item(
key = AnimeScreenItem.ACTION_ROW,
key = EXACT_HEIGHT_KEY_PREFIX + AnimeScreenItem.ACTION_ROW,
contentType = AnimeScreenItem.ACTION_ROW,
// AY -->
span = { GridItemSpan(maxLineSpan) },
Expand All @@ -568,7 +570,7 @@ private fun AnimeScreenSmallImpl(
}

item(
key = AnimeScreenItem.DESCRIPTION_WITH_TAG,
key = EXACT_HEIGHT_KEY_PREFIX + AnimeScreenItem.DESCRIPTION_WITH_TAG,
contentType = AnimeScreenItem.DESCRIPTION_WITH_TAG,
// AY -->
span = { GridItemSpan(maxLineSpan) },
Expand All @@ -589,7 +591,7 @@ private fun AnimeScreenSmallImpl(
}

item(
key = AnimeScreenItem.EPISODE_HEADER,
key = EXACT_HEIGHT_KEY_PREFIX + AnimeScreenItem.EPISODE_HEADER,
contentType = AnimeScreenItem.EPISODE_HEADER,
// AY -->
span = { GridItemSpan(maxLineSpan) },
Expand Down Expand Up @@ -636,7 +638,7 @@ private fun AnimeScreenSmallImpl(
// AY -->
if (state.airingTime > 0L) {
item(
key = AnimeScreenItem.AIRING_TIME,
key = EXACT_HEIGHT_KEY_PREFIX + AnimeScreenItem.AIRING_TIME,
contentType = AnimeScreenItem.AIRING_TIME,
span = { GridItemSpan(maxLineSpan) },
) {
Expand Down Expand Up @@ -940,7 +942,7 @@ fun AnimeScreenLargeImpl(
},
endContent = {
// AY -->
FastScrollLazyVerticalGrid(
FastScrollIrregularLazyVerticalGrid(
modifier = Modifier.fillMaxHeight(),
state = itemListState,
columns = if (gridSize == 0) GridCells.Adaptive(128.dp) else GridCells.Fixed(gridSize),
Expand All @@ -950,10 +952,11 @@ fun AnimeScreenLargeImpl(
top = contentPadding.calculateTopPadding(),
bottom = contentPadding.calculateBottomPadding(),
),
topContentPadding = contentPadding.calculateTopPadding(),
) {
// <-- AY
item(
key = AnimeScreenItem.EPISODE_HEADER,
key = EXACT_HEIGHT_KEY_PREFIX + AnimeScreenItem.EPISODE_HEADER,
contentType = AnimeScreenItem.EPISODE_HEADER,
// AY -->
span = { GridItemSpan(maxLineSpan) },
Expand Down Expand Up @@ -1000,7 +1003,7 @@ fun AnimeScreenLargeImpl(
// AY -->
if (state.airingTime > 0L) {
item(
key = AnimeScreenItem.AIRING_TIME,
key = EXACT_HEIGHT_KEY_PREFIX + AnimeScreenItem.AIRING_TIME,
contentType = AnimeScreenItem.AIRING_TIME,
) {
// Handles the second by second countdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,48 @@ fun FastScrollLazyVerticalGrid(
)
}
}

// AM -->
@Composable
fun FastScrollIrregularLazyVerticalGrid(
columns: GridCells,
modifier: Modifier = Modifier,
state: LazyGridState = rememberLazyGridState(),
thumbAllowed: () -> Boolean = { true },
thumbColor: Color = MaterialTheme.colorScheme.primary,
contentPadding: PaddingValues = PaddingValues(0.dp),
topContentPadding: Dp = Dp.Hairline,
bottomContentPadding: Dp = Dp.Hairline,
endContentPadding: Dp = Dp.Hairline,
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical =
if (!reverseLayout) Arrangement.Top else Arrangement.Bottom,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
userScrollEnabled: Boolean = true,
content: LazyGridScope.() -> Unit,
) {
IrregularVerticalGridFastScroller(
state = state,
columns = columns,
arrangement = horizontalArrangement,
contentPadding = contentPadding,
modifier = modifier,
thumbAllowed = thumbAllowed,
thumbColor = thumbColor,
topContentPadding = topContentPadding,
bottomContentPadding = bottomContentPadding,
endContentPadding = endContentPadding,
) {
LazyVerticalGrid(
columns = columns,
state = state,
contentPadding = contentPadding,
reverseLayout = reverseLayout,
verticalArrangement = verticalArrangement,
horizontalArrangement = horizontalArrangement,
userScrollEnabled = userScrollEnabled,
content = content,
)
}
}
// <-- AM
Loading