Use a specific class for long press dialer "0" button instead of hardcoding a specific case in base class

This commit is contained in:
Gautier Pelloux-Prayer 2014-09-24 09:48:24 +02:00
parent aae8ef1aa2
commit 80b6d865c8
10 changed files with 112 additions and 28 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1072" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="DialerViewController">
@ -194,7 +194,7 @@
<outlet property="addressField" destination="4" id="249"/>
</connections>
</button>
<button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="40" userLabel="0" customClass="UIDigitButton">
<button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="40" userLabel="0" customClass="UIDigitButtonLongPlus">
<rect key="frame" x="107" y="197" width="106" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="0"/>
@ -316,6 +316,8 @@
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<resources>
@ -363,4 +365,9 @@
<image name="transfer_call_disabled.png" width="214" height="138"/>
<image name="transfer_call_over.png" width="214" height="138"/>
</resources>
</document>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="5056" systemVersion="13C1021" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1536" identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="DialerViewController">
@ -242,7 +242,7 @@
<outlet property="addressField" destination="6" id="35"/>
</connections>
</button>
<button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="10" userLabel="0" customClass="UIDigitButton">
<button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="10" userLabel="0" customClass="UIDigitButtonLongPlus">
<rect key="frame" x="107" y="197" width="106" height="54"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="0"/>
@ -350,6 +350,8 @@
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
</view>
</objects>
<resources>
@ -401,4 +403,9 @@
<image name="transfer_call_disabled.png" width="371" height="170"/>
<image name="transfer_call_over.png" width="371" height="170"/>
</resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>

View file

@ -22,7 +22,7 @@
#import "UILongTouchButton.h"
@interface UIDigitButton : UILongTouchButton<UILongTouchButtonDelegate> {
@interface UIDigitButton : UILongTouchButton {
}
@property (nonatomic, retain) IBOutlet UITextField* addressField;

View file

@ -91,17 +91,4 @@
linphone_core_stop_dtmf([LinphoneManager getLc]);
}
#pragma mark - UILongTouchButtonDelegate Functions
- (void)onRepeatTouch {
}
- (void)onLongTouch {
if (digit == '0') {
NSString* newAddress = [[addressField.text substringToIndex: [addressField.text length]-1] stringByAppendingString:@"+"];
[addressField setText:newAddress];
}
}
@end

View file

@ -0,0 +1,29 @@
/* UIDigitButton.h
*
* Copyright (C) 2011 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <UIKit/UIKit.h>
#import "UIDigitButton.h"
@interface UIDigitButtonLongPlus : UIDigitButton {
}
@end

View file

@ -0,0 +1,34 @@
/* UIDigitButton.m
*
* Copyright (C) 2011 Belledonne Comunications, Grenoble, France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import "UIDigitButtonLongPlus.h"
@implementation UIDigitButtonLongPlus
#pragma mark - UILongTouchButtonDelegate Functions
- (void)onRepeatTouch {
}
- (void)onLongTouch {
NSString* newAddress = [[self.addressField.text substringToIndex: [self.addressField.text length]-1] stringByAppendingString:@"+"];
[self.addressField setText:newAddress];
}
@end

View file

@ -0,0 +1,12 @@
//
// UIPlusDigitButton.m
// linphone
//
// Created by Gautier Pelloux-Prayer on 24/09/14.
//
//
#import <Foundation/Foundation.h>
@interface UIDigitButton : UILongTouchButton {
}

View file

@ -203,6 +203,8 @@
57F005C915EE2D9200914747 /* linphonerc-factory in Resources */ = {isa = PBXBuildFile; fileRef = 57F005C615EE2D9200914747 /* linphonerc-factory */; };
57F005CA15EE2D9200914747 /* linphonerc-factory~ipad in Resources */ = {isa = PBXBuildFile; fileRef = 57F005C715EE2D9200914747 /* linphonerc-factory~ipad */; };
57F005CB15EE2D9200914747 /* linphonerc-factory~ipad in Resources */ = {isa = PBXBuildFile; fileRef = 57F005C715EE2D9200914747 /* linphonerc-factory~ipad */; };
631C4FB119D2A8F2004BFE77 /* UIDigitButtonLongPlus.m in Sources */ = {isa = PBXBuildFile; fileRef = 631C4FB019D2A8F2004BFE77 /* UIDigitButtonLongPlus.m */; };
631C4FB219D2A8F2004BFE77 /* UIDigitButtonLongPlus.m in Sources */ = {isa = PBXBuildFile; fileRef = 631C4FB019D2A8F2004BFE77 /* UIDigitButtonLongPlus.m */; };
70571E1A13FABCB000CDD3C2 /* rootca.pem in Resources */ = {isa = PBXBuildFile; fileRef = 70571E1913FABCB000CDD3C2 /* rootca.pem */; };
7066FC0C13E830E400EFC6DC /* libvpx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7066FC0B13E830E400EFC6DC /* libvpx.a */; };
70E542F313E147E3002BA2C0 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 70E542F213E147E3002BA2C0 /* OpenGLES.framework */; };
@ -1645,6 +1647,8 @@
57F005C315EE2CCF00914747 /* linphonerc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = linphonerc; path = Resources/linphonerc; sourceTree = "<group>"; };
57F005C615EE2D9200914747 /* linphonerc-factory */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "linphonerc-factory"; path = "Resources/linphonerc-factory"; sourceTree = "<group>"; };
57F005C715EE2D9200914747 /* linphonerc-factory~ipad */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "linphonerc-factory~ipad"; path = "Resources/linphonerc-factory~ipad"; sourceTree = "<group>"; };
631C4FAF19D2A8F2004BFE77 /* UIDigitButtonLongPlus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIDigitButtonLongPlus.h; sourceTree = "<group>"; };
631C4FB019D2A8F2004BFE77 /* UIDigitButtonLongPlus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIDigitButtonLongPlus.m; sourceTree = "<group>"; };
70571E1913FABCB000CDD3C2 /* rootca.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rootca.pem; path = "liblinphone-sdk/apple-darwin/share/linphone/rootca.pem"; sourceTree = "<group>"; };
7066FC0B13E830E400EFC6DC /* libvpx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvpx.a; path = "liblinphone-sdk/apple-darwin/lib/libvpx.a"; sourceTree = "<group>"; };
70E542F213E147E3002BA2C0 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
@ -2718,6 +2722,8 @@
D381881815FE3F7F00C3EDCA /* UIContactDetailsHeader.xib */,
2248E90C12F7E4CF00220D9C /* UIDigitButton.h */,
2248E90D12F7E4CF00220D9C /* UIDigitButton.m */,
631C4FAF19D2A8F2004BFE77 /* UIDigitButtonLongPlus.h */,
631C4FB019D2A8F2004BFE77 /* UIDigitButtonLongPlus.m */,
D3C6526515AC1A8F0092A874 /* UIEditableTableViewCell.h */,
D3C6526615AC1A8F0092A874 /* UIEditableTableViewCell.m */,
22BB1A67132FF16A005CD7AA /* UIEraseButton.h */,
@ -2750,18 +2756,18 @@
D354981E1587716B000081D8 /* UIStateBar.h */,
D354981F1587716B000081D8 /* UIStateBar.m */,
D35498201587716B000081D8 /* UIStateBar.xib */,
F03CA84118C72F1A0008889D /* UITextViewNoDefine.h */,
F03CA84218C72F1A0008889D /* UITextViewNoDefine.m */,
D32648421588F6FA00930C67 /* UIToggleButton.h */,
D32648431588F6FB00930C67 /* UIToggleButton.m */,
D3196D3C15A32BD7007FEEBA /* UITransferButton.h */,
D3196D3D15A32BD8007FEEBA /* UITransferButton.m */,
F066515317F9A02E0064280C /* UITransparentTVCell.h */,
F066515417F9A02E0064280C /* UITransparentTVCell.m */,
D32460E4159D9AAD00BA7F3A /* UITransparentView.h */,
D32460E5159D9AAD00BA7F3A /* UITransparentView.m */,
340751E5150F38FC00B89C47 /* UIVideoButton.h */,
340751E6150F38FD00B89C47 /* UIVideoButton.m */,
F066515317F9A02E0064280C /* UITransparentTVCell.h */,
F066515417F9A02E0064280C /* UITransparentTVCell.m */,
F03CA84118C72F1A0008889D /* UITextViewNoDefine.h */,
F03CA84218C72F1A0008889D /* UITextViewNoDefine.m */,
);
path = LinphoneUI;
sourceTree = "<group>";
@ -4957,6 +4963,7 @@
1D3623260D0F684500981E51 /* LinphoneAppDelegate.m in Sources */,
22F2508E107141E100AC9B3F /* DialerViewController.m in Sources */,
22E0A822111C44E100B04932 /* AboutViewController.m in Sources */,
631C4FB119D2A8F2004BFE77 /* UIDigitButtonLongPlus.m in Sources */,
22E0A824111C44E100B04932 /* ConsoleViewController.m in Sources */,
2248E90E12F7E4CF00220D9C /* UIDigitButton.m in Sources */,
2214EB7A12F846B1002A5394 /* UICallButton.m in Sources */,
@ -5056,6 +5063,7 @@
22D8F145147548E2008C97DB /* LinphoneAppDelegate.m in Sources */,
22D8F146147548E2008C97DB /* DialerViewController.m in Sources */,
22D8F14A147548E2008C97DB /* AboutViewController.m in Sources */,
631C4FB219D2A8F2004BFE77 /* UIDigitButtonLongPlus.m in Sources */,
22D8F14B147548E2008C97DB /* ConsoleViewController.m in Sources */,
22D8F14C147548E2008C97DB /* UIDigitButton.m in Sources */,
22D8F14E147548E2008C97DB /* UICallButton.m in Sources */,

@ -1 +1 @@
Subproject commit 20985f63cb691f7ea0bdf9ccf7d5cbfda055e060
Subproject commit 489f375fb391cb70d82b56f509c39cbf7fa0b706

@ -1 +1 @@
Subproject commit e9f7b4487464909a786b156b149de7769d1df3a2
Subproject commit 91eaa6ac0b493057b18ec189d8823e45919fb51c