Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Unified Diff: remoting/ios/app/host_view_controller.mm

Issue 2885103002: [CRD iOS] Use an Action Sheet and target the FAB. (Closed)
Patch Set: Clean up magic numbers. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/ios/app/host_view_controller.mm
diff --git a/remoting/ios/app/host_view_controller.mm b/remoting/ios/app/host_view_controller.mm
index f46fee1bb98a9fbb5bf8e1c534d338b1d5b0d54d..44144c65b45a6669d6971dbc543bb97c7c3133a3 100644
--- a/remoting/ios/app/host_view_controller.mm
+++ b/remoting/ios/app/host_view_controller.mm
@@ -193,14 +193,13 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
// 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.
- UIAlertController* alert =
- [UIAlertController alertControllerWithTitle:@"Remote Settings"
- message:nil
- preferredStyle:UIAlertControllerStyleAlert];
+ UIAlertController* alert = [UIAlertController
+ alertControllerWithTitle:@"Remote Settings"
+ message:nil
+ preferredStyle:UIAlertControllerStyleActionSheet];
if ([self isKeyboardActive]) {
void (^hideKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) {
- NSLog(@"Will hide keyboard.");
[self hideKeyboard];
};
[alert addAction:[UIAlertAction actionWithTitle:@"Hide Keyboard"
@@ -208,7 +207,6 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
handler:hideKeyboardHandler]];
} else {
void (^showKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) {
- NSLog(@"Will show keyboard.");
[self showKeyboard];
};
[alert addAction:[UIAlertAction actionWithTitle:@"Show Keyboard"
@@ -220,9 +218,26 @@ static const CGFloat kKeyboardAnimationTime = 0.3;
[self dismissViewControllerAnimated:YES completion:nil];
};
[alert addAction:[UIAlertAction actionWithTitle:@"Disconnect"
- style:UIAlertActionStyleCancel
+ style:UIAlertActionStyleDefault
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;
+ alert.popoverPresentationController.sourceRect =
+ CGRectMake(self.view.bounds.size.width - kFabInset -
Yuwei 2017/05/16 20:49:10 It could be easier to understand if you just do:
nicholss 2017/05/16 21:00:43 One better: alert.popoverPresentationController
Yuwei 2017/05/16 21:18:54 Yep. That's much better :)
+ _floatingButton.frame.size.width / 2.f,
+ self.view.bounds.size.height - kFabInset -
+ _floatingButton.frame.size.width,
+ 1.0, 1.0);
+
+ alert.popoverPresentationController.permittedArrowDirections =
+ UIPopoverArrowDirectionDown;
[self presentViewController:alert animated:YES completion:nil];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698