-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scroll indicators update - positioning correction, support for both indicators at the same time #229
Open
janek
wants to merge
98
commits into
master
Choose a base branch
from
scroll-indicators-update
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Scroll indicators update - positioning correction, support for both indicators at the same time #229
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit
Hold shift + click to select a range
a699f9c
corrected positioning code
janek 61cf77b
added a (hopefully temporary) decay term to offset calculation
janek 7c048e8
included additional insets in the positioning, eliminated decayTerm
janek c1330a0
ensured default insets load appropriately, added small fixes
janek 8324590
lay out indicators out to their initial position when new insets are …
janek 9f1538c
Corrected indicators positioning
janek d4d833e
Added initial distance from scrollview frame
janek bb7abba
support for both indicators at once
janek 6ce8af6
additional spacing that prevents overlap when both indicators are pre…
janek 15a32c5
connected confiugrable insets code to placement code
janek ebb41cd
abstracted out 1 additional step for clarity, corrected var privacy
janek 19611b4
correction for overlap-avoidance, style improvements
janek 5f3149e
corrected syntax bug
janek e11665c
corrected positioning code
janek 696b5ec
added a (hopefully temporary) decay term to offset calculation
janek 4a0d458
included additional insets in the positioning, eliminated decayTerm
janek 9df9578
ensured default insets load appropriately, added small fixes
janek 4b165b7
lay out indicators out to their initial position when new insets are …
janek 54afeee
Corrected indicators positioning
janek 4b2ed66
Added initial distance from scrollview frame
janek a09c179
support for both indicators at once
janek f26136c
additional spacing that prevents overlap when both indicators are pre…
janek 9042ce9
connected confiugrable insets code to placement code
janek f3acd87
abstracted out 1 additional step for clarity, corrected var privacy
janek 59bfdfd
correction for overlap-avoidance, style improvements
janek e5d8f8f
corrected syntax bug
janek 9a0f804
Merge branch 'scroll-indicators-update' of github.com:flowkey/UIKit-S…
janek 68edcf5
ensured scroll indicators stay on top of all other subviews of UIScro…
janek e03b6d0
Merge branch 'master' into scroll-indicators-update
ephemer 59b1d9d
Implement some PR feedback
ephemer 810f0ef
Merge branch 'scroll-indicators-update' of github.com:flowkey/UIKit-S…
janek a8efa15
more PR feedback changes
janek 7f4d5a7
corrected UIEdgeInsets code
janek 0137095
corrected positioning code
janek eaf1e88
added a (hopefully temporary) decay term to offset calculation
janek 2c77d5c
included additional insets in the positioning, eliminated decayTerm
janek c43e4d9
ensured default insets load appropriately, added small fixes
janek b13e05d
lay out indicators out to their initial position when new insets are …
janek 3158be6
Corrected indicators positioning
janek ff215e1
Added initial distance from scrollview frame
janek 7086a9d
support for both indicators at once
janek df2624b
additional spacing that prevents overlap when both indicators are pre…
janek 3a24ba3
connected confiugrable insets code to placement code
janek b9b6df4
abstracted out 1 additional step for clarity, corrected var privacy
janek 5ec8cf7
correction for overlap-avoidance, style improvements
janek 975f308
corrected syntax bug
janek e2e62d0
corrected positioning code
janek fd3218f
added a (hopefully temporary) decay term to offset calculation
janek 63c89f4
included additional insets in the positioning, eliminated decayTerm
janek 497b07c
ensured default insets load appropriately, added small fixes
janek d94bead
lay out indicators out to their initial position when new insets are …
janek 399d18e
Corrected indicators positioning
janek faa63de
Added initial distance from scrollview frame
janek 646b7d2
support for both indicators at once
janek be7e9cf
additional spacing that prevents overlap when both indicators are pre…
janek 8060600
connected confiugrable insets code to placement code
janek 7b9e543
abstracted out 1 additional step for clarity, corrected var privacy
janek 6af7c80
correction for overlap-avoidance, style improvements
janek 19c16fd
corrected syntax bug
janek 08ff58e
ensured scroll indicators stay on top of all other subviews of UIScro…
janek f24db7e
Implement some PR feedback
ephemer 66938cf
more PR feedback changes
janek 91ec3cd
corrected UIEdgeInsets code
janek d1a2e74
Merge branch 'scroll-indicators-update' of https://github.com/flowkey…
janek d19f0af
rename 'bothIndicatorsShowing'
janek 75553c8
removed whitespace
janek 147831f
Merge branch 'master' into scroll-indicators-update
rikner df0b435
changed internal access levels to private in indicators extension, re…
janek 6cc4e28
updated UIScrollViewIndicatorStyle to be UIScrollView.IndicatorStyle …
janek bc35223
Added comments explaining source of thickness and inset values
janek b5dcd2a
brought back explicit 'internal' access level keywords
janek c39799b
improved safety of code responsible for adding subviews: we now check…
janek ead7c57
Test push
janek 1649892
removed conditions for laying out indicators, it will now happen ever…
janek 2c1a237
Removing testfile
janek ab05997
Merge branch 'master' into scroll-indicators-update
janek b22318a
Linting: spaces should be on both sides of the minus sign
janek 7ac4e70
Added a comment about distance values mimicking iOS
janek 60d850f
Temporary changes to the Demo App
janek 65c5f0c
Add a test for scroll veiw with scroll indicators subview hierarchy
janek 0e44547
Added information about indicators being accesible in `subviews` and …
janek fd14007
Fix mockTouch
janek 2039d6d
Add a guard to 'layout indicators if necessary'
janek b2e2c46
FIx whitespace
janek 6379d21
simplified `earliestIndicatorInSubviewHierarchy`
janek fa4b095
Improve subview count test
janek abc824c
Remove the stub for overriding `subviews`, as default is correct
janek b3e59f0
Update DemoApp
janek 17e0f0a
Improve style in addSubview
janek 658a4a2
Add more hierarchy positions tests
janek 7298827
Improve tests, refactor insertSubview
janek 7d39faa
Add a comment stating that `applyScrollIndStyle` is called on init (a…
janek 8c57422
Update the DemoApp to change black to blue
janek cc0452b
Restore ViewController for master
janek 8a81fe4
Divide test into two, clarify purpose and remove bug
janek ac1f2ec
Improve comment and test names
janek 36e63e4
Merge commit '8f10d29ea93f93ca65633c6bd1f1b863d2461b5a' into scroll-i…
janek 6a899ae
Update insertSubview test, fix a bug in insertSubview
janek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
removed whitespace
- Loading branch information
commit 75553c8e4e67939cc2c88e634010e930dae82a84
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS always lays out the scroll indicators I think, and there was an advantage to this -> I seem to remember finding a bug where the indicators appeared in the wrong spot after being hidden. I think we need to revisit this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey, I ran a test app with a scrollview on pure iOS, with showsXScrollIndicator off for both dimensions, and then on. I then used
po scrollView.subviews
in the debugger. If showsXScrollIndicator is off, the indicators are not in the view hierarchy at all, so it seems like iOS does not position them in that case. I could imagine that iOS might save positions for indicators without adding them to view hierarchy just yet, so maybe that's what happens - but no idea how to test that.In light of this, what do we want to do?
From the perspective of code changes, laying them out in all cases should be very easy and help us get rid of a few lines of code. So I absolutely don't mind doing it if you feel that's the way to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Janek, you can get a reference to the scroll indicator subviews (just iterate through them on an empty scroll view and find the UIImageViews) and then hide them. You should be able to print their positions at every pixel scrolled. Would be cool if you could check this. I think it makes sense to remove them from the hierarchy of they’re hidden, but laying them out shouldn’t be a big performance issue (if that’s what iOS does)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I can get the reference and print positions, even if I make them invisible with
isHidden
.but if I set
showsVerticalScrollIndicator
forfalse
, that indicator will no longer be in the view hierarchy and therefore probably impossible to get a reference to.I checked back with our code and this is where we differ - we always have indicators in the hierarchy and just make them invisible if the UIKit user wants to hide them.
So if they are set to hidden by UIKit API, we keep them in the hierarchy, but don't update their positions, and then start updating it when they become visible. We could:
v1. and v2. are equally easy. We are in state 1 and if we want 2, we should just merge this new small PR I opened (#284). It's set to merge into this branch, not master.
v3. is more work and I worry it might also complicate things with our inserting/removing subviews code, so I'd rather not do it now - but again, it seems the closest to iOS. Maybe let's go with 1 or 2 and create a low-prio issue for 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update: I now changed the insert/add subview code - didn't take long at all and should now be robust w.r.t indicators sometimes not being there. It therefore also shouldn't be too much pain to implement v3. I'll still wait for your opinion before starting on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update: merged #284