mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 21:55:48 +03:00
Merge pull request #9597 from nextcloud/fix/too-many-thumbnails
Fix for too many thumbnails in autoupload settings
This commit is contained in:
commit
0d2fd93ea2
2 changed files with 10 additions and 5 deletions
|
@ -58,7 +58,7 @@ object ContentResolverHelper {
|
||||||
"Invalid sort direction"
|
"Invalid sort direction"
|
||||||
}
|
}
|
||||||
return when {
|
return when {
|
||||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O -> {
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> {
|
||||||
val queryArgs = getQueryArgsBundle(selection, sortColumn, sortDirection, limit)
|
val queryArgs = getQueryArgsBundle(selection, sortColumn, sortDirection, limit)
|
||||||
contentResolver.query(uri, projection, queryArgs, cancellationSignal)
|
contentResolver.query(uri, projection, queryArgs, cancellationSignal)
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ object ContentResolverHelper {
|
||||||
return sortOrderBuilder.toString()
|
return sortOrderBuilder.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.R)
|
||||||
private fun
|
private fun
|
||||||
getQueryArgsBundle(selection: String?, sortColumn: String?, sortDirection: String?, limit: Int?): Bundle {
|
getQueryArgsBundle(selection: String?, sortColumn: String?, sortDirection: String?, limit: Int?): Bundle {
|
||||||
return Bundle().apply {
|
return Bundle().apply {
|
||||||
|
|
|
@ -123,8 +123,8 @@ public final class MediaProvider {
|
||||||
|
|
||||||
if (cursorImages != null) {
|
if (cursorImages != null) {
|
||||||
String filePath;
|
String filePath;
|
||||||
|
int imageCount = 0;
|
||||||
while (cursorImages.moveToNext()) {
|
while (cursorImages.moveToNext() && imageCount < itemLimit) {
|
||||||
filePath = cursorImages.getString(cursorImages.getColumnIndexOrThrow(
|
filePath = cursorImages.getString(cursorImages.getColumnIndexOrThrow(
|
||||||
MediaStore.MediaColumns.DATA));
|
MediaStore.MediaColumns.DATA));
|
||||||
|
|
||||||
|
@ -133,6 +133,8 @@ public final class MediaProvider {
|
||||||
mediaFolder.filePaths.add(filePath);
|
mediaFolder.filePaths.add(filePath);
|
||||||
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf('/'));
|
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf('/'));
|
||||||
}
|
}
|
||||||
|
// ensure we don't go over the limit due to faulty android implementations
|
||||||
|
imageCount++;
|
||||||
}
|
}
|
||||||
cursorImages.close();
|
cursorImages.close();
|
||||||
|
|
||||||
|
@ -241,7 +243,8 @@ public final class MediaProvider {
|
||||||
|
|
||||||
if (cursorVideos != null) {
|
if (cursorVideos != null) {
|
||||||
String filePath;
|
String filePath;
|
||||||
while (cursorVideos.moveToNext()) {
|
int videoCount = 0;
|
||||||
|
while (cursorVideos.moveToNext() && videoCount < itemLimit) {
|
||||||
filePath = cursorVideos.getString(cursorVideos.getColumnIndexOrThrow(
|
filePath = cursorVideos.getString(cursorVideos.getColumnIndexOrThrow(
|
||||||
MediaStore.MediaColumns.DATA));
|
MediaStore.MediaColumns.DATA));
|
||||||
|
|
||||||
|
@ -249,6 +252,8 @@ public final class MediaProvider {
|
||||||
mediaFolder.filePaths.add(filePath);
|
mediaFolder.filePaths.add(filePath);
|
||||||
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf('/'));
|
mediaFolder.absolutePath = filePath.substring(0, filePath.lastIndexOf('/'));
|
||||||
}
|
}
|
||||||
|
// ensure we don't go over the limit due to faulty android implementations
|
||||||
|
videoCount++;
|
||||||
}
|
}
|
||||||
cursorVideos.close();
|
cursorVideos.close();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue