Compare commits

..

No commits in common. "264030d6ecbc7492d884eb328b74399cd722dcb0" and "f7752a98b2452a69f22a469d0bcbf761fb1c6569" have entirely different histories.

25 changed files with 49 additions and 96 deletions

View File

@ -32,7 +32,7 @@ jobs:
uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5
- name: Set up JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
java-version: 17
distribution: adopt

View File

@ -27,7 +27,7 @@ jobs:
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager "build-tools;29.0.3"
- name: Set up JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0
with:
java-version: 17
distribution: adopt

View File

@ -56,7 +56,7 @@ fun ReaderAppBars(
enabledPrevious: Boolean,
currentPage: Int,
totalPages: Int,
onPageIndexChange: (Int) -> Unit,
onSliderValueChange: (Int) -> Unit,
readingMode: ReadingMode,
onClickReadingMode: () -> Unit,
@ -176,8 +176,9 @@ fun ReaderAppBars(
enabledPrevious = enabledPrevious,
currentPage = currentPage,
totalPages = totalPages,
onPageIndexChange = onPageIndexChange,
onSliderValueChange = onSliderValueChange,
)
BottomReaderBar(
backgroundColor = backgroundColor,
readingMode = readingMode,

View File

@ -4,7 +4,6 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsDraggedAsState
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
@ -17,6 +16,7 @@ import androidx.compose.material3.FilledIconButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButtonDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Slider
import androidx.compose.material3.Text
import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.runtime.Composable
@ -29,7 +29,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalLayoutDirection
@ -39,8 +38,8 @@ 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.components.material.Slider
import tachiyomi.presentation.core.i18n.stringResource
import kotlin.math.roundToInt
@Composable
fun ChapterNavigator(
@ -51,7 +50,7 @@ fun ChapterNavigator(
enabledPrevious: Boolean,
currentPage: Int,
totalPages: Int,
onPageIndexChange: (Int) -> Unit,
onSliderValueChange: (Int) -> Unit,
) {
val isTabletUi = isTabletUi()
val horizontalPadding = if (isTabletUi) 24.dp else 8.dp
@ -98,11 +97,7 @@ fun ChapterNavigator(
.padding(horizontal = 16.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Box(contentAlignment = Alignment.CenterEnd) {
Text(text = currentPage.toString())
// Taking up full length so the slider doesn't shift when 'currentPage' length changes
Text(text = totalPages.toString(), color = Color.Transparent)
}
val interactionSource = remember { MutableInteractionSource() }
val sliderDragged by interactionSource.collectIsDraggedAsState()
@ -115,11 +110,14 @@ fun ChapterNavigator(
modifier = Modifier
.weight(1f)
.padding(horizontal = 8.dp),
value = currentPage,
valueRange = 1..totalPages,
onValueChange = f@{
if (it == currentPage) return@f
onPageIndexChange(it - 1)
value = currentPage.toFloat(),
valueRange = 1f..totalPages.toFloat(),
steps = totalPages - 2,
onValueChange = {
val new = it.roundToInt() - 1
if (new != currentPage) {
onSliderValueChange(new)
}
},
interactionSource = interactionSource,
)
@ -160,7 +158,7 @@ private fun ChapterNavigatorPreview() {
enabledPrevious = true,
currentPage = currentPage,
totalPages = 10,
onPageIndexChange = { currentPage = (it + 1) },
onSliderValueChange = { currentPage = it },
)
}
}

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.data.database.models

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.data.database.models

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.data.database.models

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.data.database.models

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.data.track.model

View File

@ -401,7 +401,7 @@ class ReaderActivity : BaseActivity() {
enabledPrevious = state.viewerChapters?.prevChapter != null,
currentPage = state.currentPage,
totalPages = state.totalPages,
onPageIndexChange = {
onSliderValueChange = {
isScrollingThroughPages = true
moveToPageIndex(it)
},

View File

@ -1,4 +1,4 @@
@file:Suppress("FunctionName")
@file:Suppress("FunctionName", "ktlint:standard:function-naming")
package eu.kanade.tachiyomi.network

View File

@ -9,7 +9,7 @@ sqldelight = "2.0.2"
sqlite = "2.4.0"
voyager = "1.0.0"
spotless = "6.25.0"
ktlint-core = "1.4.0"
ktlint-core = "1.3.1"
firebase-bom = "33.5.1"
[libraries]
@ -32,7 +32,7 @@ jsoup = "org.jsoup:jsoup:1.18.1"
disklrucache = "com.jakewharton:disklrucache:2.0.2"
unifile = "com.github.tachiyomiorg:unifile:e0def6b3dc"
libarchive = "me.zhanghai.android.libarchive:library:1.1.4"
libarchive = "me.zhanghai.android.libarchive:library:1.1.3"
sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "sqlite" }
sqlite-ktx = { module = "androidx.sqlite:sqlite-ktx", version.ref = "sqlite" }

View File

@ -28,6 +28,7 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Slider
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
@ -45,7 +46,6 @@ import tachiyomi.core.common.preference.Preference
import tachiyomi.core.common.preference.TriState
import tachiyomi.core.common.preference.toggle
import tachiyomi.presentation.core.components.material.DISABLED_ALPHA
import tachiyomi.presentation.core.components.material.Slider
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.header
@ -192,14 +192,17 @@ fun SliderItem(
}
Slider(
modifier = Modifier.weight(1.5f),
value = value,
onValueChange = f@{
if (it == value) return@f
onChange(it)
value = value.toFloat(),
onValueChange = {
val newValue = it.toInt()
if (newValue != value) {
onChange(newValue)
haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
}
},
valueRange = min..max,
modifier = Modifier.weight(1.5f),
valueRange = min.toFloat()..max.toFloat(),
steps = max - min - 1,
)
}
}

View File

@ -1,48 +0,0 @@
package tachiyomi.presentation.core.components.material
import androidx.annotation.IntRange
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderColors
import androidx.compose.material3.SliderDefaults
import androidx.compose.material3.SliderState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@Composable
fun Slider(
value: Int,
onValueChange: (Int) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
valueRange: ClosedRange<Int> = 0..1,
@IntRange(from = 0) steps: Int = with(valueRange) { (endInclusive - start) - 1 },
onValueChangeFinished: (() -> Unit)? = null,
colors: SliderColors = SliderDefaults.colors(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
thumb: @Composable (SliderState) -> Unit = {
SliderDefaults.Thumb(
interactionSource = interactionSource,
colors = colors,
enabled = enabled,
)
},
track: @Composable (SliderState) -> Unit = { sliderState ->
SliderDefaults.Track(colors = colors, enabled = enabled, sliderState = sliderState)
},
) {
Slider(
value = value.toFloat(),
onValueChange = { onValueChange(it.toInt()) },
modifier = modifier,
enabled = enabled,
valueRange = with(valueRange) { start.toFloat()..endInclusive.toFloat() },
steps = steps,
onValueChangeFinished = onValueChangeFinished,
colors = colors,
interactionSource = interactionSource,
thumb = thumb,
track = track,
)
}

View File

@ -82,5 +82,5 @@ val CustomIcons.Discord: ImageVector
return _discord!!
}
@Suppress("ObjectPropertyName")
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
private var _discord: ImageVector? = null

View File

@ -59,5 +59,5 @@ val CustomIcons.Facebook: ImageVector
return _facebook!!
}
@Suppress("ObjectPropertyName")
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
private var _facebook: ImageVector? = null

View File

@ -64,5 +64,5 @@ val CustomIcons.Github: ImageVector
return _github!!
}
@Suppress("ObjectPropertyName")
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
private var _github: ImageVector? = null

View File

@ -90,5 +90,5 @@ val CustomIcons.Reddit: ImageVector
return _reddit!!
}
@Suppress("ObjectPropertyName")
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
private var _reddit: ImageVector? = null

View File

@ -57,5 +57,5 @@ val CustomIcons.X: ImageVector
return _x!!
}
@Suppress("ObjectPropertyName")
@Suppress("ObjectPropertyName", "ktlint:standard:backing-property-naming")
private var _x: ImageVector? = null

View File

@ -20,7 +20,6 @@ dependencies {
api(projects.i18n)
implementation(compose.glance)
implementation(libs.material)
implementation(kotlinx.immutables)

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.source.model

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.source.model

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.source.model

View File

@ -1,4 +1,4 @@
@file:Suppress("PropertyName")
@file:Suppress("PropertyName", "ktlint:standard:property-naming")
package eu.kanade.tachiyomi.source.model

View File

@ -55,10 +55,10 @@ actual class LocalSource(
private val json: Json by injectLazy()
private val xml: XML by injectLazy()
@Suppress("PrivatePropertyName")
@Suppress("PrivatePropertyName", "ktlint:standard:property-naming")
private val PopularFilters = FilterList(OrderBy.Popular(context))
@Suppress("PrivatePropertyName")
@Suppress("PrivatePropertyName", "ktlint:standard:property-naming")
private val LatestFilters = FilterList(OrderBy.Latest(context))
override val name: String = context.stringResource(MR.strings.local_source)