Remove usage of .not() where possible

(cherry picked from commit 39407407f282dbb7fa972b12053c26b3e3bd66d8)
This commit is contained in:
AntsyLich 2024-01-21 18:56:17 +06:00 committed by Jobobby04
parent 3f74a6d33f
commit 7cdfa68d77
14 changed files with 20 additions and 20 deletions

View File

@ -171,7 +171,7 @@ class SyncChaptersWithSource(
var updatedToAdd = newChapters.map { toAddItem ->
var chapter = toAddItem.copy(dateFetch = nowMillis + itemCount--)
if (chapter.isRecognizedNumber.not() || chapter.chapterNumber !in deletedChapterNumbers) return@map chapter
if (!chapter.isRecognizedNumber || chapter.chapterNumber !in deletedChapterNumbers) return@map chapter
chapter = chapter.copy(
read = chapter.chapterNumber in deletedReadChapterNumbers,

View File

@ -23,7 +23,7 @@ class GetExtensionSources(
ExtensionSourceItem(
source = source,
enabled = source.isEnabled(),
labelAsName = isMultiSource && isMultiLangSingleSource.not(),
labelAsName = isMultiSource && !isMultiLangSingleSource,
)
}
}

View File

@ -22,10 +22,10 @@ class GetExtensionsByType(
extensionManager.availableExtensionsFlow,
) { _activeLanguages, _installed, _untrusted, _available ->
val (updates, installed) = _installed
.filter { (showNsfwSources || it.isNsfw.not()) }
.filter { (showNsfwSources || !it.isNsfw) }
.sortedWith(
compareBy<Extension.Installed> {
it.isObsolete.not() /* SY --> */ && it.isRedundant.not() /* SY <-- */
!it.isObsolete /* SY --> */ && !it.isRedundant /* SY <-- */
}.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
)
.partition { it.hasUpdate }
@ -37,7 +37,7 @@ class GetExtensionsByType(
.filter { extension ->
_installed.none { it.pkgName == extension.pkgName } &&
_untrusted.none { it.pkgName == extension.pkgName } &&
(showNsfwSources || extension.isNsfw.not())
(showNsfwSources || !extension.isNsfw)
}
.flatMap { ext ->
if (ext.sources.isEmpty()) {

View File

@ -34,15 +34,15 @@ class GetSourcesWithFavoriteCount(
when (sorting) {
SetMigrateSorting.Mode.ALPHABETICAL -> {
when {
a.first.isStub && b.first.isStub.not() -> -1
b.first.isStub && a.first.isStub.not() -> 1
a.first.isStub && !b.first.isStub -> -1
b.first.isStub && !a.first.isStub -> 1
else -> a.first.name.lowercase().compareToWithCollator(b.first.name.lowercase())
}
}
SetMigrateSorting.Mode.TOTAL -> {
when {
a.first.isStub && b.first.isStub.not() -> -1
b.first.isStub && a.first.isStub.not() -> 1
a.first.isStub && !b.first.isStub -> -1
b.first.isStub && !a.first.isStub -> 1
else -> a.second.compareTo(b.second)
}
}

View File

@ -29,7 +29,7 @@ fun Track.toDbTrack(): DbTrack = DbTrack.create(trackerId).also {
}
fun DbTrack.toDomainTrack(idRequired: Boolean = true): Track? {
val trackId = id ?: if (idRequired.not()) -1 else return null
val trackId = id ?: if (!idRequired) -1 else return null
return Track(
id = trackId,
mangaId = manga_id,

View File

@ -381,13 +381,13 @@ class DownloadManager(
val capitalizationChanged = oldFolder.name.equals(newName, ignoreCase = true)
if (capitalizationChanged) {
val tempName = newName + Downloader.TMP_DIR_SUFFIX
if (oldFolder.renameTo(tempName).not()) {
if (!oldFolder.renameTo(tempName)) {
logcat(LogPriority.ERROR) { "Failed to rename source download folder: ${oldFolder.name}" }
return
}
}
if (oldFolder.renameTo(newName).not()) {
if (!oldFolder.renameTo(newName)) {
logcat(LogPriority.ERROR) { "Failed to rename source download folder: ${oldFolder.name}" }
}
}

View File

@ -154,7 +154,7 @@ class DownloadProvider(
val newChapterName = sanitizeChapterName(chapterName)
return DiskUtil.buildValidFilename(
when {
chapterScanlator.isNullOrBlank().not() -> "${chapterScanlator}_$newChapterName"
!chapterScanlator.isNullOrBlank() -> "${chapterScanlator}_$newChapterName"
else -> newChapterName
},
)

View File

@ -185,7 +185,7 @@ class Anilist(id: Long) : BaseTracker(id, "AniList"), DeletableTracker {
if (track.status != COMPLETED) {
val isRereading = track.status == REREADING
track.status = if (isRereading.not() && hasReadChapters) READING else track.status
track.status = if (!isRereading && hasReadChapters) READING else track.status
}
update(track)

View File

@ -104,7 +104,7 @@ class MyAnimeList(id: Long) : BaseTracker(id, "MyAnimeList"), DeletableTracker {
if (track.status != COMPLETED) {
val isRereading = track.status == REREADING
track.status = if (isRereading.not() && hasReadChapters) READING else track.status
track.status = if (!isRereading && hasReadChapters) READING else track.status
}
update(track)

View File

@ -72,7 +72,7 @@ class Shikimori(id: Long) : BaseTracker(id, "Shikimori"), DeletableTracker {
if (track.status != COMPLETED) {
val isRereading = track.status == REREADING
track.status = if (isRereading.not() && hasReadChapters) READING else track.status
track.status = if (!isRereading && hasReadChapters) READING else track.status
}
update(track)

View File

@ -87,7 +87,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : Viewer {
// SY -->
if (pager.isRestoring) return
// SY <--
if (activity.isScrollingThroughPages.not()) {
if (!activity.isScrollingThroughPages) {
activity.hideMenu()
}
onPageChange(position)

View File

@ -89,7 +89,7 @@ internal class RateLimitInterceptor(
while (requestQueue.size >= permits) { // queue is full, remove expired entries
val periodStart = SystemClock.elapsedRealtime() - rateLimitMillis
var hasRemovedExpired = false
while (requestQueue.isEmpty().not() && requestQueue.first <= periodStart) {
while (!requestQueue.isEmpty() && requestQueue.first <= periodStart) {
requestQueue.removeFirst()
hasRemovedExpired = true
}

View File

@ -20,7 +20,7 @@ class GetApplicationRelease(
val now = Instant.now()
// Limit checks to once every 3 days at most
if (arguments.forceCheck.not() && now.isBefore(
if (!arguments.forceCheck && now.isBefore(
Instant.ofEpochMilli(lastChecked.get()).plus(3, ChronoUnit.DAYS),
)
) {

View File

@ -22,7 +22,7 @@ class StubSource(
throw SourceNotInstalledException()
override fun toString(): String =
if (isInvalid.not()) "$name (${lang.uppercase()})" else id.toString()
if (!isInvalid) "$name (${lang.uppercase()})" else id.toString()
companion object {
fun from(source: Source): StubSource {