From d643cc28229085673d6b3f04259b19589fb7e98f Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 16 Oct 2016 19:19:40 +0200 Subject: [PATCH] pass context instead of whole activity to scanFile --- .../simplemobiletools/gallery/activities/MainActivity.java | 2 +- .../simplemobiletools/gallery/activities/MediaActivity.java | 2 +- .../gallery/activities/ViewPagerActivity.java | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java index 7183ffb11..0c7a8e634 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -356,7 +356,7 @@ public class MainActivity extends SimpleActivity } final String[] deletedPaths = updatedFiles.toArray(new String[updatedFiles.size()]); - MediaScannerConnection.scanFile(this, deletedPaths, null, null); + MediaScannerConnection.scanFile(getApplicationContext(), deletedPaths, null, null); mToBeDeleted.clear(); } diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java index 38fa0bb6c..1e44f19af 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java @@ -339,7 +339,7 @@ public class MediaActivity extends SimpleActivity } final String[] deletedPaths = mToBeDeleted.toArray(new String[mToBeDeleted.size()]); - MediaScannerConnection.scanFile(this, deletedPaths, null, new MediaScannerConnection.OnScanCompletedListener() { + MediaScannerConnection.scanFile(getApplicationContext(), deletedPaths, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { if (mMedia != null && mMedia.isEmpty()) { diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java index 01571c709..80e5ae5b8 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -100,7 +100,7 @@ public class ViewPagerActivity extends SimpleActivity mBeingDeleted = ""; hideSystemUI(); - MediaScannerConnection.scanFile(this, new String[]{mPath}, null, null); + MediaScannerConnection.scanFile(getApplicationContext(), new String[]{mPath}, null, null); addUndoMargin(); mDirectory = new File(mPath).getParent(); mMedia = getMedia(); @@ -256,7 +256,7 @@ public class ViewPagerActivity extends SimpleActivity if (file.delete()) { mBeingDeleted = mToBeDeleted; final String[] deletedPath = new String[]{mToBeDeleted}; - MediaScannerConnection.scanFile(this, deletedPath, null, new MediaScannerConnection.OnScanCompletedListener() { + MediaScannerConnection.scanFile(getApplicationContext(), deletedPath, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { scanCompleted();