Skip to content

Commit

Permalink
Merge pull request #11817 from nextcloud/nmc/fixMediaViewEmptyState
Browse files Browse the repository at this point in the history
Fix empty state for media view
  • Loading branch information
AndyScherzinger committed Jul 24, 2023
2 parents cacc62a + 6c32bbf commit db5b312
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author TSI-mc
* Copyright (C) 2022 Tobias Kaminsky
* Copyright (C) 2022 Nextcloud GmbH
* Copyright (C) 2022 TSI-mc
* Copyright (C) 2023 TSI-mc
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
Expand Down Expand Up @@ -195,14 +195,14 @@ class GalleryAdapter(

if (finalSortedList.isEmpty()) {
photoFragment.setEmptyListMessage(SearchType.GALLERY_SEARCH)
} else {
files = finalSortedList
.groupBy { firstOfMonth(it.modificationTimestamp) }
.map { GalleryItems(it.key, transformToRows(it.value)) }
.sortedBy { it.date }.reversed()

Handler(Looper.getMainLooper()).post { notifyDataSetChanged() }
}

files = finalSortedList
.groupBy { firstOfMonth(it.modificationTimestamp) }
.map { GalleryItems(it.key, transformToRows(it.value)) }
.sortedBy { it.date }.reversed()

Handler(Looper.getMainLooper()).post { notifyDataSetChanged() }
}

private fun transformToRows(list: List<OCFile>): List<GalleryRow> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.datamodel.ThumbnailsCacheManager;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.EmptyRecyclerView;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.activity.FolderPickerActivity;
import com.owncloud.android.ui.activity.ToolbarActivity;
Expand Down Expand Up @@ -158,6 +159,10 @@ protected void setAdapter(Bundle args) {

setRecyclerViewAdapter(mAdapter);

//update the footer as there is no footer shown in media view
if (getRecyclerView() instanceof EmptyRecyclerView) {
((EmptyRecyclerView) getRecyclerView()).setHasFooter(false);
}

GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 1);
mAdapter.setLayoutManager(layoutManager);
Expand Down

0 comments on commit db5b312

Please sign in to comment.