228 Commits

Author SHA1 Message Date
Nick Velloff
d0c30a43ca expose relayoutAllNodes at ASCollectionView level (#1683)
* expose relayoutAllNodes at ASCollectionView level

* rename relayoutAllNodes to relayoutItems to be more UIKit centric
2016-05-24 13:22:01 +07:00
rcancro
8bb4eba080 Initial attempt at implementing Display Traits
Initial attempt to get display traits working with ASEnvironment.

To get proper ASDisplayTraits support, you must use an ASViewController. The ASViewController implements UITraitCollection-related methods (`traitCollectionDidChange:`, `willTransitionToTraitCollection:withTransitionCoordinator:`, viewWillTransitionToSize:withTransitionCoordinator`) to update the internal ASDisplayTraits and propagate them to subnodes.

ASTableNode and ASCollectionNode don't actually have their cells as subnodes, so a little bit of trickery is involved (on `setEnvironment:` the table/collection node gets its data controllers completedNodes and propagates the new traits. see `ASDisplayTraitsCollectionTableSetEnvironmentState`). The data controller also passes the current display traits when creating new cells.

ASViewController also supports the ability to return a custom set of display traits. So if you have a modal dialog that should always be told it is in a compact size class, you can set the override block before displaying the VC.

A new example, called Display Traits, has been added. It shows how display traits can be used in a ASViewController with a normal ASDisplayNode as its root, as well as in ASViewControllers hosting table nodes and collection nodes. There is also an example of overriding the default display traits of a VC.

Please provide feedback!
2016-05-10 14:44:22 -07:00
Michael Schneider
bc8489528e Fix crash in delegate / dataSource proxies for ASCollectionView and ASTableView 2016-05-04 21:03:43 -07:00
Michael Schneider
8f1beb8bf6 Addressed comments
- Use memset to clear flags
- Fix check for asyncDataSourceNodeForItemAtIndexPath
- Fix selector for asyncDelegateCollectionViewDidEndDisplayingNodeForItemAtIndexPath
- Fix multiple collectionViewWillEditCellsAtIndexPaths:batched: calls
2016-04-19 16:13:30 -07:00
Michael Schneider
d9f16e0acf Use _performingBatchUpdates for _layoutFacilitator batched parameter 2016-04-19 16:13:30 -07:00
Michael Schneider
3a20c6a1f4 Add caching for delegate and datasource calls in ASCollectionView and ASTableView 2016-04-19 16:13:30 -07:00
Michael Schneider
d0023a97f7 Fix fetching will continually trigger in a loop after reaching end of content
Don't schedule a new check for a batch fetch if no data changed previous batch fetch
2016-04-12 17:14:43 -07:00
Michael Schneider
3c66013088 Remove logging message 2016-04-10 14:23:33 -07:00
Michael Schneider
e9fe92444f Small comment fix 2016-04-09 10:55:52 -07:00
Michael Schneider
24ca09ee6c Move most of the batch fetching logic to a central place for ASTableView and ASCollectionView usage 2016-04-09 10:55:52 -07:00
Michael Schneider
c25a252e1c Fix fetch call won't occur for content smaller than bounds unless user scrolls 2016-04-09 10:55:52 -07:00
Scott Goodson
5b9302b681 Revert "Prevent deallocation of asyncDataSource and asyncDelegate in ASCollectionView and ASTableView"
This reverts commit 3668f45286a56a87d200aea0299caee9d2e4a880.
2016-03-22 14:38:50 -07:00
Michael Schneider
3668f45286 Prevent deallocation of asyncDataSource and asyncDelegate in ASCollectionView and ASTableView
Grab a strong reference for asyncDataSource and asyncDelegate in ASCollectionView and ASTableView before executing the range update to be sure they are not going away while executing the range update. This can happen in range updates while going back in the view controller hierarchy
2016-03-22 08:09:59 -07:00
Hannah Troisi
f9a92366d3 [AsyncDisplayKit] Fix build so we can weak link AVFoundation
Unclear why the framework target required these seemingly unrelated changes to Collection
classes, but I modeled them after related files and it seems cleaner now (passes tests & framework target)
2016-03-19 17:54:02 -07:00
appleguy
2ad9d83520 Merge pull request #1353 from ejensen/spelling
[Documentation] Correct spelling errors
2016-03-16 22:53:15 -07:00
Michael Schneider
e82118e72f Add assertion for ASDisplayNode is layer backed if using ASInterfaceStateForDisplayNode 2016-03-16 16:27:08 -07:00
Michael Schneider
8d771f930a Refactor calculation of interface state based on ASDisplayNode and window 2016-03-16 13:26:17 -07:00
Michael Schneider
3b4e8d732c Improve way to detect interface state of ASCollectionView and ASTableView 2016-03-16 11:45:22 -07:00
Michael Schneider
19232ac493 Address pull request comments 2016-03-16 11:44:56 -07:00
Michael Schneider
d3ba80ccfd Improvements for automatic range mode
- Only update range mode if visibility changes if the node is not range controlled
- Only change explicitly set range mode if ASRangeController becomes visible
- Return interface state for range controller in ASCollectionView and ASTableView based on if the containing node is range managed
2016-03-16 11:44:56 -07:00
appleguy
b30fa8b2f6 Merge pull request #1373 from maicki/FullRangeModeOnScroll
[ASRangeController] Go into full range mode if a scroll happens
2016-03-16 11:33:43 -07:00
Eric Jensen
ddd5ff1f75 Correct spelling errors 2016-03-15 21:56:51 -07:00
Huy Nguyen
22b105bfdc ASCollectionView doesn't animate size changes if some of the updated cell nodes don't want to 2016-03-15 16:17:43 -07:00
Michael Schneider
13aa891ecf Improve way to go into full mode on scroll 2016-03-12 17:45:09 -08:00
Michael Schneider
e4ddb7e270 Go into full range mode if a scroll happens 2016-03-12 15:44:27 -08:00
Gordon Chen
508ac44238 make sure ASCV's layoutFacilitator triggers layout recalculation when its subnode has size change 2016-03-11 16:49:33 -08:00
Scott Goodson
ff8ffffb7b [ASCellNode] Upgrades to ASCellNodeVisibilityEvent to ensure it is always synchronized with visibilityDidChange: 2016-03-10 20:21:00 -08:00
Scott Goodson
0e460ca00a [ASRangeController] Don't bother asking UIKit for the visible index paths if view is zero-sized, as it triggers a reloadData. 2016-03-10 19:10:25 -08:00
Scott Goodson
21bebb9d29 [ASRangeController] Improvements to application state change and memory warning handling.
Introduces ASLayoutRangeModeVisibleOnly, allowing the preservation of decoded backing stores without any extra padding to
strictly minimize memory usage while supporting immediate re-display of content.  Set visible range controllers to this mode
upon app suspend / memory warning, while more aggressively clearing others to the ASLayoutRangeModeLowMemory mode.

By default, when the app is running and recieves a memory warning, we set the range mode for non-visible controllers to
ASLayoutRangeModeVisibleOnly.  This is because, unlike in the app suspend case where on app resume we can restore controllers
from LowMemory to VisibleOnly, the memory warning doesn't provide a good opportunity to do this.

A new +Beta API to control this behavior is called +setRangeModeForMemoryWarnings:, as some apps may prefer to use LowMemory
in the memory warning scenario.  For these apps, optimal user experience will require manually setting the range mode back
to some larger value as the user navigates the app, or they will encounter controllers that are temporarily blank and need
a moment to re-display their contents as they start to become visible.
2016-03-09 21:22:45 -08:00
Ethan Nagel
352247184a Ensure that we use the correct default size for collection nodes even if layoutSubviews has not been called yet. This is a more conservative approach than the previous one. 2016-03-09 09:56:32 -08:00
Ethan Nagel
5a3dab5610 Ensure that er use the correct default size for collection nodes even if layoutSubviews has not been called yet 2016-03-08 17:03:55 -08:00
Scott Goodson
9c0d0542dd [ASScrollDirection] Fix scroll direction interpretation after recent changes to this logic. 2016-03-07 22:50:48 -08:00
appleguy
354ccf3e5f Merge pull request #1327 from samhsiung/fix_scrollable_directions
[ASCollectionView] scrollableDirections must account for alwaysBounce(Vertical | Horizontal)
2016-03-05 16:35:48 -08:00
Luke Zhao
03e84e20ac updated with deprecated message 2016-03-05 13:04:20 -08:00
Samuel Hsiung
85394f09b4 Account for alwaysBounce(Vertical|Horizontal) when calculating scrollable directions 2016-03-04 21:33:08 -08:00
appleguy
0a76c7b5d2 Merge pull request #1301 from lkzhao/collectionView-sectionInset-fix
Remove cell constrainedSize adjustment with section insets in constrainedSizeForNode
2016-03-04 14:26:55 -08:00
Luke Zhao
aa180c6f3b completely remove cell constrainedSize adjustment from section inset 2016-03-04 13:14:16 -08:00
Michael Schneider
aa2ae87c81 Add -waitUntilAllUpdatesAreCommitted to ASTableView and ASCollectionView
The API allows consumer of ASTableView or ASCollectionCiew to block execution of the main thread until all section and row updates are committed.
2016-03-02 19:38:14 -08:00
appleguy
e82d1408d2 Merge pull request #1292 from nguyenhuy/visibility_improvements
[ASCellNode] Update visibility API to support new event types for initial visibility & invisibility (caused by VC transitions, etc)
2016-03-02 19:30:31 -08:00
Luke Zhao
818c5bab9c only adjust constraint size if the datasource doesn't implement ConstrainedSizeForNode 2016-03-01 13:16:10 -08:00
appleguy
e9fcfefbdd Merge pull request #1294 from vivqu/batch_fetch
[ASCollectionView] Account for contentInset when calculating ASScrollDirection
2016-02-29 22:31:40 -08:00
Huy Nguyen
c64f23725f Update ASCellNode visibility API 2016-02-29 20:26:16 -08:00
Vivian Qu
31b576ebcd Address comment 2016-02-29 17:49:26 -08:00
Vivian Qu
d28c3c27c6 Account for contentInset when calculating ASScrollDirection 2016-02-29 17:10:39 -08:00
Michael Schneider
084e6f82c1 Trigger updating interfaceState for cells in case ASTableView or ASCollectionView becomes visible or invisible 2016-02-29 17:04:25 -08:00
Levi McCallum
c2d379f8f5 Add a bit of documentation to describe the problem this is solving 2016-02-23 13:02:37 -08:00
Levi McCallum
4640801939 Enable animated bounds changes in ASCollectionView 2016-02-23 09:36:11 -08:00
appleguy
b75d6627bb Revert "Revert "Revert "[ASCollectionView / ASTableView] Optimize reloadData and reloadSection: methods.""" 2016-02-19 23:26:29 -08:00
Max Gu
67c8cd5ccf Removing underscore 2016-02-19 22:21:07 -08:00
Max Gu
548b600504 Removing 2 unnecessary checks 2016-02-19 22:18:08 -08:00