Minor cleanup

This commit is contained in:
arkon
2021-01-24 11:04:25 -05:00
parent e4dc35674d
commit a93c0577ac
5 changed files with 20 additions and 81 deletions
@@ -33,6 +33,7 @@ import androidx.core.net.toUri
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.lang.truncateCenter
import java.io.File
import kotlin.math.roundToInt
/**
@@ -244,3 +245,12 @@ fun Context.openInBrowser(uri: Uri, @ColorInt toolbarColor: Int? = null) {
toast(e.message)
}
}
fun Context.createFileInCacheDir(name: String): File {
val file = File(externalCacheDir, name)
if (file.exists()) {
file.delete()
}
file.createNewFile()
return file
}