mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 06:28: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,17 +144,17 @@ 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 String[] paths = new String[files.length];
|
||||||
final File[] files = file.listFiles();
|
final int cnt = dir.listFiles().length;
|
||||||
final String[] paths = new String[files.length];
|
for (int i = 0; i < cnt; i++) {
|
||||||
final int cnt = file.listFiles().length;
|
paths[i] = files[i].getPath();
|
||||||
for (int i = 0; i < cnt; i++) {
|
if (files[i].isDirectory()) {
|
||||||
paths[i] = files[i].getPath();
|
rescanDirectory(files[i]);
|
||||||
}
|
}
|
||||||
MediaScannerConnection.scanFile(getApplicationContext(), paths, null, null);
|
|
||||||
}
|
}
|
||||||
|
MediaScannerConnection.scanFile(getApplicationContext(), paths, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showSortingDialog() {
|
private void showSortingDialog() {
|
||||||
|
@ -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