use the extension function for scanning files
This commit is contained in:
parent
624fa69e80
commit
4f582b1bc2
2 changed files with 5 additions and 2 deletions
|
@ -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) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue