Remove usage of .not() where possible

This commit is contained in:
AntsyLich 2024-01-21 18:56:17 +06:00
parent a024218410
commit 39407407f2
No known key found for this signature in database
14 changed files with 20 additions and 20 deletions

View file

@ -163,7 +163,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,9 +22,9 @@ 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() }
compareBy<Extension.Installed> { !it.isObsolete }
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name },
)
.partition { it.hasUpdate }
@ -36,7 +36,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

@ -315,13 +315,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

@ -130,7 +130,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

@ -90,7 +90,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : Viewer {
pager.addOnPageChangeListener(
object : ViewPager.SimpleOnPageChangeListener() {
override fun onPageSelected(position: Int) {
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 {