mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +03:00
parent
73a18fbf6e
commit
f34fff62a8
3 changed files with 13 additions and 5 deletions
|
@ -152,7 +152,7 @@ class GalleryAdapter(
|
|||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun showAllGalleryItems(storageManager: FileDataStorageManager) {
|
||||
fun showAllGalleryItems() {
|
||||
val items = storageManager.allGalleryItems
|
||||
|
||||
files = items
|
||||
|
|
|
@ -43,6 +43,8 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
|
||||
public class GallerySearchTask extends AsyncTask<Void, Void, GallerySearchTask.Result> {
|
||||
|
||||
private final User user;
|
||||
|
@ -100,7 +102,11 @@ public class GallerySearchTask extends AsyncTask<Void, Void, GallerySearchTask.R
|
|||
boolean emptySearch = parseMedia(startDate, endDate, result.getData());
|
||||
long lastTimeStamp = findLastTimestamp(result.getData());
|
||||
|
||||
photoFragment.showAllGalleryItems();
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return new Result(result.isSuccess(), emptySearch, lastTimeStamp);
|
||||
} else {
|
||||
|
@ -117,7 +123,9 @@ public class GallerySearchTask extends AsyncTask<Void, Void, GallerySearchTask.R
|
|||
photoFragment.setLoading(false);
|
||||
photoFragment.searchCompleted(result.emptySearch, result.lastTimestamp);
|
||||
|
||||
if (!result.success) {
|
||||
if (result.success && photoFragment.getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
photoFragment.showAllGalleryItems();
|
||||
} else {
|
||||
photoFragment.setEmptyListMessage(SearchType.GALLERY_SEARCH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ public class GalleryFragment extends OCFileListFragment {
|
|||
setEmptyListLoadingMessage();
|
||||
|
||||
// always show first stored items
|
||||
mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager());
|
||||
mAdapter.showAllGalleryItems();
|
||||
|
||||
setFabVisible(false);
|
||||
|
||||
|
@ -272,6 +272,6 @@ public class GalleryFragment extends OCFileListFragment {
|
|||
}
|
||||
|
||||
public void showAllGalleryItems() {
|
||||
mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager());
|
||||
mAdapter.showAllGalleryItems();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue