From 288ba628e6273cf205d519121945c85d650c5f24 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 3 Jun 2016 19:31:46 +0200 Subject: [PATCH] properly rename folders --- .../gallery/activities/MainActivity.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 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 073981085..7e228ac5a 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -288,6 +288,11 @@ public class MainActivity extends AppCompatActivity alertDialog.dismiss(); actionMode.finish(); + final File[] files = newDir.listFiles(); + for (File f : files) { + updatedFiles.add(f.getAbsolutePath()); + } + updatedFiles.add(newDir.getAbsolutePath()); final String[] changedFiles = updatedFiles.toArray(new String[updatedFiles.size()]); MediaScannerConnection.scanFile(getApplicationContext(), changedFiles, null, MainActivity.this); @@ -368,16 +373,6 @@ public class MainActivity extends AppCompatActivity public void onScanCompleted(final String path, final Uri uri) { final File dir = new File(path); if (dir.isDirectory()) { - final List updatedFiles = new ArrayList<>(); - - final File[] files = dir.listFiles(); - for (File f : files) { - updatedFiles.add(f.getAbsolutePath()); - } - - final String[] changedFiles = updatedFiles.toArray(new String[updatedFiles.size()]); - MediaScannerConnection.scanFile(getApplicationContext(), changedFiles, null, null); - dirs = new ArrayList<>(getDirectories().values()); runOnUiThread(new Runnable() {