Commit 54bafaab authored by nicholss's avatar nicholss Committed by Commit bot

Use an Action Sheet and target the FAB.

Talked with Jon and there are no mocks for what the menu should look like, so I did enough to make the menu work on iPad but that is it. Going to wait until we gets some screens for design to finish the menu but for now this will allow us to continue work.

R=Yuweih@chromium.org

Review-Url: https://codereview.chromium.org/2885103002
Cr-Commit-Position: refs/heads/master@{#473683}
parent a5e9a128
...@@ -207,14 +207,13 @@ static const CGFloat kKeyboardAnimationTime = 0.3; ...@@ -207,14 +207,13 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
// more options. This is not ideal but it gets us an easy way to make a // more options. This is not ideal but it gets us an easy way to make a
// modal window option selector. Replace this with a real menu later. // modal window option selector. Replace this with a real menu later.
UIAlertController* alert = UIAlertController* alert = [UIAlertController
[UIAlertController alertControllerWithTitle:@"Remote Settings" alertControllerWithTitle:@"Remote Settings"
message:nil message:nil
preferredStyle:UIAlertControllerStyleAlert]; preferredStyle:UIAlertControllerStyleActionSheet];
if ([self isKeyboardActive]) { if ([self isKeyboardActive]) {
void (^hideKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) { void (^hideKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) {
NSLog(@"Will hide keyboard.");
[self hideKeyboard]; [self hideKeyboard];
}; };
[alert addAction:[UIAlertAction actionWithTitle:@"Hide Keyboard" [alert addAction:[UIAlertAction actionWithTitle:@"Hide Keyboard"
...@@ -222,7 +221,6 @@ static const CGFloat kKeyboardAnimationTime = 0.3; ...@@ -222,7 +221,6 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
handler:hideKeyboardHandler]]; handler:hideKeyboardHandler]];
} else { } else {
void (^showKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) { void (^showKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) {
NSLog(@"Will show keyboard.");
[self showKeyboard]; [self showKeyboard];
}; };
[alert addAction:[UIAlertAction actionWithTitle:@"Show Keyboard" [alert addAction:[UIAlertAction actionWithTitle:@"Show Keyboard"
...@@ -251,9 +249,23 @@ static const CGFloat kKeyboardAnimationTime = 0.3; ...@@ -251,9 +249,23 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
}; };
[alert addAction:[UIAlertAction actionWithTitle:@"Disconnect" [alert addAction:[UIAlertAction actionWithTitle:@"Disconnect"
style:UIAlertActionStyleCancel style:UIAlertActionStyleDefault
handler:disconnectHandler]]; handler:disconnectHandler]];
void (^cancelHandler)(UIAlertAction*) = ^(UIAlertAction*) {
[alert dismissViewControllerAnimated:YES completion:nil];
};
[alert addAction:[UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleCancel
handler:cancelHandler]];
alert.popoverPresentationController.sourceView = self.view;
// Target the alert menu at the top middle of the FAB.
alert.popoverPresentationController.sourceRect = CGRectMake(
_floatingButton.center.x, _floatingButton.frame.origin.y, 1.0, 1.0);
alert.popoverPresentationController.permittedArrowDirections =
UIPopoverArrowDirectionDown;
[self presentViewController:alert animated:YES completion:nil]; [self presentViewController:alert animated:YES completion:nil];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment