pass context instead of whole activity to scanFile

This commit is contained in:
tibbi 2016-10-16 19:19:40 +02:00
parent 34158c217c
commit d643cc2822
3 changed files with 4 additions and 4 deletions

View file

@ -356,7 +356,7 @@ public class MainActivity extends SimpleActivity
} }
final String[] deletedPaths = updatedFiles.toArray(new String[updatedFiles.size()]); final String[] deletedPaths = updatedFiles.toArray(new String[updatedFiles.size()]);
MediaScannerConnection.scanFile(this, deletedPaths, null, null); MediaScannerConnection.scanFile(getApplicationContext(), deletedPaths, null, null);
mToBeDeleted.clear(); mToBeDeleted.clear();
} }

View file

@ -339,7 +339,7 @@ public class MediaActivity extends SimpleActivity
} }
final String[] deletedPaths = mToBeDeleted.toArray(new String[mToBeDeleted.size()]); 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 @Override
public void onScanCompleted(String path, Uri uri) { public void onScanCompleted(String path, Uri uri) {
if (mMedia != null && mMedia.isEmpty()) { if (mMedia != null && mMedia.isEmpty()) {

View file

@ -100,7 +100,7 @@ public class ViewPagerActivity extends SimpleActivity
mBeingDeleted = ""; mBeingDeleted = "";
hideSystemUI(); hideSystemUI();
MediaScannerConnection.scanFile(this, new String[]{mPath}, null, null); MediaScannerConnection.scanFile(getApplicationContext(), new String[]{mPath}, null, null);
addUndoMargin(); addUndoMargin();
mDirectory = new File(mPath).getParent(); mDirectory = new File(mPath).getParent();
mMedia = getMedia(); mMedia = getMedia();
@ -256,7 +256,7 @@ public class ViewPagerActivity extends SimpleActivity
if (file.delete()) { if (file.delete()) {
mBeingDeleted = mToBeDeleted; mBeingDeleted = mToBeDeleted;
final String[] deletedPath = new String[]{mToBeDeleted}; final String[] deletedPath = new String[]{mToBeDeleted};
MediaScannerConnection.scanFile(this, deletedPath, null, new MediaScannerConnection.OnScanCompletedListener() { MediaScannerConnection.scanFile(getApplicationContext(), deletedPath, null, new MediaScannerConnection.OnScanCompletedListener() {
@Override @Override
public void onScanCompleted(String path, Uri uri) { public void onScanCompleted(String path, Uri uri) {
scanCompleted(); scanCompleted();