mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-16 14:07:28 +01:00
Address some build warnings
This commit is contained in:
@@ -21,7 +21,7 @@ object DiskUtil {
|
||||
fun getDirectorySize(f: File): Long {
|
||||
var size: Long = 0
|
||||
if (f.isDirectory) {
|
||||
for (file in f.listFiles()) {
|
||||
for (file in f.listFiles().orEmpty()) {
|
||||
size += getDirectorySize(file)
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -14,7 +14,7 @@ import java.io.OutputStream
|
||||
fun BufferedSource.saveTo(file: File) {
|
||||
try {
|
||||
// Create parent dirs if needed
|
||||
file.parentFile.mkdirs()
|
||||
file.parentFile?.mkdirs()
|
||||
|
||||
// Copy to destination
|
||||
saveTo(file.outputStream())
|
||||
|
||||
@@ -4,12 +4,12 @@ import android.content.ClipData
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
|
||||
fun Uri.toShareIntent(): Intent {
|
||||
fun Uri.toShareIntent(type: String = "image/*"): Intent {
|
||||
val uri = this
|
||||
return Intent(Intent.ACTION_SEND).apply {
|
||||
putExtra(Intent.EXTRA_STREAM, uri)
|
||||
clipData = ClipData.newRawUri(null, uri)
|
||||
type = "image/*"
|
||||
setType(type)
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user