Fixed settings button margin in home view controller, also fixes land scape button image glitch.

pull/1/head
Óscar Morales Vivó 7 years ago committed by Michael Kirk
parent 219d2bd9dd
commit 24f30e015a

@ -446,41 +446,11 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
if (self.homeViewMode != HomeViewMode_Inbox) {
return;
}
const CGFloat kBarButtonSize = 44;
// We use UIButtons with [UIBarButtonItem initWithCustomView:...] instead of
// UIBarButtonItem in order to ensure that these buttons are spaced tightly.
// The contents of the navigation bar are cramped in this view.
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *image = [[UIImage imageNamed:@"button_settings_white"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
button.tintColor = UIColor.ows_navbarIconColor;
[button setImage:image forState:UIControlStateNormal];
UIEdgeInsets imageEdgeInsets = UIEdgeInsetsZero;
// We normally would want to use left and right insets that ensure the button
// is square and the icon is centered. However UINavigationBar doesn't offer us
// control over the margins and spacing of its content, and the buttons end up
// too far apart and too far from the edge of the screen. So we use a smaller
// leading inset tighten up the layout.
CGFloat hInset = round((kBarButtonSize - image.size.width) * 0.5f);
if (CurrentAppContext().isRTL) {
imageEdgeInsets.right = hInset;
imageEdgeInsets.left = round((kBarButtonSize - (image.size.width + hInset)) * 0.5f);
} else {
imageEdgeInsets.left = hInset;
imageEdgeInsets.right = round((kBarButtonSize - (image.size.width + hInset)) * 0.5f);
}
imageEdgeInsets.top = round((kBarButtonSize - image.size.height) * 0.5f);
imageEdgeInsets.bottom = round(kBarButtonSize - (image.size.height + imageEdgeInsets.top));
button.imageEdgeInsets = imageEdgeInsets;
button.accessibilityLabel = CommonStrings.openSettingsButton;
[button addTarget:self action:@selector(settingsButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
button.frame = CGRectMake(0,
0,
round(image.size.width + imageEdgeInsets.left + imageEdgeInsets.right),
round(image.size.height + imageEdgeInsets.top + imageEdgeInsets.bottom));
UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] initWithCustomView:button];
settingsButton.accessibilityLabel
= NSLocalizedString(@"SETTINGS_BUTTON_ACCESSIBILITY", @"Accessibility hint for the settings button");
// Settings button.
UIImage *image = [UIImage imageNamed:@"button_settings_white"];
UIBarButtonItem *settingsButton = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:self action:@selector(settingsButtonPressed:)];
settingsButton.accessibilityLabel = CommonStrings.openSettingsButton;
self.navigationItem.leftBarButtonItem = settingsButton;
self.navigationItem.rightBarButtonItem =

@ -738,15 +738,6 @@
/* Short name for edit menu item to copy contents of media message. */
"EDIT_ITEM_COPY_ACTION" = "Copy";
/* Short name for edit menu item to delete contents of media message. */
"EDIT_ITEM_DELETE_ACTION" = "Delete";
/* Short name for edit menu item to show message metadata. */
"EDIT_ITEM_MESSAGE_METADATA_ACTION" = "Info";
/* Short name for edit menu item to save contents of media message. */
"EDIT_ITEM_SAVE_ACTION" = "Save";
/* No comment provided by engineer. */
"EDIT_TXT" = "Edit";
@ -1763,9 +1754,6 @@
/* Alert title after wrong guess for 'two-factor auth pin' reminder activity */
"REMINDER_2FA_WRONG_PIN_ALERT_TITLE" = "That is not the correct PIN.";
/* Short name for edit menu item to reply to a message. */
"REPLY_ITEM_ACTION" = "Reply";
/* No comment provided by engineer. */
"REREGISTER_FOR_PUSH" = "Re-register for push notifications";
@ -1961,9 +1949,6 @@
/* Label for the block list section of the settings view */
"SETTINGS_BLOCK_LIST_TITLE" = "Blocked";
/* Accessibility hint for the settings button */
"SETTINGS_BUTTON_ACCESSIBILITY" = "Settings";
/* Table cell label */
"SETTINGS_CALLING_HIDES_IP_ADDRESS_PREFERENCE_TITLE" = "Always Relay Calls";

Loading…
Cancel
Save