Skip to content
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

Activity Stream Phase 1 - Layout #2055

Merged
merged 4 commits into from
Aug 31, 2016
Merged

Activity Stream Phase 1 - Layout #2055

merged 4 commits into from
Aug 31, 2016

Conversation

farhanpatel
Copy link
Contributor

@farhanpatel farhanpatel commented Aug 16, 2016

I'd love for some feedback. I'll comment on some design decisions I made in #2039

@farhanpatel farhanpatel added wip Do Not Merge ⛔️ This issue is a work in progress and is not ready to land labels Aug 16, 2016
return
}

img.getColors(CGSize(width: 50, height:50)) { colors in
Copy link
Contributor Author

@farhanpatel farhanpatel Aug 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using UIImageColors here. It extracts dominant colors form images. Works pretty great. But need to handle edge cases better

}
}

override func traitCollectionDidChange(previousTraitCollection: UITraitCollection?) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By keeping track of the traits I can make sure that the right amount of topsites appear for all view sizes.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to always call super whenever overriding view controller methods.

Size classes define how many items to show per row/column.
*/
func numberOfVerticalItems(estimatedItems: Int) -> Int {
if let traits = currentTraits {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I think I mentioned this above but a rule of thumb I generally use for when to use if vs guard is if you're conditioning on the value usually being there, opt for guard so the code you expect to usually run is not buried inside a code branch. I guess in general it just reduces the branching complexity of the code by flattening it out.

@sleroux
Copy link

sleroux commented Aug 25, 2016

You mentioned you already found a couple of bugs but I'll just note the ones I came across here just in case.

  • When the user scrolls the AS panel we should hide the keyboard to show all of the panel. I think the old top sites panel had a tap gesture for this.
  • Since we're not hiding the keyboard when the user scrolls, when reaching the bottom of the panel, there are still items to be scrolled that are hidden behind the keyboard. We should inset the table view to handle the new viewport when the keyboard is up. We have used the KeyboardHelper class in the past to handle that but that's kind of janky. The best way of handling this is to actually convert the panel to a UITableViewController if possible. It will handle all of this for free!
  • Missing highlight tap states for the TopSiteItems
  • Probably noticed already but the background colors of the top site items keeps changing whenever I swipe between pages.

@sleroux
Copy link

sleroux commented Aug 25, 2016

@farhanpatel @bkmunar Back to you guys! I would normally add a feedback+ flag but this PR is on 3 different bugs so I'll just say it here.

@farhanpatel
Copy link
Contributor Author

@sleroux Should be ready to go!

I dont think the keyboard should be hidden when scrolling AS. Imagine these cases

Open new tab -> Tap url bar -> (you decide to search through AS.) ->you dont find what you are looking for. -> now you gotta tap the url again to type

Although I'll leave it to bbell to decide once he gets to play with it.

@farhanpatel
Copy link
Contributor Author

farhanpatel commented Aug 31, 2016

I cleaned up the naming a bit. Renamed ASHorizontalScrollCellSource to ASHorizontalScrollCellManager I didnt want to split it up into delegate/datasource because combined its only 60 lines and not that complicated.

Also renamed ASHorizontalDelegate to ASHorizontalLayoutDelegate to signify that its really just a few helper methods used by the layout.

When I get to phase two I'll reevaluate the naming. According to the mocks there are places I can reuse ASHorizontalScrollCellManager. I'll refactor and make it more generic at that time.

tableView.delegate = self
tableView.dataSource = self
tableView.rowHeight = UITableViewAutomaticDimension
tableView.separatorInset = UIEdgeInsetsZero
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: UIEdgeInsets.zero swift style

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Do Not Merge ⛔️ This issue is a work in progress and is not ready to land
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants