Skip to content

Commit

Permalink
Reduce ChapterNavigator horizontal padding on small ui (mihonapp/miho…
Browse files Browse the repository at this point in the history
…n#1202)

Co-authored-by: p
(cherry picked from commit 6f42274)
  • Loading branch information
AntsyLich authored and cuong-tran committed Sep 7, 2024
1 parent eaea06a commit e24f4b2
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
Expand All @@ -36,9 +38,11 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.theme.TachiyomiPreviewTheme
import eu.kanade.presentation.util.isTabletUi
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
Expand Down Expand Up @@ -75,7 +79,7 @@ fun ChapterNavigator(
}
// SY <--
val isTabletUi = isTabletUi()
val horizontalPadding = if (isTabletUi) 24.dp else 16.dp
val horizontalPadding = if (isTabletUi) 24.dp else 8.dp
val layoutDirection = if (isRtl) LayoutDirection.Rtl else LayoutDirection.Ltr
val haptic = LocalHapticFeedback.current

Expand Down Expand Up @@ -194,7 +198,7 @@ fun ChapterNavigatorVert(
onSliderValueChange: (Int) -> Unit,
) {
val isTabletUi = isTabletUi()
val verticalPadding = if (isTabletUi) 24.dp else 16.dp
val verticalPadding = if (isTabletUi) 24.dp else 8.dp

val haptic = LocalHapticFeedback.current

Expand Down Expand Up @@ -297,3 +301,23 @@ fun ChapterNavigatorVert(
}
}
}

@Preview
@Composable
private fun ChapterNavigatorPreview() {
var currentPage by remember { mutableIntStateOf(1) }
TachiyomiPreviewTheme {
ChapterNavigator(
isRtl = false,
onNextChapter = {},
enabledNext = true,
onPreviousChapter = {},
enabledPrevious = true,
currentPage = currentPage,
totalPages = 10,
onSliderValueChange = { currentPage = it },
isVerticalSlider = false,
currentPageText = "currentPageText",
)
}
}

0 comments on commit e24f4b2

Please sign in to comment.