mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix indents of last commits
This commit is contained in:
parent
bf746dd7fb
commit
b69d856642
2 changed files with 22 additions and 21 deletions
|
@ -14,8 +14,6 @@ import eu.kanade.tachiyomi.util.system.toast
|
||||||
import eu.kanade.tachiyomi.util.system.withIOContext
|
import eu.kanade.tachiyomi.util.system.withIOContext
|
||||||
import eu.kanade.tachiyomi.util.system.withUIContext
|
import eu.kanade.tachiyomi.util.system.withUIContext
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
|
@ -97,24 +95,24 @@ class CoverCache(val context: Context) {
|
||||||
* Clear out all online covers
|
* Clear out all online covers
|
||||||
*/
|
*/
|
||||||
suspend fun deleteAllCachedCovers() {
|
suspend fun deleteAllCachedCovers() {
|
||||||
val directory = onlineCoverDirectory
|
val directory = onlineCoverDirectory
|
||||||
var deletedSize = 0L
|
var deletedSize = 0L
|
||||||
val files =
|
val files =
|
||||||
directory.listFiles()?.sortedBy { it.lastModified() }?.iterator() ?: return
|
directory.listFiles()?.sortedBy { it.lastModified() }?.iterator() ?: return
|
||||||
while (files.hasNext()) {
|
while (files.hasNext()) {
|
||||||
val file = files.next()
|
val file = files.next()
|
||||||
deletedSize += file.length()
|
deletedSize += file.length()
|
||||||
file.delete()
|
file.delete()
|
||||||
}
|
}
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
context.toast(
|
context.toast(
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.deleted_,
|
R.string.deleted_,
|
||||||
Formatter.formatFileSize(context, deletedSize)
|
Formatter.formatFileSize(context, deletedSize)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
context.imageLoader.memoryCache.clear()
|
}
|
||||||
|
context.imageLoader.memoryCache.clear()
|
||||||
|
|
||||||
lastClean = System.currentTimeMillis()
|
lastClean = System.currentTimeMillis()
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,8 +201,11 @@ class DownloadService : Service() {
|
||||||
private fun onNetworkStateChanged() {
|
private fun onNetworkStateChanged() {
|
||||||
val manager = connectivityManager
|
val manager = connectivityManager
|
||||||
val networkCapabilities = manager.getNetworkCapabilities(manager.activeNetwork)
|
val networkCapabilities = manager.getNetworkCapabilities(manager.activeNetwork)
|
||||||
if (networkCapabilities == null || !(networkCapabilities.hasCapability(NET_CAPABILITY_INTERNET) &&
|
if (networkCapabilities == null || !(
|
||||||
networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED))) {
|
networkCapabilities.hasCapability(NET_CAPABILITY_INTERNET) &&
|
||||||
|
networkCapabilities.hasCapability(NET_CAPABILITY_VALIDATED)
|
||||||
|
)
|
||||||
|
) {
|
||||||
downloadManager.stopDownloads(getString(R.string.no_network_connection))
|
downloadManager.stopDownloads(getString(R.string.no_network_connection))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue