Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2022-05-06 07:55:29 +02:00
parent 73a18fbf6e
commit f34fff62a8
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
3 changed files with 13 additions and 5 deletions

View file

@ -152,7 +152,7 @@ class GalleryAdapter(
} }
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
fun showAllGalleryItems(storageManager: FileDataStorageManager) { fun showAllGalleryItems() {
val items = storageManager.allGalleryItems val items = storageManager.allGalleryItems
files = items files = items

View file

@ -43,6 +43,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import androidx.lifecycle.Lifecycle;
public class GallerySearchTask extends AsyncTask<Void, Void, GallerySearchTask.Result> { public class GallerySearchTask extends AsyncTask<Void, Void, GallerySearchTask.Result> {
private final User user; private final User user;
@ -100,7 +102,11 @@ public class GallerySearchTask extends AsyncTask<Void, Void, GallerySearchTask.R
boolean emptySearch = parseMedia(startDate, endDate, result.getData()); boolean emptySearch = parseMedia(startDate, endDate, result.getData());
long lastTimeStamp = findLastTimestamp(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); return new Result(result.isSuccess(), emptySearch, lastTimeStamp);
} else { } else {
@ -117,7 +123,9 @@ public class GallerySearchTask extends AsyncTask<Void, Void, GallerySearchTask.R
photoFragment.setLoading(false); photoFragment.setLoading(false);
photoFragment.searchCompleted(result.emptySearch, result.lastTimestamp); 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); photoFragment.setEmptyListMessage(SearchType.GALLERY_SEARCH);
} }
} }

View file

@ -165,7 +165,7 @@ public class GalleryFragment extends OCFileListFragment {
setEmptyListLoadingMessage(); setEmptyListLoadingMessage();
// always show first stored items // always show first stored items
mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager()); mAdapter.showAllGalleryItems();
setFabVisible(false); setFabVisible(false);
@ -272,6 +272,6 @@ public class GalleryFragment extends OCFileListFragment {
} }
public void showAllGalleryItems() { public void showAllGalleryItems() {
mAdapter.showAllGalleryItems(mContainerActivity.getStorageManager()); mAdapter.showAllGalleryItems();
} }
} }