mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
UI: add border for avatar when not thumbmail
This commit is contained in:
parent
28beda18f5
commit
6b38a32b88
21 changed files with 89 additions and 87 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
|
@ -100,7 +101,7 @@
|
|||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<view hidden="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="9" userLabel="callView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="503.00000045117241"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="John Doe" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="19" id="KPa-Rm-Qni" userLabel="nameLabel">
|
||||
|
|
@ -126,16 +127,16 @@
|
|||
</accessibility>
|
||||
</imageView>
|
||||
<view hidden="YES" contentMode="scaleToFill" id="126" userLabel="video">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="503.00000045117241"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" id="173" userLabel="background">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="503.00000045117241"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" id="132" userLabel="display">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="503"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="503.00000045117241"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<accessibility key="accessibilityConfiguration">
|
||||
|
|
@ -143,7 +144,7 @@
|
|||
</accessibility>
|
||||
</view>
|
||||
<view contentMode="scaleAspectFit" id="127" userLabel="preview">
|
||||
<rect key="frame" x="254" y="355" width="113" height="140"/>
|
||||
<rect key="frame" x="254.00000029960563" y="355" width="113" height="140.00000012760432"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
|
|
@ -188,7 +189,7 @@
|
|||
<color key="backgroundColor" red="0.2666666667" green="0.2666666667" blue="0.2666666667" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
<button opaque="NO" tag="24" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="7f5-7T-fV3" userLabel="pauseButton" customClass="UIPauseButton">
|
||||
<rect key="frame" x="310" y="370" width="52" height="52"/>
|
||||
<rect key="frame" x="310" y="370.00000045117241" width="52" height="52"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Pause"/>
|
||||
<state key="normal" image="pause_big_default.png">
|
||||
|
|
@ -616,10 +617,10 @@
|
|||
<image name="camera_switch_default.png" width="51" height="50"/>
|
||||
<image name="camera_switch_disabled.png" width="51" height="50"/>
|
||||
<image name="camera_switch_over.png" width="51" height="50"/>
|
||||
<image name="color_C.png" width="1" height="1"/>
|
||||
<image name="color_D.png" width="1" height="1"/>
|
||||
<image name="color_F.png" width="1" height="1"/>
|
||||
<image name="color_L.png" width="1" height="1"/>
|
||||
<image name="color_C.png" width="2" height="2"/>
|
||||
<image name="color_D.png" width="2" height="2"/>
|
||||
<image name="color_F.png" width="2" height="2"/>
|
||||
<image name="color_L.png" width="2" height="2"/>
|
||||
<image name="conference_start_default.png" width="33" height="33"/>
|
||||
<image name="conference_start_disabled.png" width="33" height="33"/>
|
||||
<image name="footer_chat_default.png" width="27" height="27"/>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#import "UICompositeView.h"
|
||||
#import "TPMultiLayoutViewController.h"
|
||||
#import "UIRoundedImageView.h"
|
||||
#include "LinphoneManager.h"
|
||||
|
||||
@protocol IncomingCallViewDelegate <NSObject>
|
||||
|
|
@ -35,7 +36,7 @@
|
|||
}
|
||||
@property(weak, nonatomic) IBOutlet UILabel *nameLabel;
|
||||
@property(nonatomic, strong) IBOutlet UILabel *addressLabel;
|
||||
@property(nonatomic, strong) IBOutlet UIImageView *avatarImage;
|
||||
@property(nonatomic, strong) IBOutlet UIRoundedImageView *avatarImage;
|
||||
@property(nonatomic, assign) LinphoneCall *call;
|
||||
@property(nonatomic, strong) id<IncomingCallViewDelegate> delegate;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,6 @@
|
|||
|
||||
@implementation CallIncomingView
|
||||
|
||||
@synthesize addressLabel;
|
||||
@synthesize avatarImage;
|
||||
@synthesize call;
|
||||
@synthesize delegate;
|
||||
|
||||
#pragma mark - ViewController Functions
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
|
@ -77,11 +72,11 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)callUpdate:(LinphoneCall *)acall state:(LinphoneCallState)astate {
|
||||
if (call == acall && (astate == LinphoneCallEnd || astate == LinphoneCallError)) {
|
||||
[delegate incomingCallAborted:call];
|
||||
if (_call == acall && (astate == LinphoneCallEnd || astate == LinphoneCallError)) {
|
||||
[_delegate incomingCallAborted:_call];
|
||||
[self dismiss];
|
||||
} else if ([LinphoneManager.instance lpConfigBoolForKey:@"auto_answer"]) {
|
||||
LinphoneCallState state = linphone_call_get_state(call);
|
||||
LinphoneCallState state = linphone_call_get_state(_call);
|
||||
if (state == LinphoneCallIncomingReceived) {
|
||||
LOGI(@"Auto answering call");
|
||||
[self onAcceptClick:nil];
|
||||
|
|
@ -98,32 +93,32 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)update {
|
||||
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
|
||||
const LinphoneAddress *addr = linphone_call_get_remote_address(_call);
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
char *uri = linphone_address_as_string_uri_only(addr);
|
||||
addressLabel.text = [NSString stringWithUTF8String:uri];
|
||||
_addressLabel.text = [NSString stringWithUTF8String:uri];
|
||||
ms_free(uri);
|
||||
avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Property Functions
|
||||
|
||||
- (void)setCall:(LinphoneCall *)acall {
|
||||
call = acall;
|
||||
- (void)setCall:(LinphoneCall *)call {
|
||||
_call = call;
|
||||
[self update];
|
||||
[self callUpdate:call state:linphone_call_get_state(call)];
|
||||
[self callUpdate:_call state:linphone_call_get_state(call)];
|
||||
}
|
||||
|
||||
#pragma mark - Action Functions
|
||||
|
||||
- (IBAction)onAcceptClick:(id)event {
|
||||
[self dismiss];
|
||||
[delegate incomingCallAccepted:call];
|
||||
[_delegate incomingCallAccepted:_call];
|
||||
}
|
||||
|
||||
- (IBAction)onDeclineClick:(id)event {
|
||||
[self dismiss];
|
||||
[delegate incomingCallDeclined:call];
|
||||
[_delegate incomingCallDeclined:_call];
|
||||
}
|
||||
|
||||
#pragma mark - TPMultiLayoutViewController Functions
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
char *uri = linphone_address_as_string_uri_only(addr);
|
||||
_addressLabel.text = [NSString stringWithUTF8String:uri];
|
||||
ms_free(uri);
|
||||
_avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ static void hideSpinner(LinphoneCall *call, void *user_data) {
|
|||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
char *uri = linphone_address_as_string_uri_only(addr);
|
||||
ms_free(uri);
|
||||
_avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#import "ChatConversationTableView.h"
|
||||
#import "ImagePickerView.h"
|
||||
#import "OrderedDictionary.h"
|
||||
#import "UIRoundedImageView.h"
|
||||
|
||||
#include "linphone/linphonecore.h"
|
||||
|
||||
|
|
@ -40,7 +41,7 @@
|
|||
@property(weak, nonatomic) IBOutlet UITextView *messageField;
|
||||
@property(nonatomic, strong) IBOutlet UIButton *sendButton;
|
||||
@property(nonatomic, strong) IBOutlet UILabel *addressLabel;
|
||||
@property(nonatomic, strong) IBOutlet UIImageView *avatarImage;
|
||||
@property(nonatomic, strong) IBOutlet UIRoundedImageView *avatarImage;
|
||||
@property(nonatomic, strong) IBOutlet UIView *headerView;
|
||||
@property(nonatomic, strong) IBOutlet UIView *chatView;
|
||||
@property(nonatomic, strong) IBOutlet UIView *messageView;
|
||||
|
|
|
|||
|
|
@ -173,8 +173,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
return;
|
||||
}
|
||||
|
||||
const LinphoneAddress *linphoneAddress = linphone_chat_room_get_peer_address(chatRoom);
|
||||
if (linphoneAddress == NULL) {
|
||||
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom);
|
||||
if (addr == NULL) {
|
||||
[PhoneMainView.instance popCurrentView];
|
||||
UIAlertView *error = [[UIAlertView alloc]
|
||||
initWithTitle:NSLocalizedString(@"Invalid SIP address", nil)
|
||||
|
|
@ -187,9 +187,9 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[error show];
|
||||
return;
|
||||
}
|
||||
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:linphoneAddress];
|
||||
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
|
||||
_addressLabel.accessibilityValue = _addressLabel.text;
|
||||
_avatarImage.image = [FastAddressBook imageForAddress:linphoneAddress thumbnail:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:YES] bordered:NO withRoundedRadius:YES];
|
||||
}
|
||||
|
||||
static void message_status(LinphoneChatMessage *msg, LinphoneChatMessageState state, void *ud) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
|
|||
[PhoneMainView.instance popCurrentView];
|
||||
return;
|
||||
}
|
||||
_avatarImage.image = [FastAddressBook imageForContact:_contact thumbnail:NO];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
[_tableController setContact:_contact];
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
|
|||
_contact = NULL;
|
||||
[self resetData];
|
||||
_contact = acontact;
|
||||
_avatarImage.image = [FastAddressBook imageForContact:_contact thumbnail:NO];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:acontact];
|
||||
[_tableController setContact:_contact];
|
||||
|
||||
|
|
@ -304,6 +304,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
CFRelease(cfdata);
|
||||
|
||||
_avatarImage.image = [FastAddressBook imageForContact:_contact thumbnail:NO];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:_contact thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ static void sync_address_book(ABAddressBookRef addressBook, CFDictionaryRef info
|
|||
image = [FastAddressBook imageForContact:contact thumbnail:true];
|
||||
[avatarMap setObject:image forKey:[NSNumber numberWithInt:ABRecordGetRecordID(contact)]];
|
||||
}
|
||||
[cell.avatarImage setImage:image];
|
||||
[cell.avatarImage setImage:image bordered:NO withRoundedRadius:YES];
|
||||
[cell setContact:contact];
|
||||
[super accessoryForCell:cell atPath:indexPath];
|
||||
|
||||
|
|
|
|||
|
|
@ -23,13 +23,15 @@
|
|||
#import <AddressBook/AddressBook.h>
|
||||
#import "UICompositeView.h"
|
||||
#import "HistoryDetailsTableView.h"
|
||||
#import "UIRoundedImageView.h"
|
||||
|
||||
@interface HistoryDetailsView : UIViewController <UICompositeViewDelegate> {
|
||||
@private
|
||||
LinphoneCallLog *callLog;
|
||||
NSDateFormatter *dateFormatter;
|
||||
}
|
||||
@property(weak, nonatomic) IBOutlet UILabel *contactLabel;
|
||||
@property(nonatomic, strong) IBOutlet UIImageView *avatarImage;
|
||||
@property(nonatomic, strong) IBOutlet UIRoundedImageView *avatarImage;
|
||||
@property(nonatomic, strong) IBOutlet UILabel *addressLabel;
|
||||
@property(nonatomic, strong) IBOutlet UIButton *addContactButton;
|
||||
@property(nonatomic, copy, setter=setCallLogId:) NSString *callLogId;
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
ABRecordRef contact = [FastAddressBook getContactWithAddress:addr];
|
||||
_addContactButton.hidden = (contact != nil);
|
||||
[ContactDisplay setDisplayNameLabel:_contactLabel forAddress:addr];
|
||||
_avatarImage.image = [FastAddressBook imageForContact:contact thumbnail:NO];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:contact thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
char *addrURI = linphone_address_as_string_uri_only(addr);
|
||||
_addressLabel.text = [NSString stringWithUTF8String:addrURI];
|
||||
ms_free(addrURI);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
|
||||
_avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:YES] bordered:NO withRoundedRadius:YES];
|
||||
|
||||
_durationLabel.text = [LinphoneUtils durationForCall:linphone_core_get_current_call([LinphoneManager getLc])];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
const LinphoneAddress *addr = linphone_call_get_remote_address(call);
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forAddress:addr];
|
||||
|
||||
_avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
|
||||
_durationLabel.text = [LinphoneUtils durationForCall:linphone_core_get_current_call([LinphoneManager getLc])];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
|
|
@ -72,11 +72,11 @@
|
|||
<rect key="frame" x="24" y="59" width="274" height="12"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" id="GmN-7v-uuO" userLabel="imageSubView">
|
||||
<rect key="frame" x="48" y="91" width="274" height="32"/>
|
||||
<rect key="frame" x="48" y="91" width="274" height="32.000000029802322"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" id="USm-wC-GvG" userLabel="transferProgress">
|
||||
|
|
@ -84,7 +84,7 @@
|
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
</progressView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="N75-gL-R6t" userLabel="transferButton" customClass="UIRoundBorderedButton">
|
||||
<rect key="frame" x="75" y="4" width="124" height="27"/>
|
||||
<rect key="frame" x="75" y="4.0000000298023224" width="124" height="27"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<state key="normal" title="DOWNLOAD">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
</connections>
|
||||
</button>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="6dl-Nz-rdv" userLabel="cancelButton" customClass="UIRoundBorderedButton">
|
||||
<rect key="frame" x="75" y="4" width="124" height="27"/>
|
||||
<rect key="frame" x="75" y="4.0000000298023224" width="124" height="27"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<state key="normal" title="CANCEL">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
<resources>
|
||||
<image name="avatar.png" width="255" height="255"/>
|
||||
<image name="chat_message_inprogress.png" width="11" height="12"/>
|
||||
<image name="color_A.png" width="1" height="1"/>
|
||||
<image name="color_A.png" width="2" height="2"/>
|
||||
<image name="splashscreen.png" width="181" height="165"/>
|
||||
</resources>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
|
|
|
|||
|
|
@ -110,7 +110,9 @@
|
|||
[LinphoneUtils setSelfAvatar:_avatarImage];
|
||||
} else {
|
||||
ABRecordRef contact = [FastAddressBook getContactWithAddress:linphone_chat_message_get_peer_address(_message)];
|
||||
_avatarImage.image = [FastAddressBook imageForContact:contact thumbnail:YES];
|
||||
[_avatarImage setImage:[FastAddressBook imageForContact:contact thumbnail:YES]
|
||||
bordered:NO
|
||||
withRoundedRadius:YES];
|
||||
}
|
||||
_backgroundColorImage.image = _bottomBarColor.image =
|
||||
[UIImage imageNamed:(outgoing ? @"color_A.png" : @"color_D.png")];
|
||||
|
|
|
|||
|
|
@ -24,11 +24,6 @@
|
|||
|
||||
@implementation UIChatCell
|
||||
|
||||
@synthesize avatarImage;
|
||||
@synthesize addressLabel;
|
||||
@synthesize chatContentLabel;
|
||||
@synthesize unreadCountButton;
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
- (id)initWithIdentifier:(NSString *)identifier {
|
||||
|
|
@ -55,12 +50,12 @@
|
|||
#pragma mark -
|
||||
|
||||
- (NSString *)accessibilityValue {
|
||||
if (chatContentLabel.text) {
|
||||
return [NSString stringWithFormat:@"%@ - %@ (%li)", addressLabel.text, chatContentLabel.text,
|
||||
(long)[unreadCountButton.titleLabel.text integerValue]];
|
||||
if (_chatContentLabel.text) {
|
||||
return [NSString stringWithFormat:@"%@ - %@ (%li)", _addressLabel.text, _chatContentLabel.text,
|
||||
(long)[_unreadCountButton.titleLabel.text integerValue]];
|
||||
} else {
|
||||
return [NSString
|
||||
stringWithFormat:@"%@ (%li)", addressLabel.text, (long)[unreadCountButton.titleLabel.text integerValue]];
|
||||
stringWithFormat:@"%@ (%li)", _addressLabel.text, (long)[_unreadCountButton.titleLabel.text integerValue]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -70,8 +65,8 @@
|
|||
return;
|
||||
}
|
||||
const LinphoneAddress *addr = linphone_chat_room_get_peer_address(chatRoom);
|
||||
[ContactDisplay setDisplayNameLabel:addressLabel forAddress:addr];
|
||||
avatarImage.image = [FastAddressBook imageForAddress:addr thumbnail:NO];
|
||||
[ContactDisplay setDisplayNameLabel:_addressLabel forAddress:addr];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:NO] bordered:YES withRoundedRadius:YES];
|
||||
|
||||
LinphoneChatMessage *last_message = linphone_chat_room_get_user_data(chatRoom);
|
||||
if (last_message) {
|
||||
|
|
@ -80,7 +75,7 @@
|
|||
const LinphoneContent *last_content = linphone_chat_message_get_file_transfer_information(last_message);
|
||||
// Last message was a file transfer (image) so display a picture...
|
||||
if (url || last_content) {
|
||||
chatContentLabel.text = @"🗻";
|
||||
_chatContentLabel.text = @"🗻";
|
||||
// otherwise show beginning of the text message
|
||||
} else if (text) {
|
||||
NSString *message = [NSString stringWithUTF8String:text];
|
||||
|
|
@ -88,23 +83,23 @@
|
|||
if ([message length] > 50)
|
||||
message = [[message substringToIndex:50] stringByAppendingString:@"[...]"];
|
||||
|
||||
chatContentLabel.text = message;
|
||||
_chatContentLabel.text = message;
|
||||
}
|
||||
|
||||
_chatLatestTimeLabel.text = [LinphoneUtils timeToString:linphone_chat_message_get_time(last_message)
|
||||
withStyle:NSDateFormatterShortStyle];
|
||||
_chatLatestTimeLabel.hidden = NO;
|
||||
} else {
|
||||
chatContentLabel.text = nil;
|
||||
_chatContentLabel.text = nil;
|
||||
_chatLatestTimeLabel.text = NSLocalizedString(@"Now", nil);
|
||||
}
|
||||
|
||||
int count = linphone_chat_room_get_unread_messages_count(chatRoom);
|
||||
[unreadCountButton setTitle:[NSString stringWithFormat:@"%i", count] forState:UIControlStateNormal];
|
||||
unreadCountButton.hidden = (count <= 0);
|
||||
[_unreadCountButton setTitle:[NSString stringWithFormat:@"%i", count] forState:UIControlStateNormal];
|
||||
_unreadCountButton.hidden = (count <= 0);
|
||||
|
||||
UIFont *addressFont = (count <= 0) ? [UIFont systemFontOfSize:25] : [UIFont boldSystemFontOfSize:25];
|
||||
addressLabel.font = addressFont;
|
||||
_addressLabel.font = addressFont;
|
||||
}
|
||||
|
||||
- (void)setEditing:(BOOL)editing {
|
||||
|
|
@ -117,9 +112,9 @@
|
|||
[UIView setAnimationDuration:0.3];
|
||||
}
|
||||
if (editing) {
|
||||
[unreadCountButton setAlpha:0.0f];
|
||||
[_unreadCountButton setAlpha:0.0f];
|
||||
} else {
|
||||
[unreadCountButton setAlpha:1.0f];
|
||||
[_unreadCountButton setAlpha:1.0f];
|
||||
}
|
||||
if (animated) {
|
||||
[UIView commitAnimations];
|
||||
|
|
|
|||
|
|
@ -19,11 +19,12 @@
|
|||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <AddressBook/AddressBook.h>
|
||||
#import "UIRoundedImageView.h"
|
||||
|
||||
@interface UIContactCell : UITableViewCell
|
||||
|
||||
@property(nonatomic, strong) IBOutlet UILabel *nameLabel;
|
||||
@property (nonatomic, strong) IBOutlet UIImageView *avatarImage;
|
||||
@property(nonatomic, strong) IBOutlet UIRoundedImageView *avatarImage;
|
||||
@property(weak, nonatomic) IBOutlet UIImageView *linphoneImage;
|
||||
@property (nonatomic, assign) ABRecordRef contact;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,6 @@
|
|||
|
||||
@implementation UIContactCell
|
||||
|
||||
@synthesize nameLabel;
|
||||
@synthesize avatarImage;
|
||||
@synthesize contact;
|
||||
|
||||
#pragma mark - Lifecycle Functions
|
||||
|
||||
- (id)initWithIdentifier:(NSString *)identifier {
|
||||
|
|
@ -47,9 +43,9 @@
|
|||
#pragma mark - Property Functions
|
||||
|
||||
- (void)setContact:(ABRecordRef)acontact {
|
||||
contact = acontact;
|
||||
[ContactDisplay setDisplayNameLabel:nameLabel forContact:contact];
|
||||
_linphoneImage.hidden = !([FastAddressBook contactHasValidSipDomain:contact]);
|
||||
_contact = acontact;
|
||||
[ContactDisplay setDisplayNameLabel:_nameLabel forContact:_contact];
|
||||
_linphoneImage.hidden = !([FastAddressBook contactHasValidSipDomain:_contact]);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
|
@ -63,7 +59,7 @@
|
|||
}
|
||||
|
||||
- (NSString *)accessibilityLabel {
|
||||
return nameLabel.text;
|
||||
return _nameLabel.text;
|
||||
}
|
||||
|
||||
- (void)setHighlighted:(BOOL)highlighted {
|
||||
|
|
@ -73,9 +69,9 @@
|
|||
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
|
||||
[super setHighlighted:highlighted animated:animated];
|
||||
if (highlighted) {
|
||||
[nameLabel setTextColor:[UIColor whiteColor]];
|
||||
[_nameLabel setTextColor:[UIColor whiteColor]];
|
||||
} else {
|
||||
[nameLabel setTextColor:[UIColor blackColor]];
|
||||
[_nameLabel setTextColor:[UIColor blackColor]];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,8 +95,7 @@
|
|||
_stateImage.image = image;
|
||||
|
||||
[ContactDisplay setDisplayNameLabel:displayNameLabel forAddress:addr];
|
||||
ABRecordRef contact = [FastAddressBook getContactWithAddress:addr];
|
||||
_avatarImage.image = [FastAddressBook imageForContact:contact thumbnail:TRUE];
|
||||
[_avatarImage setImage:[FastAddressBook imageForAddress:addr thumbnail:YES] bordered:NO withRoundedRadius:YES];
|
||||
}
|
||||
|
||||
- (void)setEditing:(BOOL)editing {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
@interface UIRoundedImageView : UIImageView
|
||||
|
||||
- (void) setImage:(UIImage *)image;
|
||||
- (void) setImage:(UIImage *)image withRoundedRadius:(BOOL)rounded;
|
||||
- (void)setImage:(UIImage *)image;
|
||||
- (void)setImage:(UIImage *)image bordered:(BOOL)bordered withRoundedRadius:(BOOL)rounded;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -16,22 +16,32 @@
|
|||
self = [super init];
|
||||
if (self) {
|
||||
[self setRoundRadius:TRUE];
|
||||
[self setBordered:NO];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setImage:(UIImage *)image {
|
||||
[self setImage:image withRoundedRadius:TRUE];
|
||||
[self setImage:image bordered:NO withRoundedRadius:TRUE];
|
||||
}
|
||||
|
||||
- (void)setImage:(UIImage *)image withRoundedRadius:(BOOL)rounded {
|
||||
- (void)setImage:(UIImage *)image bordered:(BOOL)bordered withRoundedRadius:(BOOL)rounded {
|
||||
[super setImage:image];
|
||||
if (image.size.width != image.size.height) {
|
||||
LOGI(@"Image is not squared (%fx%f) - cropping it", image.size.width, image.size.height);
|
||||
}
|
||||
[self setBordered:bordered];
|
||||
[self setRoundRadius:rounded];
|
||||
}
|
||||
|
||||
- (void)setBordered:(BOOL)bordered {
|
||||
if (bordered) {
|
||||
self.layer.borderWidth = 3;
|
||||
self.layer.borderColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A.png"]].CGColor;
|
||||
} else {
|
||||
self.layer.borderWidth = 0;
|
||||
}
|
||||
}
|
||||
// warning: for non-squared image, this function will generate an ellipsoidal image, not a round image!
|
||||
- (void)setRoundRadius:(BOOL)radius {
|
||||
CALayer *imageLayer = self.layer;
|
||||
|
|
@ -40,7 +50,6 @@
|
|||
CGFloat roundRadius = height > width ? width / 2 : height / 2;
|
||||
|
||||
[imageLayer setCornerRadius:roundRadius];
|
||||
[imageLayer setBorderWidth:0];
|
||||
[imageLayer setMasksToBounds:YES];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue