imported more settings
This commit is contained in:
parent
922ccdfb27
commit
c242fedfee
21 changed files with 90 additions and 52 deletions
|
@ -17,6 +17,8 @@ import ani.dantotsu.defaultHeaders
|
|||
import ani.dantotsu.loadData
|
||||
import ani.dantotsu.media.anime.Episode
|
||||
import ani.dantotsu.parsers.Book
|
||||
import ani.dantotsu.settings.saving.PrefName
|
||||
import ani.dantotsu.settings.saving.PrefWrapper
|
||||
import ani.dantotsu.toast
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -36,7 +38,7 @@ object Download {
|
|||
|
||||
private fun getDownloadDir(context: Context): File {
|
||||
val direct: File
|
||||
if (loadData<Boolean>("sd_dl") == true) {
|
||||
if (PrefWrapper.getVal(PrefName.SdDl, false)) {
|
||||
val arrayOfFiles = ContextCompat.getExternalFilesDirs(context, null)
|
||||
val parentDirectory = arrayOfFiles[1].toString()
|
||||
direct = File(parentDirectory)
|
||||
|
@ -92,7 +94,7 @@ object Download {
|
|||
if (!file.url.startsWith("http"))
|
||||
toast(context.getString(R.string.invalid_url))
|
||||
else
|
||||
when (loadData<Int>("settings_download_manager", context, false) ?: 0) {
|
||||
when (PrefWrapper.getVal(PrefName.DownloadManager, 0)) {
|
||||
1 -> oneDM(context, file, notif ?: fileName)
|
||||
2 -> adm(context, file, fileName, folder)
|
||||
else -> defaultDownload(context, file, fileName, folder, notif ?: fileName)
|
||||
|
@ -117,7 +119,7 @@ object Download {
|
|||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
|
||||
|
||||
val arrayOfFiles = ContextCompat.getExternalFilesDirs(context, null)
|
||||
if (loadData<Boolean>("sd_dl") == true && arrayOfFiles.size > 1 && arrayOfFiles[0] != null && arrayOfFiles[1] != null) {
|
||||
if (PrefWrapper.getVal(PrefName.SdDl, false) && arrayOfFiles.size > 1 && arrayOfFiles[0] != null && arrayOfFiles[1] != null) {
|
||||
val parentDirectory = arrayOfFiles[1].toString() + folder
|
||||
val direct = File(parentDirectory)
|
||||
if (!direct.exists()) direct.mkdirs()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue