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

Unify UI layout #371

Closed
herzbube opened this issue Mar 20, 2022 · 2 comments
Closed

Unify UI layout #371

herzbube opened this issue Mar 20, 2022 · 2 comments
Assignees
Milestone

Comments

@herzbube
Copy link
Owner

herzbube commented Mar 20, 2022

The app currently has very different UI layouts for the three UI types.

  • Smaller iPhone devices that don't support landscape orientation (UITypePhonePortraitOnly)
  • Larger iPhone devices that do support landscape orientation (UITypePhone)
  • iPad devices that support landscape orientation (UITypePad)

A decision has been reached to unify the layouts of the three UI types as much as possible. These were the main decision drivers:

  • The effort to support three different UI layouts has become too much. This became apparent after some prototyping how to display SGF node and move annotations. Each of the three UI type has its own implementation how to display board positions. Since board positions now represent nodes, the changes that are necessary for displaying SGF node and move annotations would have to be made in three different places, proliferating the wild variety and making things even worse in the future. This is not sustainable, so the first unification goal is to have only one way of displaying board position: Using UICollectionView and BoardPositionCollectionViewCell. This means changing UITypePad (get rid of the table view based approach) and UITypePhonePortraitOnly (get rid of the alternative UICollectionView implementation that uses BoardPositionView as the cell type).
  • Once the displaying of board positions has been unified, it should be considered to also unify the way how board positions are navigated. Specifically, UITypePad and UITypePhonePortraitOnly currently have hacks that mangle UIToolBar into submission, so if possible these should start to use the custom ButtonBoxController view controller instead of a UIToolbar.
  • The layout for UITypePhone looks quite neat in my opinion, but the pain and workarounds it took to implement are pretty horrible, and not everything works 100% the way it should. Plus every time I upgrade to a new iOS version there is a new set of smaller or bigger issues that need to be fixed. Again, I am no longer willing to spend the time to support this, so I am going to switch to an UITabBarController based layout on UITypePhone. The drawback for the user is that in landscape orientation the board will have less vertical space and will therefore become smaller.
  • After switching the UITypePhone layout to use UITabBarController, it should be very similar to the UITypePad layout. There is a huge promise that the two layouts can be merged, with only minimal differences between them.
  • Layout unification provides a new chance to finally understand and support the extended layout concept introduced way back in iOS 7. This should get rid of various hacks that set edgesForExtendedLayout to UIRectEdgeNone and automaticallyAdjustsScrollViewInsets to NO.
@herzbube herzbube added this to the 1.6.1 milestone Mar 20, 2022
@herzbube herzbube self-assigned this Mar 20, 2022
herzbube added a commit that referenced this issue Mar 26, 2022
…BarController (#371)

this is a rather large commit that consists of the following changes:
- UITypePhone now uses UITabBarController.
- as a consequence UITypePhone no longer uses a main menu button (the
  "main menu" is a replacement for the navigation provided by
  UITabBarController). the changes are in RightPaneViewController. since none
  of the UI types is using a main menu any more, removal of the code that
  provides main menu support will be considered.
- in landscape orientation, UITypePhone now displays the status view at the top
  of the screen, because it doesn't look good to have it sitting just above the
  tab bar. the changes are in LeftPaneViewController.
- PlayRootViewNavigationController now has a bit of additional logic when not
  to show the navigation bar.
- extended layout is now fully supported on UIAreaPlay. this means that bars at
  the top and bottom of the screen are now properly translucent, at the top the
  navigation bar extends behind the status bar, and the root view controller
  of the UITabBarController sets the proper background color to provide a
  backdrop showing through the translucent bars.
- MainTabBarController is now the application window's root view controller,
  because extended layout support at the screen top didn't work correctly when
  a different view controller was used as the application window's root view
  controller (no specifics are available anymore, but it had to do something
  with the navigation bar at the top of the screen).
- WindowRootViewController is removed since it is no longer used. its
  responsibilities (provide interface orientation change support and owner of
  the magnifying class) are moved to MainTabBarController.
- StatusViewController now uses a container view to allow for simpler Auto
  Layout constraints.
herzbube added a commit that referenced this issue Mar 26, 2022
…371)

change details:
- in landscape orientation, no longer use BoardPositionToolbarController
  at the top of the screen in the left pane.
- in both portrait and landscape orientation, no longer use
  NavigationBarController with its three navigation bars faking a single
  bar.
  - in portrait orientation, instead use the single navigation bar
    provided by PlayRootViewNavigationController and populate its
    left/right bar button items, as well as integrate the status view as
    the navigation bar's title view.
  - in landscape orientation, instead display a button box with the game
    actions and the status view at the top of the screen in the left
    pane.
- extended layout support: PlayRootViewControllerPad now defines a
  background color to be shown behind the translucent bars at the top
  and bottom of the screen.
- LeftPaneViewController and RightPaneViewController are radically
  simplified because they now have to support only a single layout.
herzbube added a commit that referenced this issue Mar 26, 2022
…tion bar (#371)

change details
- no longer use NavigationBarController with its three navigation bars
  faking a single bar. instead use the single navigation bar provided by
  PlayRootViewNavigationController and populate its left/right bar
  button items, as well as integrate the status view as the navigation
  bar's title view.
- extended layout support: PlayRootViewControllerPortraitOnly now
  defines a background color to be shown behind the translucent bars at
  the top and bottom of the screen.
herzbube added a commit that referenced this issue Mar 26, 2022
… navigate board positions (#371)

change details:
- together with the previous commit this commit fully aligns the layout
  of UITypePhonePortraitOnly with the portrait layouts of UITypePhone
  and UITypePad
- no longer use BoardPositionToolbarController with its custom toolbar
  that alternates between buttons and a collection view. instead use the
  (by now) standard ButtonBoxController for the navigation buttons in
  combination with collection view.
- the collection view cells are no longer of type BoardPositionView,
  instead they are of type BoardPositionCollectionViewCell
- additional Auto Layout constraints are necessary to properly center
  the board view in vertical direction
herzbube added a commit that referenced this issue Mar 26, 2022
…extended layout (#371)

other improvements
- show a background for iOS versions 12.x and older
- show a grey-ish table view background color, which is aesthetically
  more pleasing than the white-ish system background color
- layout the text view with margins around it; for the manually created
  NSLayoutConstraint objects this means that they now relate to the
  system-provided layout margins guide instead of to the superview
  bottom edge
- handle multiple consecutive keyboard show/hide notifications of the
  same type; especially multiple show notifications now no longer lead
  to the text view bottom edge being incorrectly aligned
herzbube added a commit that referenced this issue Mar 26, 2022
herzbube added a commit that referenced this issue Mar 26, 2022
herzbube added a commit that referenced this issue Mar 26, 2022
herzbube added a commit that referenced this issue Mar 26, 2022
- BoardPositionView: was used on UITypePhonePortraitOnly. is replaced by
  BoardPositionCollectionViewCell.
- CurrentBoardPositionViewController: was used on
  UITypePhonePortraitOnly. no replacement.
- BoardPositionToolbarController: was used on UITypePad and
  UITypePhonePortraitOnly. no direct replacement. navigation occurs now
  via ButtonBoxController.
- BoardPositionListViewController: was used on UITypePhonePortraitOnly.
  is replaced by BoardPositionCollectionViewController.
- NavigationBarControllerPhonePortraitOnly / NavigationBarController:
  was used on UITypePad and UITypePhonePortraitOnly. no direct
  replacement. instead of faking a single navigation bar with three
  consecutive navigation bars the navigation bar displayed by
  PlayRootViewNavigationController is now used to display buttons and
  the status view.
  - one of the most recent things investigated to support extended
    layout was to set the controller as the delegate of its 3 navigation
    bars and override the UINavigationBarDelegate method positionForBar:
    to return UIBarPositionTopAttached. the goal: let the bars extend
    upwards behind the status bar. this research was abandoned when the
    UI layout unification direction was decided upon.
- NavigationBarControllerPhone: was used on UITypePhone. no direct
  replacement. the navigation bar displayed by
  PlayRootViewNavigationController is now used to display buttons and
  the status view.
- MainNavigationController: was used on UITypePhone. replaced by
  MainTabBarController.
- MainTableViewController: was used on UITypePhone. no replacement.
- MainMenuPresenter: was used on UITypePhone. no replacement.
- main menu icon resource: was used on UITypePhone. no replacement.
@herzbube
Copy link
Owner Author

herzbube commented Jun 5, 2022

A consequence of the unification effort is that in Portrait orientation the vertical space available for the board view is now slightly reduced.

For most iPhone devices this is not a problem, because for them the vertical space available is still larger than the screen width, so the screen width remains the limiting dimension for the square board view.

However, for the smallest iPhone devices that the app still supports - the iPhone 5S and the iPhone SE (640 points vertical screen size) - the reduction means that the vertical space available is now less than the screen width, so the vertical space available now becomes the limiting dimension. In practice on the affected iPhone devices for some board sizes coordinate labels and/or move numbers and label markup will no longer show up without zooming in.

herzbube added a commit that referenced this issue Sep 9, 2022
…e and UILayoutPad (#371)

as a result of the UI layout unification, both the .h and .m files of
PlayRootViewControllerPhone and PlayRootViewControllerPad were 99%
identical, line for line, so merging the two classes into one is
inevitable, although version control history of the original files is
lost by this action.

the 3 differences that existed are now encoded in the
switch-statement in the initializer of the new class
PlayRootViewControllerPhoneAndPad.
@herzbube
Copy link
Owner Author

Ready for next release, closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant