Send button disabled color and dynamically sized
Using upstream button and change notification allows us to delete some code. // FREEBIE
This commit is contained in:
parent
f8d65ab0f5
commit
4ccb295dbb
|
@ -146,7 +146,6 @@
|
|||
A5509ECD1A69B1D600ABA4BC /* CountryCodeTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A5509ECC1A69B1D600ABA4BC /* CountryCodeTableViewCell.m */; };
|
||||
A56977911A351BC400173BF2 /* ScanIdentityBarcodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A569778E1A351BC400173BF2 /* ScanIdentityBarcodeViewController.m */; };
|
||||
A56977921A351BC400173BF2 /* PresentIdentityQRCodeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A569778F1A351BC400173BF2 /* PresentIdentityQRCodeViewController.m */; };
|
||||
A5988A811A8A70D0002AD6BE /* UIButton+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = A5988A801A8A70D0002AD6BE /* UIButton+OWS.m */; };
|
||||
A5D0699B1A50E9CB004CB540 /* ShowGroupMembersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A5D069991A50E9CB004CB540 /* ShowGroupMembersViewController.m */; };
|
||||
A5E9D4BB1A65FAD800E4481C /* TSVideoAttachmentAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = A5E9D4B91A65FAD800E4481C /* TSVideoAttachmentAdapter.m */; };
|
||||
AD41D7B51A6F6F0600241130 /* play_button.png in Resources */ = {isa = PBXBuildFile; fileRef = AD41D7B31A6F6F0600241130 /* play_button.png */; };
|
||||
|
@ -342,7 +341,6 @@
|
|||
B660F7701C29988E00687D6E /* FLAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = B68EF9B71C0B1EBD009C3DCD /* FLAnimatedImage.m */; };
|
||||
B660F7711C29988E00687D6E /* FLAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = B68EF9B91C0B1EBD009C3DCD /* FLAnimatedImageView.m */; };
|
||||
B660F7721C29988E00687D6E /* AppStoreRating.m in Sources */ = {isa = PBXBuildFile; fileRef = B6DA6B061B8A2F9A00CA6F98 /* AppStoreRating.m */; };
|
||||
B660F7731C29988E00687D6E /* UIButton+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = A5988A801A8A70D0002AD6BE /* UIButton+OWS.m */; };
|
||||
B660F7741C29988E00687D6E /* DJWActionSheet+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = A547DD721A70A87800103EC7 /* DJWActionSheet+OWS.m */; };
|
||||
B660F7751C29988E00687D6E /* UIColor+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B31A24F3880007FB87 /* UIColor+OWS.m */; };
|
||||
B660F7761C29988E00687D6E /* UIFont+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B61A24F6730007FB87 /* UIFont+OWS.m */; };
|
||||
|
@ -754,8 +752,6 @@
|
|||
A569778E1A351BC400173BF2 /* ScanIdentityBarcodeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanIdentityBarcodeViewController.m; sourceTree = "<group>"; };
|
||||
A569778F1A351BC400173BF2 /* PresentIdentityQRCodeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PresentIdentityQRCodeViewController.m; sourceTree = "<group>"; };
|
||||
A56977901A351BC400173BF2 /* PresentIdentityQRCodeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentIdentityQRCodeViewController.h; sourceTree = "<group>"; };
|
||||
A5988A7F1A8A70D0002AD6BE /* UIButton+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIButton+OWS.h"; path = "util/UIButton+OWS.h"; sourceTree = "<group>"; };
|
||||
A5988A801A8A70D0002AD6BE /* UIButton+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIButton+OWS.m"; path = "util/UIButton+OWS.m"; sourceTree = "<group>"; };
|
||||
A5D069991A50E9CB004CB540 /* ShowGroupMembersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ShowGroupMembersViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
|
||||
A5D0699A1A50E9CB004CB540 /* ShowGroupMembersViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShowGroupMembersViewController.h; sourceTree = "<group>"; };
|
||||
A5E9D4B91A65FAD800E4481C /* TSVideoAttachmentAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSVideoAttachmentAdapter.m; sourceTree = "<group>"; };
|
||||
|
@ -2246,8 +2242,6 @@
|
|||
FCFA64B11A24F29E0007FB87 /* UI Categories */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A5988A7F1A8A70D0002AD6BE /* UIButton+OWS.h */,
|
||||
A5988A801A8A70D0002AD6BE /* UIButton+OWS.m */,
|
||||
A547DD731A70A87800103EC7 /* DJWActionSheet+OWS.h */,
|
||||
A547DD721A70A87800103EC7 /* DJWActionSheet+OWS.m */,
|
||||
FCFA64B21A24F3880007FB87 /* UIColor+OWS.h */,
|
||||
|
@ -2629,7 +2623,6 @@
|
|||
B6B9ECFC198B31BA00C620D3 /* PushManager.m in Sources */,
|
||||
76EB05D618170B33006006FC /* ZrtpResponder.m in Sources */,
|
||||
B62D53F71A23CCAD009AAF82 /* TSMessageAdapter.m in Sources */,
|
||||
A5988A811A8A70D0002AD6BE /* UIButton+OWS.m in Sources */,
|
||||
FCD274EB1A5AFDDB00202277 /* AboutTableViewController.m in Sources */,
|
||||
E197B61618BBEC1A00F073E5 /* StretchFactorController.m in Sources */,
|
||||
FCFD257F1A154B2C00F4C644 /* RegistrationViewController.m in Sources */,
|
||||
|
@ -2909,7 +2902,6 @@
|
|||
B660F7701C29988E00687D6E /* FLAnimatedImage.m in Sources */,
|
||||
B660F7711C29988E00687D6E /* FLAnimatedImageView.m in Sources */,
|
||||
B660F7721C29988E00687D6E /* AppStoreRating.m in Sources */,
|
||||
B660F7731C29988E00687D6E /* UIButton+OWS.m in Sources */,
|
||||
B660F7741C29988E00687D6E /* DJWActionSheet+OWS.m in Sources */,
|
||||
B660F7751C29988E00687D6E /* UIColor+OWS.m in Sources */,
|
||||
B660F7761C29988E00687D6E /* UIFont+OWS.m in Sources */,
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
//
|
||||
// UIButton+OWS.h
|
||||
// Signal
|
||||
//
|
||||
// Created by Christine Corbett Moran on 2/10/15.
|
||||
// Copyright (c) 2013 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UIButton (OWS)
|
||||
|
||||
+ (UIButton *)ows_blueButtonWithTitle:(NSString *)title;
|
||||
|
||||
@end
|
|
@ -1,37 +0,0 @@
|
|||
//
|
||||
// UIButton+OWS.m
|
||||
// Signal
|
||||
//
|
||||
// Created by Christine Corbett Moran on 2/10/15.
|
||||
// Copyright (c) 2013 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIButton+OWS.h"
|
||||
#import "UIColor+OWS.h"
|
||||
#import "UIFont+OWS.h"
|
||||
@implementation UIButton (OWS)
|
||||
|
||||
+ (UIButton *)ows_blueButtonWithTitle:(NSString *)title {
|
||||
NSDictionary *buttonTextAttributes = @{
|
||||
NSFontAttributeName : [UIFont ows_regularFontWithSize:15.0f],
|
||||
NSForegroundColorAttributeName : [UIColor ows_materialBlueColor]
|
||||
};
|
||||
UIButton *button = [[UIButton alloc] init];
|
||||
NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:title];
|
||||
[attributedTitle setAttributes:buttonTextAttributes range:NSMakeRange(0, [attributedTitle length])];
|
||||
[button setAttributedTitle:attributedTitle forState:UIControlStateNormal];
|
||||
|
||||
NSDictionary *disabledAttributes = @{
|
||||
NSFontAttributeName : [UIFont ows_regularFontWithSize:15.0f],
|
||||
NSForegroundColorAttributeName : [UIColor ows_darkGrayColor]
|
||||
};
|
||||
NSMutableAttributedString *attributedTitleDisabled = [[NSMutableAttributedString alloc] initWithString:title];
|
||||
[attributedTitleDisabled setAttributes:disabledAttributes range:NSMakeRange(0, [attributedTitle length])];
|
||||
[button setAttributedTitle:attributedTitleDisabled forState:UIControlStateDisabled];
|
||||
|
||||
[button.titleLabel setTextAlignment:NSTextAlignmentCenter];
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
@end
|
|
@ -49,7 +49,6 @@
|
|||
#import "TSInvalidIdentityKeyErrorMessage.h"
|
||||
#import "TSMessagesManager+attachments.h"
|
||||
#import "TSMessagesManager+sendMessages.h"
|
||||
#import "UIButton+OWS.h"
|
||||
#import "UIFont+OWS.h"
|
||||
#import "UIUtil.h"
|
||||
|
||||
|
@ -93,7 +92,6 @@ typedef enum : NSUInteger {
|
|||
@property (nonatomic, strong) TSVideoAttachmentAdapter *currentMediaAdapter;
|
||||
|
||||
@property (nonatomic, retain) NSTimer *readTimer;
|
||||
@property (nonatomic, retain) UIButton *messageButton;
|
||||
@property (nonatomic, retain) UIButton *attachButton;
|
||||
|
||||
@property (nonatomic, retain) NSIndexPath *lastDeliveredMessageIndexPath;
|
||||
|
@ -187,10 +185,6 @@ typedef enum : NSUInteger {
|
|||
[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(toggleContactPhone)];
|
||||
_toggleContactPhoneDisplay.numberOfTapsRequired = 1;
|
||||
|
||||
_messageButton = [UIButton ows_blueButtonWithTitle:NSLocalizedString(@"SEND_BUTTON_TITLE", @"")];
|
||||
_messageButton.enabled = NO;
|
||||
_messageButton.titleLabel.adjustsFontSizeToFitWidth = YES;
|
||||
|
||||
_attachButton = [[UIButton alloc] init];
|
||||
[_attachButton setFrame:CGRectMake(0,
|
||||
0,
|
||||
|
@ -252,8 +246,16 @@ typedef enum : NSUInteger {
|
|||
|
||||
- (void)initializeTextView {
|
||||
[self.inputToolbar.contentView.textView setFont:[UIFont ows_dynamicTypeBodyFont]];
|
||||
self.inputToolbar.contentView.leftBarButtonItem = _attachButton;
|
||||
self.inputToolbar.contentView.rightBarButtonItem = _messageButton;
|
||||
|
||||
self.inputToolbar.contentView.leftBarButtonItem = self.attachButton;
|
||||
|
||||
UILabel *sendLabel = self.inputToolbar.contentView.rightBarButtonItem.titleLabel;
|
||||
// override superclass translations since we support more translations than upstream.
|
||||
sendLabel.text = NSLocalizedString(@"SEND_BUTTON_TITLE", nil);
|
||||
sendLabel.font = [UIFont ows_regularFontWithSize:17.0f];
|
||||
sendLabel.textColor = [UIColor ows_materialBlueColor];
|
||||
sendLabel.textAlignment = NSTextAlignmentCenter;
|
||||
|
||||
self.inputToolbar.contentView.textView.layer.cornerRadius = 4.f;
|
||||
}
|
||||
|
||||
|
@ -681,13 +683,6 @@ typedef enum : NSUInteger {
|
|||
return !(isGroupConversation || [((TSContactThread *)self.thread).contactIdentifier isEqualToString:[TSAccountManager localNumber]]);
|
||||
}
|
||||
|
||||
- (void)textViewDidChange:(UITextView *)textView {
|
||||
if ([textView.text length] > 0) {
|
||||
self.inputToolbar.contentView.rightBarButtonItem.enabled = YES;
|
||||
} else {
|
||||
self.inputToolbar.contentView.rightBarButtonItem.enabled = NO;
|
||||
}
|
||||
}
|
||||
#pragma mark - JSQMessagesViewController method overrides
|
||||
|
||||
- (void)didPressSendButton:(UIButton *)button
|
||||
|
|
Loading…
Reference in New Issue