|
@@ -805,31 +805,34 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
|
|
|
func tapButtonSwitch(_ sender: Any) {
|
|
|
|
|
|
if collectionView.collectionViewLayout == gridLayout {
|
|
|
+
|
|
|
// list layout
|
|
|
headerMenu?.buttonSwitch.accessibilityLabel = NSLocalizedString("_grid_view_", comment: "")
|
|
|
layoutForView?.layout = NCGlobal.shared.layoutList
|
|
|
NCUtility.shared.setLayoutForView(key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
|
|
|
+ self.groupByField = "name"
|
|
|
+ self.dataSource.changeGroupByField(self.groupByField)
|
|
|
+
|
|
|
+ self.collectionView.reloadData()
|
|
|
self.collectionView.collectionViewLayout.invalidateLayout()
|
|
|
- self.collectionView.setCollectionViewLayout(self.listLayout, animated: false, completion: { _ in
|
|
|
- self.groupByField = "name"
|
|
|
- self.dataSource.changeGroupByField(self.groupByField)
|
|
|
- self.collectionView.reloadData()
|
|
|
- })
|
|
|
+ self.collectionView.setCollectionViewLayout(self.listLayout, animated: true)
|
|
|
+
|
|
|
} else {
|
|
|
+
|
|
|
// grid layout
|
|
|
headerMenu?.buttonSwitch.accessibilityLabel = NSLocalizedString("_list_view_", comment: "")
|
|
|
layoutForView?.layout = NCGlobal.shared.layoutGrid
|
|
|
NCUtility.shared.setLayoutForView(key: layoutKey, serverUrl: serverUrl, layout: layoutForView?.layout)
|
|
|
+ if self.isSearching {
|
|
|
+ self.groupByField = "name"
|
|
|
+ } else {
|
|
|
+ self.groupByField = "classFile"
|
|
|
+ }
|
|
|
+ self.dataSource.changeGroupByField(self.groupByField)
|
|
|
+
|
|
|
+ self.collectionView.reloadData()
|
|
|
self.collectionView.collectionViewLayout.invalidateLayout()
|
|
|
- self.collectionView.setCollectionViewLayout(self.gridLayout, animated: false, completion: { _ in
|
|
|
- if self.isSearching {
|
|
|
- self.groupByField = "name"
|
|
|
- } else {
|
|
|
- self.groupByField = "classFile"
|
|
|
- }
|
|
|
- self.dataSource.changeGroupByField(self.groupByField)
|
|
|
- self.collectionView.reloadData()
|
|
|
- })
|
|
|
+ self.collectionView.setCollectionViewLayout(self.gridLayout, animated: true)
|
|
|
}
|
|
|
}
|
|
|
|