From 4f582b1bc2e09a791a0b0d8ac51bd815a51c4543 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 12 Nov 2016 16:38:25 +0100 Subject: [PATCH] use the extension function for scanning files --- app/src/main/java/com/simplemobiletools/filemanager/Utils.kt | 4 ++++ .../filemanager/fragments/ItemsFragment.java | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/filemanager/Utils.kt b/app/src/main/java/com/simplemobiletools/filemanager/Utils.kt index c9a8cc1e..bc332d7d 100644 --- a/app/src/main/java/com/simplemobiletools/filemanager/Utils.kt +++ b/app/src/main/java/com/simplemobiletools/filemanager/Utils.kt @@ -3,7 +3,9 @@ package com.simplemobiletools.filemanager import android.content.Context import com.simplemobiletools.filepicker.extensions.getFileDocument import com.simplemobiletools.filepicker.extensions.needsStupidWritePermissions +import com.simplemobiletools.filepicker.extensions.scanFile import com.simplemobiletools.filepicker.extensions.toast +import java.io.File class Utils { companion object { @@ -16,5 +18,7 @@ class Utils { fun needsStupidWritePermissions(context: Context, path: String) = context.needsStupidWritePermissions(path) fun getFileDocument(context: Context, path: String, treeUri: String) = context.getFileDocument(path, treeUri) + + fun scanFile(context: Context, file: File) = context.scanFile(file) {} } } diff --git a/app/src/main/java/com/simplemobiletools/filemanager/fragments/ItemsFragment.java b/app/src/main/java/com/simplemobiletools/filemanager/fragments/ItemsFragment.java index 19f2f8e1..5ea8dabd 100644 --- a/app/src/main/java/com/simplemobiletools/filemanager/fragments/ItemsFragment.java +++ b/app/src/main/java/com/simplemobiletools/filemanager/fragments/ItemsFragment.java @@ -4,7 +4,6 @@ import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.res.Resources; import android.graphics.Color; -import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Bundle; import android.os.Parcelable; @@ -467,7 +466,7 @@ public class ItemsFragment extends android.support.v4.app.Fragment } else { item.delete(); } - MediaScannerConnection.scanFile(getContext(), new String[]{item.getAbsolutePath()}, null, null); + Utils.Companion.scanFile(getContext(), item); } private View.OnClickListener undoDeletion = new View.OnClickListener() {