106 Commits

Author SHA1 Message Date
Michael Schneider
0eb882bae5 Some more changes 2016-11-19 06:43:46 -08:00
Michael Schneider
fb92b448e0 [ASDisplayNode] Proper handling of constrainedSize (#2505)
* Check in ASLayout if size is valid for sizing instead of valid for layout

* Return constrainedSize from calculateSizeThatFits:

Remove invalid constrainedSize check within ASNetworkImageNode. Furthermore as ASDisplayNode does not return CGSizeZero anymore we have to give the display nodes we use in tests and are involving a stack spec an intrinsic content size.

* Remove extra constrainedSize handling in ASNetworkImageNode handling

* Change test to use FLT_MAX
2016-10-28 15:39:03 -07:00
Adlai Holler
dbe3b1bd71 Remove block copying (#2438) 2016-10-20 12:53:25 -07:00
Michael Schneider
f574f2c54e [Layout] Further deprecation steps for preferredFrameSize (#2255)
* Deprecate preferredFrameSize

- Remove all support for preferredFrameSize in ASDK
- preferredFrameSize setter calls through and sets the width and height of the node
- preferredFrameSize getter tries to return a CGSize based on the width and height properties otherwise if this is not possible it throws

* Address comments

* Return CGSizeZero for preferredFrameSize unless width and height are ASDimensionUnitPoints

* Better comment for preferredFrameSize and remove lock in calculateSizeThatFits:
2016-09-27 16:07:36 -04:00
Adlai Holler
1e86dcdbe2 [ASDisplayNode] Use kCGBlendModeCopy in a Couple More Places (#2250)
* Use blend mode copy in a couple more places

* Add some tests
2016-09-15 11:56:46 -07:00
Michael Schneider
8897614f0e [Layout] Layout API based on content area (#2110)
* Initial commit for adding a size constraint to ASLayoutable's

* Some more commits

* Fix sample projects in extra/

* Remove preferredFrameSize test of ASEditableTextNode

* Remove preferredFrameSize from examples_extra

* Add deprecation warning to -[ASDisplayNode preferredFrameSize]

* Add deprecation warning to -[ASDisplayNode measureWithSizeRange:]

* Commit

* Commit

* Remove ASRelativeSizeRange

* Make ASRelativeSize private

* Adjust examples

* Improve setting of -[ASLayoutable size] with points or fractions

* Add ASWrapperLayoutSpec

* Improve creation of ASRelativeDimension

* Add `preferredFrameSize` back and add deprecated logging

* Add `layoutSpecBlock` setter and getter and add locking for it

* Add better documentation and fix macros to create ASRelativeDimension

* Create new ASSizeRangeMake with just a CGSize as parameter

* Update Kitten and Social App Layout example

* Add layoutThatFits: and deprecate measure:

* Rename ASRelativeDimension to ASDimension

* Fix examples for ASDimension renaming

* Remove fancy height and width setter

* Fix ASDimension helper

* Rename -[ASLayout layoutableObject] to -[ASLayout layoutable]

* Update layout related methods and more clearer documentation around how to use it

* Deprecate old ASLayout class constructors

* Don't unnecessary recalculate layout if constrained or parent size did not change

* Use shared pointer for ASDisplayNodeLayout

* Fix rebase conflicts

* Add documentation and move implementation in mm file of ASDisplayNodeLayout

* Fix test errors

* Rename ASSize to ASLayoutableSize

* Address comments

* Rename setSizeFromCGSize to setSizeWithCGSize

* Improve inline functions in ASDimension

* Fix rebase conflicts
2016-09-07 08:44:48 -07:00
Adlai Holler
b233122604 Check the image alpha value correctly (#2198) 2016-09-05 21:27:50 -07:00
Adlai Holler
607ec8f4a5 [ASImageNode] Use kCGBlendModeCopy when Possible (#2197)
* [ASImageNode] Use kCGBlendModeCopy when possible

* Make the blend mode logic more readable
2016-09-05 20:52:06 -07:00
Adlai Holler
5e3627a9cd [ASTextNode] Actually deprecate attributedString property (#2151) 2016-09-01 16:43:03 -07:00
Adlai Holler
f542e8d458 [ASDisplayNode] If We Skipped Rendering Due to Zero-Area, Re-Render When We Get a Real Area (#2149)
* Add failing test case

* [_ASDisplayLayer] If we skipped render due to being zero-size, enqueue a render when we get a real size

* Remove pointless import
2016-08-26 15:51:49 -07:00
Garrett Moon
dfe4585cec Add ability to force the size which an image node is rendered. (#2107)
* Add ability to force the size which an image node is rendered.

* Add unit tests for forced scaling.

* Whoops, need results!

* Round forced scaling.

* Check size of contents too.

* Remove unnecessary container node.
2016-08-23 16:01:43 -07:00
Yue-Wang-Google
a38f3db6b0 set the right attributes for block properties. (#2113)
* set the right attributes for block properties.

* oops. should remove strong.

* Update ASImageNode.mm

* revert to use copy for blocks. See apple documentation below

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html#//apple_ref/doc/uid/TP40011210-CH8-SW12

* make the block properties nonatomic.
2016-08-21 13:06:21 -07:00
Hannah Troisi
893e601e81 Convert to type-generic math (#2050)
* [Optimization] Convert to type-generic math

* add std:: prefix in obj-c++ files

* more cleanup

* revert test changes

* convert min and max back to fmin/fmax
2016-08-09 15:31:37 -07:00
David Rodrigues
70574243f7 Prevent API misuse at compile time (#2035)
Using Objective-C attributes, in this case `unavailable`, we can hide
unsupported APIs at compile time instead of detecting and warn about it
at runtime with a set of asserts.
2016-08-04 19:00:46 -07:00
Chris Danford
c09db1cb17 ASImageNode backing store sharing for memory and CPU reduction (#1974) 2016-08-03 13:10:50 -07:00
appleguy
74bf376b2f [ASDisplayNode] Rename _propertyLock to __instanceLock__ to avoid subclass naming collisions. (#1941) 2016-07-16 15:32:13 -07:00
Hannah Troisi
f39c2ce7e3 [ASTextNode, ASImageNode, ASVideoNode] Use ASDisplayNode base class lock for subclass property synchronization (#1877)
* [ASTextNode, ASVideoNode] Use ASDisplayNode base class lock for subclass property synchronization

* fix headers to match master

* address @appleguy, @maicki comments

* import header

* Swap lock in ASNetworkImageNode as well

* remove invalid comment

* more cleanup of locks
2016-07-09 22:08:34 -07:00
appleguy
3b2af7eb6d [Build] Remove Unused Imports across all of AsyncDisplayKit. This uses a feature of AppCode. (#1875)
Details on the tool are here: https://www.jetbrains.com/help/idea/2016.1/optimizing-imports.html
2016-07-09 17:20:59 -07:00
Michael Schneider
e7e2672472 Move imageLock in braces for getting drawing parameters (#1876) 2016-07-09 17:02:05 -07:00
Scott Goodson
f0ff9c108d Merge branch 'master' of git://github.com/kielgillard/AsyncDisplayKit into kielgillard-master 2016-07-09 15:44:31 -07:00
Michael Schneider
b2810edb0f Move dealloc method from ASImageNode+AnimatedImage category to ASImageNode
Having a dealloc method in a category can be very problematic as the superclass dealloc method will not be called in case it exists.
2016-07-08 14:41:47 -07:00
Kiel Gillard
f7b7bcebeb * Make the "Life Without Cocoapods" sample build and run.
* Properly reference headers within implementation files to avoid import cycles and redeclaration warnings.
2016-07-06 16:58:13 +10:00
Michael Schneider
36e48cf340 Remove caching of _drawParameter and use bounds instead of threadSafeBounds 2016-06-21 13:11:38 -07:00
Michael Schneider
74b9b6b49e Use threadSafeBounds instead of bounds to create drawing parameters 2016-06-21 13:11:38 -07:00
Michael Schneider
fc7cff333e Prevent subclassing of ASTextNode and ASImageNode 2016-06-21 13:11:38 -07:00
Michael Schneider
3384297c58 Move drawing parameters in ASTextNode and ASImageNode to structs 2016-06-21 13:11:38 -07:00
Hannah Troisi
c857e809f4 Clean up header comments (for consistent Facebook licensing info) (#1741)
[Licensing] Clean up header comments (for consistent Facebook licensing info)
2016-06-11 23:31:39 -07:00
Eric Jensen
fdc57410ee Move the default animated image runloop mode to a constant, and fallback to the constant if the runloop mode is set to nil 2016-06-09 10:53:37 -07:00
Eric Jensen
370e5f1006 Allow configuration of ASImageNode's animation runloop 2016-06-08 10:38:43 -07:00
appleguy
86deec4033 Merge pull request #1665 from hannahmbanana/master
[AsyncDisplayKit+Debug.h] Move hitTestDebug code out of ASControlNode and into debug file
2016-06-01 11:15:44 +07:00
Michael Schneider
73ce8c148a Add comment for setting the backgroundColor in ASImageNode 2016-05-26 10:01:12 -07:00
Michael Schneider
e3e9d36f56 Fix image sometimes appearing with black background or completely disappearing in ASImageNode 2016-05-25 10:07:34 -07:00
Hannah Troisi
37d4c5e475 Fixing a bug in both debug tools (image scaling, tappable area) in which I don't check that the overlay exists before creating it. 2016-05-15 23:28:39 -07:00
Aaron Schubert
b586b9f34b Fix merge conflicts 2016-04-21 09:26:40 +01:00
Aaron Schubert
e2fa2f8192 [tvOS] Address comments on previous PR. 2016-04-21 09:23:47 +01:00
Aaron Schubert
06d4573b14 [tvOS] Branch out tvOS specific code into it's own categories 2016-04-21 08:59:14 +01:00
appleguy
dd4853bf3a Merge pull request #1273 from aaronschubert0/tvOS
[tvOS] Add default focus states to ASControlNode & ASImageNode.
2016-04-20 13:29:31 -07:00
Garrett Moon
0fc39d1ccd Follow up to animated GIF PR 2016-04-19 13:43:41 -07:00
Aaron Schubert
21abe8f899 Fix merge conflicts 2016-04-19 09:02:07 +01:00
appleguy
30a0c471ca Merge pull request #1528 from ejensen/instancetype
[Refactoring] Replace id with instancetype in initializers
2016-04-16 20:53:41 -07:00
Garrett Moon
1b316217ef Downstream ASAnimatedImage 2016-04-13 14:23:02 -07:00
Garrett Moon
beba9031ef Expose public properties properly
Reviewers: rmalik

Reviewed By: rmalik

Differential Revision: https://phabricator.pinadmin.com/D82227
2016-04-13 14:23:02 -07:00
Garrett Moon
3bcbfb149d Add support for animated GIFs
Summary:
Use NSData as key

Add chunking of files

Add support for Animated Images

This adds support for GIF playback in ASDK. It's not currently ready
for merging to public ASDK – for one the GIF decompression may make
more sense in PINRemoteImage.

Removed duration as it wasn't used

Make cover image lazily loaded

Differential Revision: https://phabricator.pinadmin.com/D82033
2016-04-13 14:23:02 -07:00
Eric Jensen
527397ba7e Replace id with instancetype in initializers 2016-04-13 11:20:05 -07:00
Scott Goodson
cd493358cc [ASControlNode] Upgrades to +setEnableHitTestDebug: to intersect hitTestSlop with parents' bounds+slop, to accurately predict and visualize UIKit event delivery edge cases. 2016-03-27 22:02:13 -07:00
Scott Goodson
c5c7abb1d6 [ASDisplayNode] Placeholders should always be recreated if returning to past nodes.
If previously-displayed contents is gone (e.g. clearContents), and is not finished displaying
by the time the node is onscreen, recreate the placeholder immediately.
2016-03-18 21:13:26 -07:00
Eric Jensen
33fda7ab49 - Use modern Objective-C syntax.
-  Simplify comparisons.
-  Remove dead stores.
2016-03-15 22:34:29 -07: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
Hannah Troisi
51eccb3d96 [ASImageNode] More refined naming and documentation for [ASImageNode shouldShowImageScalingOverlay] 2016-03-08 23:30:17 -08:00
Hannah Troisi
d64c05a68e [ASImageNode] A ASImageNode debug feature showing pixel scaling amount
- shows a red text label overlay on bottom right hand corner of ASImageNodes with pixel scaling factor
- import AsyncDisplayKit+Debug.h and enable using [ASImageNode setEnableImageDebugOverlay]
2016-03-08 23:13:32 -08:00