Automatic Lint

This commit is contained in:
Syer10
2022-07-29 21:40:09 +00:00
parent 385e32d07f
commit d00459d020
68 changed files with 157 additions and 146 deletions

View File

@@ -41,7 +41,7 @@ object Notifications {
},
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
setName(MR.strings.group_updates.desc().toString(context))
},
}
)
)

View File

@@ -41,7 +41,8 @@ class BackupRepositoryImpl @Inject constructor(
private fun buildFormData(file: Path) = formData {
append(
"backup.proto.gz", FileSystem.SYSTEM.source(file).buffer().readByteArray(),
"backup.proto.gz",
FileSystem.SYSTEM.source(file).buffer().readByteArray(),
Headers.build {
append(HttpHeaders.ContentType, ContentType.MultiPart.FormData.toString())
append(HttpHeaders.ContentDisposition, "filename=backup.proto.gz")
@@ -73,7 +74,7 @@ class BackupRepositoryImpl @Inject constructor(
override fun exportBackupFile(block: HttpRequestBuilder.() -> Unit) = flow {
val response = client.get(
buildUrl { path(backupFileExportRequest()) },
buildUrl { path(backupFileExportRequest()) }
) {
expectSuccess = true
block()

View File

@@ -42,7 +42,7 @@ class CategoryRepositoryImpl @Inject constructor(
override fun getMangaCategories(mangaId: Long) = flow {
val response = client.get(
buildUrl { path(getMangaCategoriesQuery(mangaId)) },
buildUrl { path(getMangaCategoriesQuery(mangaId)) }
) {
expectSuccess = true
}.body<List<Category>>()
@@ -69,7 +69,7 @@ class CategoryRepositoryImpl @Inject constructor(
override fun getCategories(dropDefault: Boolean) = flow {
val response = client.get(
buildUrl { path(getCategoriesQuery()) },
buildUrl { path(getCategoriesQuery()) }
) {
expectSuccess = true
}.body<List<Category>>().let { categories ->
@@ -126,7 +126,7 @@ class CategoryRepositoryImpl @Inject constructor(
override fun deleteCategory(categoryId: Long) = flow {
val response = client.delete(
buildUrl { path(categoryDeleteRequest(categoryId)) },
buildUrl { path(categoryDeleteRequest(categoryId)) }
) {
expectSuccess = true
}
@@ -135,7 +135,7 @@ class CategoryRepositoryImpl @Inject constructor(
override fun getMangaFromCategory(categoryId: Long) = flow {
val response = client.get(
buildUrl { path(getMangaInCategoryQuery(categoryId)) },
buildUrl { path(getMangaInCategoryQuery(categoryId)) }
) {
expectSuccess = true
}.body<List<Manga>>()

View File

@@ -29,7 +29,7 @@ class DownloadRepositoryImpl @Inject constructor(
override fun startDownloading() = flow {
val response = client.get(
buildUrl { path(downloadsStartRequest()) },
buildUrl { path(downloadsStartRequest()) }
) {
expectSuccess = true
}
@@ -38,7 +38,7 @@ class DownloadRepositoryImpl @Inject constructor(
override fun stopDownloading() = flow {
val response = client.get(
buildUrl { path(downloadsStopRequest()) },
buildUrl { path(downloadsStopRequest()) }
) {
expectSuccess = true
}
@@ -47,7 +47,7 @@ class DownloadRepositoryImpl @Inject constructor(
override fun clearDownloadQueue() = flow {
val response = client.get(
buildUrl { path(downloadsClearRequest()) },
buildUrl { path(downloadsClearRequest()) }
) {
expectSuccess = true
}

View File

@@ -35,7 +35,7 @@ class ExtensionRepositoryImpl @Inject constructor(
override fun getExtensionList() = flow {
val response = client.get(
buildUrl { path(extensionListQuery()) },
buildUrl { path(extensionListQuery()) }
) {
expectSuccess = true
}.body<List<Extension>>()
@@ -44,7 +44,7 @@ class ExtensionRepositoryImpl @Inject constructor(
override fun installExtension(extension: Extension) = flow {
val response = client.get(
buildUrl { path(apkInstallQuery(extension.pkgName)) },
buildUrl { path(apkInstallQuery(extension.pkgName)) }
) {
expectSuccess = true
}
@@ -53,7 +53,7 @@ class ExtensionRepositoryImpl @Inject constructor(
override fun updateExtension(extension: Extension) = flow {
val response = client.get(
buildUrl { path(apkUpdateQuery(extension.pkgName)) },
buildUrl { path(apkUpdateQuery(extension.pkgName)) }
) {
expectSuccess = true
}
@@ -62,7 +62,7 @@ class ExtensionRepositoryImpl @Inject constructor(
override fun uninstallExtension(extension: Extension) = flow {
val response = client.get(
buildUrl { path(apkUninstallQuery(extension.pkgName)) },
buildUrl { path(apkUninstallQuery(extension.pkgName)) }
) {
expectSuccess = true
}
@@ -71,7 +71,7 @@ class ExtensionRepositoryImpl @Inject constructor(
override fun getApkIcon(extension: Extension, block: HttpRequestBuilder.() -> Unit) = flow {
val response = client.get(
buildUrl { path(apkIconQuery(extension.apkName)) },
buildUrl { path(apkIconQuery(extension.apkName)) }
) {
expectSuccess = true
block()

View File

@@ -29,7 +29,7 @@ class LibraryRepositoryImpl @Inject constructor(
override fun addMangaToLibrary(mangaId: Long) = flow {
val response = client.get(
buildUrl { path(addMangaToLibraryQuery(mangaId)) },
buildUrl { path(addMangaToLibraryQuery(mangaId)) }
) {
expectSuccess = true
}
@@ -38,7 +38,7 @@ class LibraryRepositoryImpl @Inject constructor(
override fun removeMangaFromLibrary(mangaId: Long) = flow {
val response = client.delete(
buildUrl { path(removeMangaFromLibraryRequest(mangaId)) },
buildUrl { path(removeMangaFromLibraryRequest(mangaId)) }
) {
expectSuccess = true
}

View File

@@ -41,7 +41,7 @@ class MangaRepositoryImpl @Inject constructor(
if (refresh) {
parameter("onlineFetch", true)
}
},
}
) {
expectSuccess = true
}.body<Manga>()
@@ -50,7 +50,7 @@ class MangaRepositoryImpl @Inject constructor(
override fun getMangaThumbnail(mangaId: Long, block: HttpRequestBuilder.() -> Unit) = flow {
val response = client.get(
buildUrl { path(mangaThumbnailQuery(mangaId)) },
buildUrl { path(mangaThumbnailQuery(mangaId)) }
) {
expectSuccess = true
block()
@@ -60,7 +60,7 @@ class MangaRepositoryImpl @Inject constructor(
override fun updateMangaMeta(mangaId: Long, key: String, value: String) = flow {
val response = client.submitForm(
buildUrl { path(updateMangaMetaRequest(mangaId),) },
buildUrl { path(updateMangaMetaRequest(mangaId)) },
formParameters = Parameters.build {
append("key", key)
append("value", value)

View File

@@ -31,7 +31,7 @@ class SettingsRepositoryImpl @Inject constructor(
override fun aboutServer() = flow {
val response = client.get(
buildUrl { path(aboutQuery()) },
buildUrl { path(aboutQuery()) }
) {
expectSuccess = true
}.body<About>()
@@ -40,7 +40,7 @@ class SettingsRepositoryImpl @Inject constructor(
override fun checkUpdate() = flow {
val response = client.post(
buildUrl { path(checkUpdateQuery()) },
buildUrl { path(checkUpdateQuery()) }
) {
expectSuccess = true
}

View File

@@ -48,7 +48,7 @@ class SourceRepositoryImpl @Inject constructor(
override fun getSourceList() = flow {
val response = client.get(
buildUrl { path(sourceListQuery()) },
buildUrl { path(sourceListQuery()) }
) {
expectSuccess = true
}.body<List<Source>>()
@@ -57,7 +57,7 @@ class SourceRepositoryImpl @Inject constructor(
override fun getSourceInfo(sourceId: Long) = flow {
val response = client.get(
buildUrl { path(sourceInfoQuery(sourceId)) },
buildUrl { path(sourceInfoQuery(sourceId)) }
) {
expectSuccess = true
}.body<Source>()
@@ -66,7 +66,7 @@ class SourceRepositoryImpl @Inject constructor(
override fun getPopularManga(sourceId: Long, pageNum: Int) = flow {
val response = client.get(
buildUrl { path(sourcePopularQuery(sourceId, pageNum)) },
buildUrl { path(sourcePopularQuery(sourceId, pageNum)) }
) {
expectSuccess = true
}.body<MangaPage>()
@@ -75,7 +75,7 @@ class SourceRepositoryImpl @Inject constructor(
override fun getLatestManga(sourceId: Long, pageNum: Int) = flow {
val response = client.get(
buildUrl { path(sourceLatestQuery(sourceId, pageNum)) },
buildUrl { path(sourceLatestQuery(sourceId, pageNum)) }
) {
expectSuccess = true
}.body<MangaPage>()
@@ -90,7 +90,7 @@ class SourceRepositoryImpl @Inject constructor(
if (searchTerm.isNotBlank()) {
parameter("searchTerm", searchTerm)
}
},
}
) {
expectSuccess = true
}.body<MangaPage>()
@@ -104,7 +104,7 @@ class SourceRepositoryImpl @Inject constructor(
if (reset) {
parameter("reset", true)
}
},
}
) {
expectSuccess = true
}.body<List<SourceFilter>>()
@@ -113,7 +113,7 @@ class SourceRepositoryImpl @Inject constructor(
override fun setFilter(sourceId: Long, sourceFilter: SourceFilterChange) = flow {
val response = client.post(
buildUrl { path(setFilterRequest(sourceId)) },
buildUrl { path(setFilterRequest(sourceId)) }
) {
contentType(ContentType.Application.Json)
setBody(sourceFilter)
@@ -137,7 +137,7 @@ class SourceRepositoryImpl @Inject constructor(
override fun getSourceSettings(sourceId: Long) = flow {
val response = client.get(
buildUrl { path(getSourceSettingsQuery(sourceId)) },
buildUrl { path(getSourceSettingsQuery(sourceId)) }
) {
expectSuccess = true
}.body<List<SourcePreference>>()
@@ -146,7 +146,7 @@ class SourceRepositoryImpl @Inject constructor(
override fun setSourceSetting(sourceId: Long, sourcePreference: SourcePreferenceChange) = flow {
val response = client.post(
buildUrl { path(updateSourceSettingQuery(sourceId)) },
buildUrl { path(updateSourceSettingQuery(sourceId)) }
) {
contentType(ContentType.Application.Json)
setBody(sourcePreference)

View File

@@ -207,7 +207,7 @@ suspend fun main() {
},
properties = getMaterialDialogProperties(
size = DpSize(400.dp, 200.dp)
),
)
) {
title(stringResource(MR.strings.confirm_exit))
message(stringResource(MR.strings.confirm_exit_message))

View File

@@ -11,5 +11,5 @@ import kotlinx.serialization.Serializable
@Serializable
data class DownloadStatus(
val status: DownloaderStatus,
val queue: List<DownloadChapter>,
val queue: List<DownloadChapter>
)

View File

@@ -12,7 +12,7 @@ enum class DefaultReaderMode(
val direction: Direction = Direction.Down,
val padding: Int = 0,
val imageScale: ImageScale = ImageScale.FitScreen,
val navigationMode: NavigationMode = NavigationMode.LNavigation,
val navigationMode: NavigationMode = NavigationMode.LNavigation
) {
RTL("RTL", false, Direction.Left, navigationMode = NavigationMode.RightAndLeftNavigation),
LTR("LTR", false, Direction.Right, navigationMode = NavigationMode.RightAndLeftNavigation),

View File

@@ -17,7 +17,7 @@ import okio.Sink
import okio.sink
actual class FileSaver(
private val resultLauncher: ManagedActivityResultLauncher<String, Uri?>,
private val resultLauncher: ManagedActivityResultLauncher<String, Uri?>
) {
actual fun save(name: String) {
resultLauncher.launch(name)
@@ -28,7 +28,7 @@ actual class FileSaver(
actual fun rememberFileSaver(
onFileSelected: (Sink) -> Unit,
onCancel: () -> Unit,
onError: () -> Unit,
onError: () -> Unit
): FileSaver {
val context = LocalContext.current
val result = rememberLauncherForActivityResult(ActivityResultContracts.CreateDocument()) {

View File

@@ -45,7 +45,7 @@ actual fun InternalAboutLibraries(
showLicenseBadges: Boolean,
colors: LibraryColors,
itemContentPadding: PaddingValues,
onLibraryClick: ((Library) -> Unit)?,
onLibraryClick: ((Library) -> Unit)?
) {
Libraries(
libraries = libraries,

View File

@@ -126,7 +126,7 @@ private fun DownloadIconButton(onClick: () -> Unit) {
) {
Surface(
shape = CircleShape,
border = BorderStroke(2.dp, LocalContentColor.current.copy(alpha = ContentAlpha.disabled)),
border = BorderStroke(2.dp, LocalContentColor.current.copy(alpha = ContentAlpha.disabled))
) {
Icon(
Icons.Rounded.ArrowDownward,

View File

@@ -17,5 +17,5 @@ expect class FileSaver {
expect fun rememberFileSaver(
onFileSelected: (Sink) -> Unit,
onCancel: () -> Unit = {},
onError: () -> Unit = {},
onError: () -> Unit = {}
): FileSaver

View File

@@ -39,7 +39,7 @@ data class ActionItem(
val icon: ImageVector? = null,
val overflowMode: OverflowMode = OverflowMode.IF_NECESSARY,
val enabled: Boolean = true,
val doAction: () -> Unit,
val doAction: () -> Unit
) {
// allow 'calling' the action like a function
operator fun invoke() = doAction()
@@ -74,7 +74,7 @@ fun ActionMenu(
TextButton(onClick = item.doAction, enabled = item.enabled) {
Text(
text = item.name,
color = MaterialTheme.colors.onPrimary.copy(alpha = LocalContentAlpha.current),
color = MaterialTheme.colors.onPrimary.copy(alpha = LocalContentAlpha.current)
)
}
}
@@ -90,7 +90,7 @@ fun ActionMenu(
)
DropdownMenu(
expanded = menuVisible.value,
onDismissRequest = { menuVisible.value = false },
onDismissRequest = { menuVisible.value = false }
) {
overflowActions.fastForEach { item ->
key(item.hashCode()) {

View File

@@ -17,7 +17,7 @@ val LocalDisplayController =
compositionLocalOf<DisplayController?> { null }
class DisplayController(
private val _sideMenuVisible: MutableState<Boolean> = mutableStateOf(true),
private val _sideMenuVisible: MutableState<Boolean> = mutableStateOf(true)
) {
val sideMenuVisible by _sideMenuVisible

View File

@@ -88,7 +88,7 @@ fun Toolbar(
elevation: Dp = Dp.Hairline,
searchText: String? = null,
search: ((String) -> Unit)? = null,
searchSubmit: (() -> Unit)? = null,
searchSubmit: (() -> Unit)? = null
) {
BoxWithConstraints {
if (maxWidth > 600.dp) {
@@ -135,7 +135,7 @@ private fun WideToolbar(
elevation: Dp,
searchText: String?,
search: ((String) -> Unit)?,
searchSubmit: (() -> Unit)?,
searchSubmit: (() -> Unit)?
) {
Surface(
modifier = modifier,
@@ -204,7 +204,7 @@ private fun ThinToolbar(
elevation: Dp,
searchText: String?,
search: ((String) -> Unit)?,
searchSubmit: (() -> Unit)?,
searchSubmit: (() -> Unit)?
) {
var searchMode by remember { mutableStateOf(!searchText.isNullOrEmpty()) }
fun closeSearch() {
@@ -233,7 +233,7 @@ private fun ThinToolbar(
} else {
Row(Modifier.width(68.dp), verticalAlignment = Alignment.CenterVertically) {
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.high,
LocalContentAlpha provides ContentAlpha.high
) {
IconButton(
onClick = {
@@ -296,7 +296,7 @@ private fun ThinToolbar(
) {
ProvideTextStyle(value = MaterialTheme.typography.h6) {
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.high,
LocalContentAlpha provides ContentAlpha.high
) {
Text(name, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
@@ -308,7 +308,7 @@ private fun ThinToolbar(
Row(
Modifier.fillMaxHeight(),
horizontalArrangement = Arrangement.End,
verticalAlignment = Alignment.CenterVertically,
verticalAlignment = Alignment.CenterVertically
) {
if (search != null && !searchMode) {
IconButton(onClick = { searchMode = true }) {
@@ -373,7 +373,7 @@ fun TextActionIcon(
text: String,
icon: ImageVector,
enabled: Boolean = true,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
) {
Column(
Modifier

View File

@@ -78,7 +78,7 @@ fun ColorPickerDialog(
title: String,
onCloseRequest: () -> Unit = {},
onSelected: (Color) -> Unit,
initialColor: Color = Color.Unspecified,
initialColor: Color = Color.Unspecified
) {
var currentColor by remember(initialColor) { mutableStateOf(initialColor) }
var showPresets by remember { mutableStateOf(true) }
@@ -444,5 +444,5 @@ private val presetColors = listOf(
Color(0xFFFF9800), // ORANGE 500
Color(0xFF795548), // BROWN 500
Color(0xFF607D8B), // BLUE GREY 500
Color(0xFF9E9E9E), // GREY 500
Color(0xFF9E9E9E) // GREY 500
)

View File

@@ -91,7 +91,7 @@ fun PreferenceRow(
onLongClick: () -> Unit = {},
subtitle: String? = null,
enabled: Boolean = true,
action: @Composable (BoxScope.() -> Unit)? = null,
action: @Composable (BoxScope.() -> Unit)? = null
) {
val height = if (subtitle != null) 72.dp else 56.dp
@@ -153,7 +153,7 @@ fun SwitchPreference(
subtitle: String? = null,
icon: ImageVector? = null,
changeListener: () -> Unit = {},
enabled: Boolean = true,
enabled: Boolean = true
) {
PreferenceRow(
title = title,
@@ -200,7 +200,7 @@ fun EditTextPreference(
}
negativeButton(stringResource(MR.strings.action_cancel))
},
properties = getMaterialDialogProperties(),
properties = getMaterialDialogProperties()
) {
title(title)
input(
@@ -296,7 +296,7 @@ fun <T> MultiSelectDialog(
selected: List<T>?,
onCloseRequest: () -> Unit = {},
onFinished: (List<T>) -> Unit,
title: String,
title: String
) {
MaterialDialog(
state,
@@ -388,7 +388,7 @@ fun ExpandablePreference(
title: String,
startExpanded: Boolean = false,
onExpandedChanged: ((Boolean) -> Unit)? = null,
expandedContent: @Composable ColumnScope.() -> Unit,
expandedContent: @Composable ColumnScope.() -> Unit
) {
var expanded by remember { mutableStateOf(startExpanded) }
LaunchedEffect(expanded) {
@@ -424,14 +424,14 @@ fun ExpandablePreference(
imageVector = Icons.Rounded.ArrowDropUp,
contentDescription = "Expandable Arrow",
modifier = Modifier.rotate(arrowRotationDegree)
.align(Alignment.CenterStart),
.align(Alignment.CenterStart)
)
Text(
text = title,
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
textAlign = TextAlign.Center,
textAlign = TextAlign.Center
)
}
ExpandableContent(

View File

@@ -127,7 +127,7 @@ class AppThemeViewModel @Inject constructor(
secondary = secondary,
secondaryVariant = secondary,
onPrimary = if (primary.luminance() > 0.5) Color.Black else Color.White,
onSecondary = if (secondary.luminance() > 0.5) Color.Black else Color.White,
onSecondary = if (secondary.luminance() > 0.5) Color.Black else Color.White
)
}

View File

@@ -33,7 +33,7 @@ fun RenameDialog(
positiveButton(stringResource(MR.strings.action_rename))
negativeButton(stringResource(MR.strings.action_cancel))
},
properties = getMaterialDialogProperties(),
properties = getMaterialDialogProperties()
) {
title(stringResource(MR.strings.categories_rename))
input(
@@ -62,7 +62,7 @@ fun DeleteDialog(
}
negativeButton(stringResource(MR.strings.action_no))
},
properties = getMaterialDialogProperties(),
properties = getMaterialDialogProperties()
) {
title(stringResource(MR.strings.categories_delete))
message(stringResource(MR.strings.categories_delete_confirm, category.name))
@@ -80,7 +80,7 @@ fun CreateDialog(
positiveButton(stringResource(MR.strings.action_create))
negativeButton(stringResource(MR.strings.action_cancel))
},
properties = getMaterialDialogProperties(),
properties = getMaterialDialogProperties()
) {
title(stringResource(MR.strings.categories_create))
input(

View File

@@ -92,7 +92,7 @@ fun CategoriesScreenContent(
) {
Box(Modifier.padding(it)) {
val state = rememberLazyListState()
LazyColumn(modifier = Modifier.fillMaxSize(), state = state,) {
LazyColumn(modifier = Modifier.fillMaxSize(), state = state) {
itemsIndexed(categories) { i, category ->
val renameDialogState = rememberMaterialDialogState()
val deleteDialogState = rememberMaterialDialogState()
@@ -107,7 +107,7 @@ fun CategoriesScreenContent(
},
onDelete = {
deleteDialogState.show()
},
}
)
RenameDialog(renameDialogState, category) {
renameCategory(category, it)
@@ -147,7 +147,7 @@ private fun CategoryRow(
onMoveUp: () -> Unit = {},
onMoveDown: () -> Unit = {},
onRename: () -> Unit = {},
onDelete: () -> Unit = {},
onDelete: () -> Unit = {}
) {
Card(Modifier.padding(8.dp)) {
Column {
@@ -156,7 +156,7 @@ private fun CategoryRow(
imageVector = Icons.Outlined.List,
modifier = Modifier.padding(16.dp),
tint = MaterialTheme.colors.primary,
contentDescription = null,
contentDescription = null
)
Text(
text = category.name,

View File

@@ -183,7 +183,7 @@ private fun getActionItems(
downloadStatus: DownloaderStatus,
startDownloading: () -> Unit,
pauseDownloading: () -> Unit,
clearQueue: () -> Unit,
clearQueue: () -> Unit
): List<ActionItem> {
return listOf(
if (downloadStatus == DownloaderStatus.Started) {

View File

@@ -125,7 +125,7 @@ class ExtensionsScreenViewModel @Inject constructor(
val available = filter { !it.installed }.sortedWith(comparator)
return mapOf(
MR.strings.installed.toPlatformString() to (obsolete + updates + installed),
MR.strings.installed.toPlatformString() to (obsolete + updates + installed)
).filterNot { it.value.isEmpty() } + available.groupBy { it.lang }.mapKeys {
if (it.key == "all") {
MR.strings.all.toPlatformString()

View File

@@ -209,7 +209,7 @@ fun LanguageDialog(
positiveButton(stringResource(MR.strings.action_ok))
negativeButton(stringResource(MR.strings.action_cancel))
},
properties = getMaterialDialogProperties(),
properties = getMaterialDialogProperties()
) {
title(BuildKonfig.NAME)

View File

@@ -85,7 +85,7 @@ private fun LibraryMangaListItem(
MangaListItem(
modifier = modifier then Modifier
.requiredHeight(56.dp)
.padding(horizontal = 16.dp),
.padding(horizontal = 16.dp)
) {
MangaListItemImage(
modifier = Modifier
@@ -98,7 +98,7 @@ private fun LibraryMangaListItem(
modifier = Modifier
.weight(1f)
.padding(horizontal = 16.dp),
text = manga.title,
text = manga.title
)
Box(Modifier.width(IntrinsicSize.Min)) {
LibraryMangaBadges(

View File

@@ -342,7 +342,7 @@ fun ThinLibraryScreenContent(
@Composable
@Stable
private fun getActionItems(
onToggleFiltersClick: () -> Unit,
onToggleFiltersClick: () -> Unit
): List<ActionItem> {
return listOfNotNull(
ActionItem(

View File

@@ -28,7 +28,7 @@ fun getLibraryFilters(vm: LibrarySettingsViewModel): @Composable () -> Unit = re
completed = vm.filterCompleted.collectAsState().value,
setDownloadedFilter = { vm.filterDownloaded.value = it },
setUnreadFilter = { vm.filterUnread.value = it },
setCompletedFilter = { vm.filterCompleted.value = it },
setCompletedFilter = { vm.filterCompleted.value = it }
)
}
}
@@ -40,7 +40,7 @@ fun LibraryFilters(
completed: FilterState,
setDownloadedFilter: (FilterState) -> Unit,
setUnreadFilter: (FilterState) -> Unit,
setCompletedFilter: (FilterState) -> Unit,
setCompletedFilter: (FilterState) -> Unit
) {
Column(Modifier.fillMaxWidth()) {
Filter(

View File

@@ -33,7 +33,7 @@ import ca.gosyer.jui.uicore.resources.stringResource
fun LibrarySideMenu(
libraryFilters: @Composable () -> Unit,
librarySort: @Composable () -> Unit,
libraryDisplay: @Composable () -> Unit,
libraryDisplay: @Composable () -> Unit
) {
Surface(Modifier.fillMaxHeight().width(260.dp), elevation = 1.dp) {
Box {

View File

@@ -89,7 +89,7 @@ fun SkinnyMainMenu(
AnimatedVisibility(
navigator.size <= 1,
enter = slideInVertically(initialOffsetY = { it }),
exit = slideOutVertically(targetOffsetY = { it }),
exit = slideOutVertically(targetOffsetY = { it })
) {
BottomNav(navigator)
}

View File

@@ -45,7 +45,7 @@ internal expect fun InternalAboutLibraries(
showLicenseBadges: Boolean,
colors: LibraryColors,
itemContentPadding: PaddingValues,
onLibraryClick: ((Library) -> Unit)?,
onLibraryClick: ((Library) -> Unit)?
)
@Composable
@@ -59,7 +59,7 @@ fun AboutLibraries(
showLicenseBadges: Boolean = true,
colors: LibraryColors = LibraryDefaults.libraryColors(),
itemContentPadding: PaddingValues = LibraryDefaults.ContentPadding,
onLibraryClick: ((Library) -> Unit)? = null,
onLibraryClick: ((Library) -> Unit)? = null
) {
InternalAboutLibraries(
libraries = libraries,

View File

@@ -66,7 +66,7 @@ fun SideMenu(modifier: Modifier, controller: DisplayController, navigator: Navig
remember { MoreMenus.values() }.forEach { topLevelMenu ->
SideMenuItem(
topLevelMenu.isSelected(navigator),
topLevelMenu,
topLevelMenu
) { navigator replaceAll it }
}
}

View File

@@ -70,7 +70,7 @@ private fun SideMenuItem(
onClick = {
if (selected) return@clickable
onClick(createScreen())
},
}
// onMiddleClick = { onMiddleClick?.invoke() } todo
)
) {

View File

@@ -62,7 +62,7 @@ class MangaScreenViewModel @Inject constructor(
private val removeMangaFromLibrary: RemoveMangaFromLibrary,
uiPreferences: UiPreferences,
contextWrapper: ContextWrapper,
private val params: Params,
private val params: Params
) : ViewModel(contextWrapper) {
private val _manga = MutableStateFlow<Manga?>(null)
val manga = _manga.asStateFlow()

View File

@@ -82,7 +82,7 @@ private fun Cover(manga: Manga, modifier: Modifier = Modifier) {
.aspectRatio(
ratio = mangaAspectRatio,
matchHeightConstraintsFirst = true
),
)
)
}
@@ -171,7 +171,7 @@ fun CategorySelectDialog(
positiveButton(stringResource(MR.strings.action_ok))
negativeButton(stringResource(MR.strings.action_cancel))
},
properties = getMaterialDialogProperties(),
properties = getMaterialDialogProperties()
) {
title(stringResource(MR.strings.select_categories))

View File

@@ -254,7 +254,7 @@ fun WideReaderMenu(
setSideMenuOpen: (Boolean) -> Unit,
setMangaReaderMode: (String) -> Unit,
movePrevChapter: () -> Unit,
moveNextChapter: () -> Unit,
moveNextChapter: () -> Unit
) {
val sideMenuSize by animateDpAsState(
targetValue = if (sideMenuOpen) {
@@ -305,7 +305,7 @@ fun WideReaderMenu(
pageEmitter = pageEmitter,
retry = retry,
progress = progress,
updateLastPageReadOffset = updateLastPageReadOffset,
updateLastPageReadOffset = updateLastPageReadOffset
)
SideMenuButton(sideMenuOpen, onOpenSideMenuClicked = { setSideMenuOpen(true) })
}
@@ -355,7 +355,7 @@ fun ThinReaderMenu(
ReaderSheet(
readerModes = readerModes,
selectedMode = readerMode,
onSetReaderMode = setMangaReaderMode,
onSetReaderMode = setMangaReaderMode
)
}
) {
@@ -378,7 +378,7 @@ fun ThinReaderMenu(
pageEmitter = pageEmitter,
retry = retry,
progress = progress,
updateLastPageReadOffset = updateLastPageReadOffset,
updateLastPageReadOffset = updateLastPageReadOffset
)
AnimatedVisibility(
readerMenuOpen,
@@ -440,7 +440,7 @@ fun ReaderLayout(
pageEmitter: SharedFlow<PageMove>,
retry: (ReaderPage) -> Unit,
progress: (Int) -> Unit,
updateLastPageReadOffset: (Int) -> Unit,
updateLastPageReadOffset: (Int) -> Unit
) {
val loadingModifier = Modifier.fillMaxWidth().aspectRatio(mangaAspectRatio)
val readerModifier = Modifier

View File

@@ -63,7 +63,7 @@ class ReaderMenuViewModel @Inject constructor(
private val updateMangaMeta: UpdateMangaMeta,
private val updateChapterMeta: UpdateChapterMeta,
contextWrapper: ContextWrapper,
private val params: Params,
private val params: Params
) : ViewModel(contextWrapper) {
override val scope = MainScope()
private val _manga = MutableStateFlow<Manga?>(null)

View File

@@ -107,7 +107,7 @@ fun ReaderExpandBottomMenu(
navigate: (Int) -> Unit,
readerMenuOpen: Boolean,
movePrevChapter: () -> Unit,
moveNextChapter: () -> Unit,
moveNextChapter: () -> Unit
) {
AnimatedVisibility(
readerMenuOpen,
@@ -160,7 +160,7 @@ fun ReaderExpandBottomMenu(
Card(
modifier = Modifier.fillMaxSize().padding(it).padding(horizontal = 8.dp),
shape = CircleShape,
backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.5F),
backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.5F)
) {
AroundLayout(
Modifier.padding(horizontal = 8.dp),
@@ -204,7 +204,7 @@ fun ReaderExpandBottomMenu(
fun ReaderSheet(
readerModes: List<String>,
selectedMode: String,
onSetReaderMode: (String) -> Unit,
onSetReaderMode: (String) -> Unit
) {
Column(Modifier.fillMaxWidth()) {
ReaderModeSetting(readerModes, selectedMode, onSetReaderMode)
@@ -282,7 +282,7 @@ private fun ReaderProgressSlider(
@Composable
private fun NavigateChapters(loadPrevChapter: () -> Unit, loadNextChapter: () -> Unit) {
Divider(Modifier.padding(horizontal = 4.dp, vertical = 8.dp))
Row(horizontalArrangement = Arrangement.SpaceBetween,) {
Row(horizontalArrangement = Arrangement.SpaceBetween) {
OutlinedButton(loadPrevChapter, Modifier.weight(0.5F)) {
Row(verticalAlignment = Alignment.CenterVertically) {
val nextChapter = stringResource(MR.strings.nav_prev_chapter)

View File

@@ -51,4 +51,4 @@ sealed class PagesState {
object Loading : PagesState()
data class Success(val pages: List<ReaderPage>) : PagesState()
object Empty : PagesState()
}
}

View File

@@ -32,6 +32,6 @@ class EdgeNavigation : ViewerNavigation() {
Region(
rect = Rect(66, 0, 100, 100),
type = Navigation.NEXT
),
)
)
}

View File

@@ -26,7 +26,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
fun Modifier.navigationClickable(
navigation: ViewerNavigation,
onClick: (Navigation) -> Unit = {},
onClick: (Navigation) -> Unit = {}
) = composed(
inspectorInfo = debugInspectorInfo {
name = "navigationClickable"
@@ -37,7 +37,7 @@ fun Modifier.navigationClickable(
navigationClickable(
navigation = navigation,
interactionSource = remember { MutableInteractionSource() },
onClick = onClick,
onClick = onClick
)
}

View File

@@ -125,7 +125,7 @@ fun HandlePager(
nextChapter: ReaderChapter?,
loadingModifier: Modifier,
pageContentScale: ContentScale,
retry: (Int) -> Unit,
retry: (Int) -> Unit
) {
when (page) {
0 -> ChapterSeparator(previousChapter, currentChapter)

View File

@@ -342,7 +342,7 @@ private fun MissingSourcesDialog(
positiveButton(stringResource(MR.strings.action_ok), onClick = onPositiveClick)
negativeButton(stringResource(MR.strings.action_cancel), onClick = onNegativeClick)
},
properties = getMaterialDialogProperties(),
properties = getMaterialDialogProperties()
) {
title(stringResource(MR.strings.missing_sources))
Box {

View File

@@ -161,7 +161,7 @@ fun SettingsGeneralScreenContent(
ChoicePreference(
preference = language,
title = stringResource(MR.strings.language),
choices = languageChoices,
choices = languageChoices
)
}
item {

View File

@@ -21,7 +21,7 @@ import ca.gosyer.jui.uicore.resources.stringResource
@Composable
fun SourceMangaBadges(
inLibrary: Boolean,
modifier: Modifier = Modifier,
modifier: Modifier = Modifier
) {
if (!inLibrary) return

View File

@@ -47,7 +47,7 @@ fun SourceMangaComfortableGrid(
gridSize: Int,
onClickManga: (Long) -> Unit,
hasNextPage: Boolean = false,
onLoadNextPage: () -> Unit,
onLoadNextPage: () -> Unit
) {
Box {
val state = rememberLazyGridState()

View File

@@ -50,7 +50,7 @@ fun SourceMangaCompactGrid(
gridSize: Int,
onClickManga: (Long) -> Unit,
hasNextPage: Boolean = false,
onLoadNextPage: () -> Unit,
onLoadNextPage: () -> Unit
) {
Box {
val state = rememberLazyGridState()

View File

@@ -38,7 +38,7 @@ fun SourceMangaList(
mangas: List<Manga>,
onClickManga: (Long) -> Unit,
hasNextPage: Boolean = false,
onLoadNextPage: () -> Unit,
onLoadNextPage: () -> Unit
) {
Box {
val state = rememberLazyListState()
@@ -78,7 +78,7 @@ private fun MangaListItem(
MangaListItem(
modifier = modifier then Modifier
.requiredHeight(56.dp)
.padding(horizontal = 16.dp),
.padding(horizontal = 16.dp)
) {
MangaListItemImage(
modifier = Modifier
@@ -91,7 +91,7 @@ private fun MangaListItem(
modifier = Modifier
.weight(1f)
.padding(horizontal = 16.dp),
text = manga.title,
text = manga.title
)
SourceMangaBadges(inLibrary)
}

View File

@@ -202,7 +202,7 @@ private fun SourceWideScreenContent(
onToggleFiltersClick = setShowingFilters,
onSelectDisplayMode = onSelectDisplayMode
)
},
}
) { padding ->
Box(Modifier.padding(padding)) {
MangaTable(
@@ -213,7 +213,7 @@ private fun SourceWideScreenContent(
isLoading = loading,
hasNextPage = hasNextPage,
onLoadNextPage = loadNextPage,
onMangaClick = onMangaClick,
onMangaClick = onMangaClick
)
if (showingFilters && !isLatest) {
Box(
@@ -337,7 +337,7 @@ private fun SourceThinScreenContent(
isLoading = loading,
hasNextPage = hasNextPage,
onLoadNextPage = loadNextPage,
onMangaClick = onMangaClick,
onMangaClick = onMangaClick
)
if (showingFilters && !isLatest) {
Box(
@@ -387,7 +387,7 @@ fun SourceToolbar(
showingFilters: Boolean,
onClickMode: (Boolean) -> Unit,
onToggleFiltersClick: (Boolean) -> Unit,
onSelectDisplayMode: (DisplayMode) -> Unit,
onSelectDisplayMode: (DisplayMode) -> Unit
) {
Toolbar(
source.name,
@@ -458,7 +458,7 @@ private fun MangaTable(
isLoading: Boolean = false,
hasNextPage: Boolean = false,
onLoadNextPage: () -> Unit,
onMangaClick: (Long) -> Unit,
onMangaClick: (Long) -> Unit
) {
if (isLoading || mangas.isEmpty()) {
LoadingScreen(isLoading)
@@ -540,6 +540,6 @@ private fun getActionItems(
icon = Icons.Rounded.Settings,
doAction = onSourceSettingsClick
)
} else null,
} else null
)
}

View File

@@ -154,7 +154,7 @@ fun SourceFilterAction(
text = name,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
style = MaterialTheme.typography.subtitle1,
style = MaterialTheme.typography.subtitle1
)
}
}
@@ -196,7 +196,7 @@ fun HeaderView(header: SourceFiltersView.Header) {
fontWeight = FontWeight.Bold,
color = LocalContentColor.current.copy(alpha = ContentAlpha.disabled),
maxLines = 1,
style = MaterialTheme.typography.subtitle1,
style = MaterialTheme.typography.subtitle1
)
}
}

View File

@@ -32,7 +32,7 @@ class SourceFiltersViewModel(
@Inject constructor(
sourceHandler: SourceRepositoryImpl,
contextWrapper: ContextWrapper,
params: Params,
params: Params
) : this(
params.sourceId,
sourceHandler,

View File

@@ -145,7 +145,7 @@ sealed class SourceFiltersView<T, R : Any?> {
data class Group internal constructor(
override val index: Int,
override val name: String,
override val filter: GroupFilter.GroupProps,
override val filter: GroupFilter.GroupProps
) : SourceFiltersView<GroupFilter.GroupProps, List<SourceFiltersView<*, *>>>() {
override val state: StateFlow<List<SourceFiltersView<*, *>>> = MutableStateFlow(
filter.state.mapIndexed { itemIndex, sourceFilter ->

View File

@@ -55,7 +55,7 @@ fun SourcesMenu() {
BoxWithConstraints {
if (maxWidth > 720.dp) {
SourcesNavigator(
homeScreen,
homeScreen
) { navigator ->
Row {
SourcesSideMenu(

View File

@@ -193,7 +193,7 @@ private fun EditTextPreference(editText: EditText) {
positiveButton(stringResource(MR.strings.action_ok))
negativeButton(stringResource(MR.strings.action_cancel))
},
properties = getMaterialDialogProperties(),
properties = getMaterialDialogProperties()
) {
title(editText.dialogTitle ?: BuildKonfig.NAME)
if (editText.dialogMessage != null) {

View File

@@ -159,7 +159,7 @@ fun UpdatesItem(
chapterDownloadItem,
onClickDownload,
onClickStopDownload,
onClickDeleteDownload,
onClickDeleteDownload
)
}
}

View File

@@ -43,7 +43,7 @@ actual class FileSaver(
actual fun rememberFileSaver(
onFileSelected: (Sink) -> Unit,
onCancel: () -> Unit,
onError: () -> Unit,
onError: () -> Unit
): FileSaver {
val coroutineScope = rememberCoroutineScope()
return remember { FileSaver(onFileSelected, onCancel, onError, coroutineScope) }

View File

@@ -30,6 +30,6 @@ private fun getContextItems(
onClickRemoveManga: () -> Unit
): List<ContextMenuItem> {
return listOf(
ContextMenuItem(stringResource(MR.strings.action_remove_favorite)) { onClickRemoveManga() },
ContextMenuItem(stringResource(MR.strings.action_remove_favorite)) { onClickRemoveManga() }
)
}

View File

@@ -43,7 +43,7 @@ actual fun InternalAboutLibraries(
showLicenseBadges: Boolean,
colors: LibraryColors,
itemContentPadding: PaddingValues,
onLibraryClick: ((Library) -> Unit)?,
onLibraryClick: ((Library) -> Unit)?
) {
Libraries(
libraries = libraries,

View File

@@ -66,7 +66,7 @@ actual fun getServerHostItems(viewModel: @Composable () -> SettingsServerHostVie
openInBrowserEnabled = serverVm.openInBrowserEnabled,
basicAuthEnabled = serverVm.basicAuthEnabled,
basicAuthUsername = serverVm.basicAuthUsername,
basicAuthPassword = serverVm.basicAuthPassword,
basicAuthPassword = serverVm.basicAuthPassword
)
}
}
@@ -149,7 +149,7 @@ fun LazyListScope.ServerHostItems(
openInBrowserEnabled: PreferenceMutableStateFlow<Boolean>,
basicAuthEnabled: PreferenceMutableStateFlow<Boolean>,
basicAuthUsername: PreferenceMutableStateFlow<String>,
basicAuthPassword: PreferenceMutableStateFlow<String>,
basicAuthPassword: PreferenceMutableStateFlow<String>
) {
item {
SwitchPreference(preference = host, title = stringResource(MR.strings.host_server))

View File

@@ -77,7 +77,7 @@ private fun fileChooser(
onError: () -> Unit = {},
onApprove: (Path) -> Unit,
defaultFileName: String = "",
vararg extensions: String,
vararg extensions: String
) = launchUI {
val fileChooser = JFileChooser()
.apply {

View File

@@ -114,7 +114,7 @@ actual fun rememberScrollbarAdapter(
@Composable
actual fun rememberScrollbarAdapter(
scrollState: LazyListState,
scrollState: LazyListState
): ScrollbarAdapter {
return remember(scrollState) {
LazyListStateScrollbarAdapter(scrollState)
@@ -124,7 +124,7 @@ actual fun rememberScrollbarAdapter(
@Composable
actual fun rememberScrollbarAdapter(
scrollState: LazyGridState,
gridCells: GridCells,
gridCells: GridCells
): ScrollbarAdapter {
return remember(scrollState, gridCells) {
LazyGridStateScrollbarAdapter(scrollState, gridCells)
@@ -171,7 +171,9 @@ private fun Modifier.drawScrollbar(
orientation: Orientation,
reverseScrolling: Boolean
): Modifier = drawScrollbar(
orientation, reverseScrolling, snapshotFlow { state.isScrollInProgress }
orientation,
reverseScrolling,
snapshotFlow { state.isScrollInProgress }
) { reverseDirection, atEnd, thickness, color, alpha ->
val layoutInfo = state.layoutInfo
val viewportSize = layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset
@@ -210,7 +212,9 @@ private fun Modifier.drawScrollbar(
orientation: Orientation,
reverseScrolling: Boolean
): Modifier = drawScrollbar(
orientation, reverseScrolling, snapshotFlow { state.isScrollInProgress }
orientation,
reverseScrolling,
snapshotFlow { state.isScrollInProgress }
) { reverseDirection, atEnd, thickness, color, alpha ->
val layoutInfo = state.layoutInfo
val viewportSize = layoutInfo.viewportEndOffset - layoutInfo.viewportStartOffset
@@ -328,5 +332,5 @@ private fun Modifier.drawScrollbar(
private val Thickness = 4.dp
private val FadeOutAnimationSpec =
tween<Float>(
durationMillis = ViewConfiguration.getScrollBarFadeDuration(),
durationMillis = ViewConfiguration.getScrollBarFadeDuration()
)

View File

@@ -19,7 +19,7 @@ import androidx.compose.ui.platform.LocalFocusManager
fun Modifier.keyboardHandler(
singleLine: Boolean = false,
enterAction: ((FocusManager) -> Unit)? = null,
action: (FocusManager) -> Unit = { it.moveFocus(FocusDirection.Down) },
action: (FocusManager) -> Unit = { it.moveFocus(FocusDirection.Down) }
) = composed {
val focusManager = LocalFocusManager.current
Modifier.onPreviewKeyEvent {

View File

@@ -37,7 +37,7 @@ import io.kamel.core.Resource
fun MangaGridItem(
title: String,
cover: Resource<Painter>,
onClick: () -> Unit = {},
onClick: () -> Unit = {}
) {
val fontStyle = LocalTextStyle.current.merge(
TextStyle(letterSpacing = 0.sp, fontFamily = FontFamily.SansSerif, fontSize = 14.sp)
@@ -63,7 +63,7 @@ fun MangaGridItem(
overflow = TextOverflow.Ellipsis,
modifier = Modifier.wrapContentHeight(Alignment.CenterVertically)
.align(Alignment.BottomStart)
.padding(8.dp),
.padding(8.dp)
)
}
}

View File

@@ -28,7 +28,7 @@ internal expect fun RealVerticalScrollbar(
modifier: Modifier,
reverseLayout: Boolean,
style: ScrollbarStyle,
interactionSource: MutableInteractionSource,
interactionSource: MutableInteractionSource
)
@Composable
@@ -37,7 +37,7 @@ internal expect fun RealHorizontalScrollbar(
modifier: Modifier,
reverseLayout: Boolean,
style: ScrollbarStyle,
interactionSource: MutableInteractionSource,
interactionSource: MutableInteractionSource
)
@Composable
@@ -65,13 +65,13 @@ expect fun rememberScrollbarAdapter(
@Composable
expect fun rememberScrollbarAdapter(
scrollState: LazyListState,
scrollState: LazyListState
): ScrollbarAdapter
@Composable
expect fun rememberScrollbarAdapter(
scrollState: LazyGridState,
gridCells: GridCells,
gridCells: GridCells
): ScrollbarAdapter
expect fun Modifier.scrollbarPadding(): Modifier

View File

@@ -47,5 +47,5 @@ val themes = listOf(
onPrimary = Color.White,
background = Color.Black
)
),
)
)

View File

@@ -39,7 +39,11 @@ internal actual fun RealVerticalScrollbar(
style: ScrollbarStyle,
interactionSource: MutableInteractionSource
) = androidx.compose.foundation.VerticalScrollbar(
adapter, modifier, reverseLayout, style, interactionSource
adapter,
modifier,
reverseLayout,
style,
interactionSource
)
@Composable
@@ -50,7 +54,11 @@ internal actual fun RealHorizontalScrollbar(
style: ScrollbarStyle,
interactionSource: MutableInteractionSource
) = androidx.compose.foundation.HorizontalScrollbar(
adapter, modifier, reverseLayout, style, interactionSource
adapter,
modifier,
reverseLayout,
style,
interactionSource
)
@Composable
@@ -62,7 +70,7 @@ actual fun rememberScrollbarAdapter(
@Composable
actual fun rememberScrollbarAdapter(
scrollState: LazyListState,
scrollState: LazyListState
): ScrollbarAdapter {
return androidx.compose.foundation.rememberScrollbarAdapter(scrollState)
}
@@ -70,7 +78,7 @@ actual fun rememberScrollbarAdapter(
@Composable
actual fun rememberScrollbarAdapter(
scrollState: LazyGridState,
gridCells: GridCells,
gridCells: GridCells
): ScrollbarAdapter {
val density = LocalDensity.current
return remember(scrollState, gridCells, density) { GridScrollbarAdapter(scrollState, gridCells, density) }
@@ -80,12 +88,11 @@ actual fun rememberScrollbarAdapter(
class GridScrollbarAdapter(
private val scrollState: LazyGridState,
private val gridCells: GridCells,
private val density: Density,
private val density: Density
) : ScrollbarAdapter {
override val scrollOffset: Float
get() = (scrollState.firstVisibleItemIndex / itemsPerRow).coerceAtLeast(0) * averageItemSize + scrollState.firstVisibleItemScrollOffset
override fun maxScrollOffset(containerSize: Int): Float {
val size = with(gridCells) {
density.calculateCrossAxisCellSizes(containerSize, 0).size
@@ -93,7 +100,6 @@ class GridScrollbarAdapter(
return (averageItemSize * (itemCount / size) - containerSize).coerceAtLeast(0f)
}
override suspend fun scrollTo(containerSize: Int, scrollOffset: Float) {
val distance = scrollOffset - this@GridScrollbarAdapter.scrollOffset