@@ -128,11 +128,16 @@ FocusScope {
128 highlightWhenPressed: false
128 highlightWhenPressed: false
129 showDivider: false
129 showDivider: false
131− readonly property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
131+ readonly property bool expandable: item ? item.uncollapsedHeight > item.collapsedHeight : false
132− readonly property bool filtered: rendererLoader.item ? rendererLoader.item.filtered : true
132+ property bool filtered: true
133 readonly property string category: categoryId
133 readonly property string category: categoryId
134 readonly property var item: rendererLoader.item
134 readonly property var item: rendererLoader.item
136+ function setFilter(filter, animate) {
137+ heightBehaviour.enabled = animate;
136 CardTool {
141 CardTool {
137 id: cardTool
142 id: cardTool
138 objectName: "cardTool"
143 objectName: "cardTool"
@@ -142,6 +147,18 @@ FocusScope {
142 viewWidth: parent.width
147 viewWidth: parent.width
150+ onExpandableChanged: {
151+ // This can happen with the VJ that doesn't know how height it will be on creation
152+ // so doesn't set expandable until a bit too late for onLoaded
154+ var shouldFilter = baseItem.category != categoryView.expandedCategoryId;
155+ baseItem.setFilter(shouldFilter, false /*animate*/);
159+ onHeightChanged: rendererLoader.updateDelegateCreationRange();
160+ onYChanged: rendererLoader.updateDelegateCreationRange();
146 id: rendererLoader
163 id: rendererLoader
147 anchors {
164 anchors {
@@ -151,13 +168,27 @@ FocusScope {
151 topMargin: hasSectionHeader ? 0 : units.gu(2)
168 topMargin: hasSectionHeader ? 0 : units.gu(2)
171+ Behavior on height {
174+ animation: UbuntuNumberAnimation {
177+ heightBehaviour.enabled = false
183+ height: baseItem.filtered ? item.collapsedHeight : item.uncollapsedHeight
154 source: {
185 source: {
155 switch (cardTool.categoryLayout) {
186 switch (cardTool.categoryLayout) {
156 case "carousel": return "CardCarousel.qml";
187 case "carousel": return "CardCarousel.qml";
157 case "vertical-journal": return "CardVerticalJournal.qml";
188 case "vertical-journal": return "CardVerticalJournal.qml";
158 case "running-apps": return "Apps/RunningApplicationsGrid.qml";
189 case "running-apps": return "Apps/RunningApplicationsGrid.qml";
159 case "grid":
190 case "grid":
160− default: return "CardFilterGrid.qml";
191+ default: return "CardGrid.qml";
@@ -176,9 +207,9 @@ FocusScope {
177 item.objectName = Qt.binding(function() { return categoryId })
208 item.objectName = Qt.binding(function() { return categoryId })
178 item.scopeStyle = scopeView.scopeStyle;
209 item.scopeStyle = scopeView.scopeStyle;
179− if (item.expandable) {
210+ if (baseItem.expandable) {
180 var shouldFilter = categoryId != categoryView.expandedCategoryId;
211 var shouldFilter = categoryId != categoryView.expandedCategoryId;
181− item.setFilter(shouldFilter, false /*animate*/);
212+ baseItem.setFilter(shouldFilter, false /*animate*/);
183 updateDelegateCreationRange();
214 updateDelegateCreationRange();
184 item.cardTool = cardTool;
215 item.cardTool = cardTool;
@@ -211,14 +242,6 @@ FocusScope {
211 previewListView.currentIndex = index;
242 previewListView.currentIndex = index;
212 previewListView.open = true
243 previewListView.open = true
214− onExpandableChanged: {
215− // This can happen with the VJ that doesn't know how height it will be on creation
216− // so doesn't set expandable until a bit too late for onLoaded
217− if (rendererLoader.item.expandable) {
218− var shouldFilter = baseItem.category != categoryView.expandedCategoryId;
219− rendererLoader.item.setFilter(shouldFilter, false /*animate*/);
223 Connections {
246 Connections {
224 target: categoryView
247 target: categoryView
@@ -227,15 +250,15 @@ FocusScope {
228 function collapseAllButExpandedCategory() {
251 function collapseAllButExpandedCategory() {
229 var item = rendererLoader.item;
252 var item = rendererLoader.item;
230− if (item.expandable) {
253+ if (baseItem.expandable) {
231 var shouldFilter = categoryId != categoryView.expandedCategoryId;
254 var shouldFilter = categoryId != categoryView.expandedCategoryId;
232− if (shouldFilter != item.filter) {
255+ if (shouldFilter != baseItem.filtered) {
233 // If the filter animation will be seen start it, otherwise, just flip the switch
256 // If the filter animation will be seen start it, otherwise, just flip the switch
234 var shrinkingVisible = shouldFilter && y + item.collapsedHeight < categoryView.height;
257 var shrinkingVisible = shouldFilter && y + item.collapsedHeight < categoryView.height;
235 var growingVisible = !shouldFilter && y + height < categoryView.height;
258 var growingVisible = !shouldFilter && y + height < categoryView.height;
236 if (!previewListView.open || !shouldFilter) {
259 if (!previewListView.open || !shouldFilter) {
237 var animate = shrinkingVisible || growingVisible;
260 var animate = shrinkingVisible || growingVisible;
238− item.setFilter(shouldFilter, animate)
261+ baseItem.setFilter(shouldFilter, animate)
239 if (!shouldFilter && !previewListView.open) {
262 if (!shouldFilter && !previewListView.open) {
240 categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
263 categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
@@ -304,9 +327,6 @@ FocusScope {
308− onHeightChanged: rendererLoader.updateDelegateCreationRange();
309− onYChanged: rendererLoader.updateDelegateCreationRange();
312 sectionProperty: "name"
332 sectionProperty: "name"