random fixes
This commit is contained in:
parent
220935dd57
commit
3f7ab572a2
2 changed files with 20 additions and 2 deletions
|
|
@ -391,7 +391,7 @@ class HistoryFragment : Fragment(), HistoryAdapter.OnItemClickListener{
|
||||||
|
|
||||||
type!!.text = item.type.toString().uppercase()
|
type!!.text = item.type.toString().uppercase()
|
||||||
|
|
||||||
if (item.format.format_note == "?") formatNote!!.visibility = View.GONE
|
if (item.format.format_note == "?" || item.format.format_note == "") formatNote!!.visibility = View.GONE
|
||||||
else formatNote!!.text = item.format.format_note
|
else formatNote!!.text = item.format.format_note
|
||||||
|
|
||||||
val codecText =
|
val codecText =
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,19 @@ package com.deniscerri.ytdlnis.util
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.media.MediaScannerConnection
|
import android.media.MediaScannerConnection
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
import android.provider.DocumentsContract
|
import android.provider.DocumentsContract
|
||||||
|
import android.util.Log
|
||||||
import android.webkit.MimeTypeMap
|
import android.webkit.MimeTypeMap
|
||||||
import com.deniscerri.ytdlnis.R
|
import com.deniscerri.ytdlnis.R
|
||||||
import okhttp3.internal.closeQuietly
|
import okhttp3.internal.closeQuietly
|
||||||
|
import okio.Path.Companion.toPath
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
|
import java.nio.file.CopyOption
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.StandardCopyOption
|
||||||
import java.text.DecimalFormat
|
import java.text.DecimalFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.math.log10
|
import kotlin.math.log10
|
||||||
|
|
@ -61,7 +67,6 @@ class FileUtil() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun scanMedia(destDir: String, context: Context) : String {
|
private fun scanMedia(destDir: String, context: Context) : String {
|
||||||
val file : File
|
|
||||||
val path = File(formatPath(destDir))
|
val path = File(formatPath(destDir))
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -96,6 +101,19 @@ class FileUtil() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val destFile = File(formatPath(destDir) + "/${it.name}")
|
||||||
|
Log.e("aa", destFile.absolutePath)
|
||||||
|
if (destFile.absolutePath.contains("/storage/emulated/0/Download")
|
||||||
|
|| destFile.absolutePath.contains("/storage/emulated/0/Documents")
|
||||||
|
){
|
||||||
|
if (Build.VERSION.SDK_INT >= 26 ){
|
||||||
|
Files.move(it.toPath(), destFile.toPath(), StandardCopyOption.REPLACE_EXISTING)
|
||||||
|
}else{
|
||||||
|
it.renameTo(destFile)
|
||||||
|
}
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
|
||||||
val destUri = DocumentsContract.createDocument(
|
val destUri = DocumentsContract.createDocument(
|
||||||
context.contentResolver,
|
context.contentResolver,
|
||||||
dest,
|
dest,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue