mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-24 13:48:55 +03:00
parent
82eb36b628
commit
096276cd68
12 changed files with 25 additions and 98 deletions
|
@ -43,7 +43,6 @@ import androidx.compose.material3.LocalContentColor
|
|||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.material3.SuggestionChip
|
||||
import androidx.compose.material3.SuggestionChipDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
|
@ -654,11 +653,6 @@ private fun TagsChip(
|
|||
modifier = modifier,
|
||||
onClick = onClick,
|
||||
label = { Text(text = text, style = MaterialTheme.typography.bodySmall) },
|
||||
border = null,
|
||||
colors = SuggestionChipDefaults.suggestionChipColors(
|
||||
containerColor = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.12f),
|
||||
labelColor = MaterialTheme.colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ import androidx.compose.material3.LocalContentColor
|
|||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.material3.SuggestionChip
|
||||
import androidx.compose.material3.SuggestionChipDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.CompositionLocalProvider
|
||||
|
@ -654,11 +653,6 @@ private fun TagsChip(
|
|||
modifier = modifier,
|
||||
onClick = onClick,
|
||||
label = { Text(text = text, style = MaterialTheme.typography.bodySmall) },
|
||||
border = null,
|
||||
colors = SuggestionChipDefaults.suggestionChipColors(
|
||||
containerColor = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.12f),
|
||||
labelColor = MaterialTheme.colorScheme.onSurface,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.ColumnScope
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.FilterChip
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
|
@ -30,7 +31,6 @@ import tachiyomi.presentation.core.components.SettingsFlowRow
|
|||
import tachiyomi.presentation.core.components.SliderItem
|
||||
import tachiyomi.presentation.core.components.SortItem
|
||||
import tachiyomi.presentation.core.components.TriStateItem
|
||||
import tachiyomi.presentation.core.components.material.ChoiceChip
|
||||
|
||||
@Composable
|
||||
fun AnimeLibrarySettingsDialog(
|
||||
|
@ -184,10 +184,10 @@ private fun ColumnScope.DisplayPage(
|
|||
val displayMode by screenModel.libraryPreferences.libraryDisplayMode().collectAsState()
|
||||
SettingsFlowRow(R.string.action_display_mode) {
|
||||
displayModes.map { (titleRes, mode) ->
|
||||
ChoiceChip(
|
||||
isSelected = displayMode == mode,
|
||||
FilterChip(
|
||||
selected = displayMode == mode,
|
||||
onClick = { screenModel.setDisplayMode(mode) },
|
||||
content = { Text(stringResource(titleRes)) },
|
||||
label = { Text(stringResource(titleRes)) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.ColumnScope
|
|||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.FilterChip
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
|
@ -30,7 +31,6 @@ import tachiyomi.presentation.core.components.SettingsFlowRow
|
|||
import tachiyomi.presentation.core.components.SliderItem
|
||||
import tachiyomi.presentation.core.components.SortItem
|
||||
import tachiyomi.presentation.core.components.TriStateItem
|
||||
import tachiyomi.presentation.core.components.material.ChoiceChip
|
||||
|
||||
@Composable
|
||||
fun MangaLibrarySettingsDialog(
|
||||
|
@ -183,10 +183,10 @@ private fun ColumnScope.DisplayPage(
|
|||
val displayMode by screenModel.libraryPreferences.libraryDisplayMode().collectAsState()
|
||||
SettingsFlowRow(R.string.action_display_mode) {
|
||||
displayModes.map { (titleRes, mode) ->
|
||||
ChoiceChip(
|
||||
isSelected = displayMode == mode,
|
||||
FilterChip(
|
||||
selected = displayMode == mode,
|
||||
onClick = { screenModel.setDisplayMode(mode) },
|
||||
content = { Text(stringResource(titleRes)) },
|
||||
label = { Text(stringResource(titleRes)) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package eu.kanade.presentation.reader.settings
|
|||
|
||||
import android.os.Build
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.material3.FilterChip
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
|
@ -18,7 +19,6 @@ import tachiyomi.core.preference.getAndSet
|
|||
import tachiyomi.presentation.core.components.CheckboxItem
|
||||
import tachiyomi.presentation.core.components.SettingsFlowRow
|
||||
import tachiyomi.presentation.core.components.SliderItem
|
||||
import tachiyomi.presentation.core.components.material.ChoiceChip
|
||||
|
||||
@Composable
|
||||
internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel) {
|
||||
|
@ -126,10 +126,10 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
|
|||
val colorFilterMode by screenModel.preferences.colorFilterMode().collectAsState()
|
||||
SettingsFlowRow(R.string.pref_color_filter_mode) {
|
||||
colorFilterModes.mapIndexed { index, it ->
|
||||
ChoiceChip(
|
||||
isSelected = colorFilterMode == index,
|
||||
FilterChip(
|
||||
selected = colorFilterMode == index,
|
||||
onClick = { screenModel.preferences.colorFilterMode().set(index) },
|
||||
content = { Text(it) },
|
||||
label = { Text(it) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.kanade.presentation.reader.settings
|
||||
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.material3.FilterChip
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
|
@ -11,7 +12,6 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
|||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
|
||||
import tachiyomi.presentation.core.components.CheckboxItem
|
||||
import tachiyomi.presentation.core.components.SettingsFlowRow
|
||||
import tachiyomi.presentation.core.components.material.ChoiceChip
|
||||
|
||||
private val themes = listOf(
|
||||
R.string.black_background to 1,
|
||||
|
@ -25,10 +25,10 @@ internal fun ColumnScope.GeneralPage(screenModel: ReaderSettingsScreenModel) {
|
|||
val readerTheme by screenModel.preferences.readerTheme().collectAsState()
|
||||
SettingsFlowRow(R.string.pref_reader_theme) {
|
||||
themes.map { (labelRes, value) ->
|
||||
ChoiceChip(
|
||||
isSelected = readerTheme == value,
|
||||
FilterChip(
|
||||
selected = readerTheme == value,
|
||||
onClick = { screenModel.preferences.readerTheme().set(value) },
|
||||
content = { Text(stringResource(labelRes)) },
|
||||
label = { Text(stringResource(labelRes)) },
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ interface AnimeTrackService {
|
|||
}
|
||||
|
||||
suspend fun setRemoteLastEpisodeSeen(track: AnimeTrack, episodeNumber: Int) {
|
||||
if (track.last_episode_seen == 0F && track.last_episode_seen < episodeNumber && track.status != getRewatchingStatus()) {
|
||||
if (track.last_episode_seen == 0f && track.last_episode_seen < episodeNumber && track.status != getRewatchingStatus()) {
|
||||
track.status = getWatchingStatus()
|
||||
}
|
||||
track.last_episode_seen = episodeNumber.toFloat()
|
||||
|
|
|
@ -96,7 +96,7 @@ interface MangaTrackService {
|
|||
}
|
||||
|
||||
suspend fun setRemoteLastChapterRead(track: MangaTrack, chapterNumber: Int) {
|
||||
if (track.last_chapter_read == 0F && track.last_chapter_read < chapterNumber && track.status != getRereadingStatus()) {
|
||||
if (track.last_chapter_read == 0f && track.last_chapter_read < chapterNumber && track.status != getRereadingStatus()) {
|
||||
track.status = getReadingStatus()
|
||||
}
|
||||
track.last_chapter_read = chapterNumber.toFloat()
|
||||
|
|
|
@ -420,7 +420,7 @@ class ReaderViewModel(
|
|||
|
||||
// Save last page read and mark as read if needed
|
||||
viewModelScope.launchNonCancellable {
|
||||
updateChapterProgress(page.index)
|
||||
updateChapterProgress(selectedChapter, page)
|
||||
}
|
||||
|
||||
if (selectedChapter != getCurrentChapter()) {
|
||||
|
@ -500,15 +500,15 @@ class ReaderViewModel(
|
|||
* Saves the chapter progress (last read page and whether it's read)
|
||||
* if incognito mode isn't on.
|
||||
*/
|
||||
private suspend fun updateChapterProgress(pageIndex: Int) {
|
||||
val readerChapter = getCurrentChapter() ?: return
|
||||
private suspend fun updateChapterProgress(readerChapter: ReaderChapter, page: Page) {
|
||||
val pageIndex = page.index
|
||||
|
||||
mutableState.update {
|
||||
it.copy(currentPage = pageIndex + 1)
|
||||
}
|
||||
readerChapter.requestedPage = pageIndex
|
||||
|
||||
if (!incognitoMode) {
|
||||
readerChapter.requestedPage = pageIndex
|
||||
if (!incognitoMode && page.status != Page.State.ERROR) {
|
||||
readerChapter.chapter.last_page_read = pageIndex
|
||||
|
||||
if (readerChapter.pages?.lastIndex == pageIndex) {
|
||||
|
@ -521,7 +521,6 @@ class ReaderViewModel(
|
|||
ChapterUpdate(
|
||||
id = readerChapter.chapter.id!!,
|
||||
read = readerChapter.chapter.read,
|
||||
bookmark = readerChapter.chapter.bookmark,
|
||||
lastPageRead = readerChapter.chapter.last_page_read.toLong(),
|
||||
),
|
||||
)
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
|
|
@ -491,7 +491,7 @@ fun SettingsFlowRow(
|
|||
end = SettingsItemsPaddings.Horizontal,
|
||||
bottom = SettingsItemsPaddings.Vertical,
|
||||
),
|
||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
package tachiyomi.presentation.core.components.material
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredHeight
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.ProvideTextStyle
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun Chip(
|
||||
modifier: Modifier = Modifier,
|
||||
backgroundColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.15f),
|
||||
contentColor: Color = MaterialTheme.colorScheme.onSurface,
|
||||
onClick: () -> Unit = {},
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
Surface(
|
||||
modifier = Modifier,
|
||||
shape = CircleShape,
|
||||
color = backgroundColor,
|
||||
contentColor = contentColor,
|
||||
onClick = {},
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier.clickable(onClick = onClick)
|
||||
.widthIn(min = 56.dp)
|
||||
.requiredHeight(32.dp)
|
||||
.padding(horizontal = 12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
) {
|
||||
ProvideTextStyle(MaterialTheme.typography.bodySmall, content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ChoiceChip(
|
||||
modifier: Modifier = Modifier,
|
||||
isSelected: Boolean,
|
||||
onClick: () -> Unit = {},
|
||||
selectedBackgroundColor: Color = MaterialTheme.colorScheme.primary,
|
||||
selectedContentColor: Color = MaterialTheme.colorScheme.onPrimary,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
if (isSelected) {
|
||||
Chip(modifier, selectedBackgroundColor, selectedContentColor, onClick, content)
|
||||
} else {
|
||||
Chip(modifier, onClick = onClick, content = content)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue