mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-29 16:08:00 +01:00
rescan directories too recursively
This commit is contained in:
parent
3a515e5844
commit
9a75c3ae8c
1 changed files with 14 additions and 11 deletions
|
@ -28,11 +28,11 @@ import android.widget.GridView;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.bumptech.glide.request.animation.GlideAnimation;
|
import com.bumptech.glide.request.animation.GlideAnimation;
|
||||||
import com.bumptech.glide.request.target.SimpleTarget;
|
import com.bumptech.glide.request.target.SimpleTarget;
|
||||||
import com.simplemobiletools.gallery.dialogs.ChangeSorting;
|
|
||||||
import com.simplemobiletools.gallery.Constants;
|
import com.simplemobiletools.gallery.Constants;
|
||||||
import com.simplemobiletools.gallery.R;
|
import com.simplemobiletools.gallery.R;
|
||||||
import com.simplemobiletools.gallery.Utils;
|
import com.simplemobiletools.gallery.Utils;
|
||||||
import com.simplemobiletools.gallery.adapters.MediaAdapter;
|
import com.simplemobiletools.gallery.adapters.MediaAdapter;
|
||||||
|
import com.simplemobiletools.gallery.dialogs.ChangeSorting;
|
||||||
import com.simplemobiletools.gallery.models.Medium;
|
import com.simplemobiletools.gallery.models.Medium;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -144,18 +144,18 @@ public class MediaActivity extends SimpleActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rescanDirectory() {
|
private void rescanDirectory(File dir) {
|
||||||
final File file = new File(mPath);
|
final File[] files = dir.listFiles();
|
||||||
if (file.isDirectory()) {
|
|
||||||
final File[] files = file.listFiles();
|
|
||||||
final String[] paths = new String[files.length];
|
final String[] paths = new String[files.length];
|
||||||
final int cnt = file.listFiles().length;
|
final int cnt = dir.listFiles().length;
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
paths[i] = files[i].getPath();
|
paths[i] = files[i].getPath();
|
||||||
|
if (files[i].isDirectory()) {
|
||||||
|
rescanDirectory(files[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MediaScannerConnection.scanFile(getApplicationContext(), paths, null, null);
|
MediaScannerConnection.scanFile(getApplicationContext(), paths, null, null);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void showSortingDialog() {
|
private void showSortingDialog() {
|
||||||
new ChangeSorting(this, false);
|
new ChangeSorting(this, false);
|
||||||
|
@ -442,7 +442,10 @@ public class MediaActivity extends SimpleActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
rescanDirectory();
|
final File dir = new File(mPath);
|
||||||
|
if (dir.isDirectory()) {
|
||||||
|
rescanDirectory(dir);
|
||||||
|
}
|
||||||
initializeGallery();
|
initializeGallery();
|
||||||
mSwipeRefreshLayout.setRefreshing(false);
|
mSwipeRefreshLayout.setRefreshing(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue