mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
rework history / checkboxes
This commit is contained in:
parent
602d4b0138
commit
cd09fa61ca
8 changed files with 110 additions and 61 deletions
|
|
@ -8,8 +8,6 @@
|
|||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="HistoryListView">
|
||||
<connections>
|
||||
<outlet property="allButton" destination="4" id="27"/>
|
||||
<outlet property="deleteButton" destination="35" id="36"/>
|
||||
<outlet property="editButton" destination="6" id="33"/>
|
||||
<outlet property="missedButton" destination="5" id="28"/>
|
||||
<outlet property="tableController" destination="18" id="26"/>
|
||||
<outlet property="view" destination="2" id="16"/>
|
||||
|
|
@ -32,25 +30,12 @@
|
|||
<rect key="frame" x="0.0" y="-1" width="375" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
</imageView>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="35" userLabel="deleteButton" customClass="UIIconButton">
|
||||
<rect key="frame" x="0.0" y="0.0" width="94" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Delete all"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
|
||||
<state key="normal" image="delete.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<state key="selected" backgroundImage="color_E.png"/>
|
||||
<connections>
|
||||
<action selector="onDeleteClick:" destination="-1" eventType="touchUpInside" id="37"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" id="38" userLabel="switchView">
|
||||
<rect key="frame" x="94" y="0.0" width="188" height="40"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="150" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="4" userLabel="allButton" customClass="UIIconButton">
|
||||
<rect key="frame" x="0.0" y="0.0" width="94" height="40"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="75" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="All contacts filter"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="16" maxX="0.0" maxY="0.0"/>
|
||||
|
|
@ -63,7 +48,7 @@
|
|||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="5" userLabel="missedButton" customClass="UIIconButton">
|
||||
<rect key="frame" x="94" y="0.0" width="94" height="40"/>
|
||||
<rect key="frame" x="75" y="0.0" width="75" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Missed contacts filter"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="16" maxX="0.0" maxY="0.0"/>
|
||||
|
|
@ -77,8 +62,49 @@
|
|||
</button>
|
||||
</subviews>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="6" userLabel="editButton" customClass="UIToggleButton">
|
||||
<rect key="frame" x="281" y="0.0" width="94" height="40"/>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="00K-MU-NUc" userLabel="cancelButton" customClass="UIIconButton">
|
||||
<rect key="frame" x="0.0" y="0.0" width="75" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Delete all"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
|
||||
<state key="normal" image="cancel_edit.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<state key="selected" backgroundImage="color_E.png"/>
|
||||
<connections>
|
||||
<action selector="onCancelClick:" destination="18" eventType="touchUpInside" id="DAX-W6-l0H"/>
|
||||
<action selector="onCancelClick:" destination="-1" eventType="touchUpInside" id="vIn-o6-Ui0"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" id="nhN-oH-LQ9" userLabel="toggleSelectionButton" customClass="UIIconButton">
|
||||
<rect key="frame" x="225" y="0.0" width="75" height="42"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Edit"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
|
||||
<state key="normal" image="select_all.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<state key="selected" image="deselect_all.png"/>
|
||||
<connections>
|
||||
<action selector="onSelectionToggle:" destination="18" eventType="touchUpInside" id="ADr-KR-SmA"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="35" userLabel="deleteButton" customClass="UIIconButton">
|
||||
<rect key="frame" x="300" y="0.0" width="75" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Delete all"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
|
||||
<state key="normal" image="delete.png">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<state key="selected" backgroundImage="color_E.png"/>
|
||||
<connections>
|
||||
<action selector="onDeleteClick:" destination="-1" eventType="touchUpInside" id="37"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="6" userLabel="editButton" customClass="UIIconButton">
|
||||
<rect key="frame" x="300" y="0.0" width="75" height="40"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<accessibility key="accessibilityConfiguration" label="Edit"/>
|
||||
<inset key="titleEdgeInsets" minX="0.0" minY="18" maxX="0.0" maxY="0.0"/>
|
||||
|
|
@ -87,7 +113,8 @@
|
|||
</state>
|
||||
<state key="selected" backgroundImage="color_E.png"/>
|
||||
<connections>
|
||||
<action selector="onEditClick:" destination="-1" eventType="touchUpInside" id="32"/>
|
||||
<action selector="onEditClick:" destination="18" eventType="touchUpInside" id="5Ft-HW-cVh"/>
|
||||
<action selector="onEditClick:" destination="-1" eventType="touchUpInside" id="7uo-X1-sO5"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
|
|
@ -110,25 +137,32 @@
|
|||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
|
||||
<point key="canvasLocation" x="245.5" y="373.5"/>
|
||||
</view>
|
||||
<tableViewController autoresizesArchivedViewToFullSize="NO" id="18" userLabel="tableController" customClass="HistoryListTableView">
|
||||
<extendedEdge key="edgesForExtendedLayout"/>
|
||||
<connections>
|
||||
<outlet property="cancelButton" destination="00K-MU-NUc" id="KSi-MC-Usk"/>
|
||||
<outlet property="deleteButton" destination="35" id="n8o-lE-u1t"/>
|
||||
<outlet property="editButton" destination="6" id="Sgc-Z3-NeQ"/>
|
||||
<outlet property="toggleSelectionButton" destination="nhN-oH-LQ9" id="77r-l0-3Yi"/>
|
||||
<outlet property="view" destination="17" id="25"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="596" y="305"/>
|
||||
</tableViewController>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="cancel_edit.png" width="29" height="29"/>
|
||||
<image name="color_E.png" width="1" height="1"/>
|
||||
<image name="color_F.png" width="1" height="1"/>
|
||||
<image name="delete.png" width="21" height="27"/>
|
||||
<image name="deselect_all.png" width="26" height="26"/>
|
||||
<image name="edit_list.png" width="29" height="28"/>
|
||||
<image name="history_all_default.png" width="32" height="31"/>
|
||||
<image name="history_all_selected.png" width="32" height="31"/>
|
||||
<image name="history_missed_default.png" width="32" height="32"/>
|
||||
<image name="history_missed_selected.png" width="32" height="32"/>
|
||||
<image name="select_all.png" width="26" height="26"/>
|
||||
</resources>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
|
|
|
|||
|
|
@ -397,7 +397,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
#pragma mark - Action Functions
|
||||
|
||||
- (IBAction)onAddContactClick:(id)event {
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeEdit];
|
||||
[ContactSelection setAddAddress:[addressField text]];
|
||||
[ContactSelection setSipFilter:nil];
|
||||
[ContactSelection setNameOrEmailFilter:nil];
|
||||
|
|
|
|||
|
|
@ -30,12 +30,11 @@
|
|||
|
||||
@property(nonatomic, strong) IBOutlet UIButton *allButton;
|
||||
@property(nonatomic, strong) IBOutlet UIButton *missedButton;
|
||||
@property(nonatomic, strong) IBOutlet UIToggleButton *editButton;
|
||||
@property(nonatomic, strong) IBOutlet UIButton *deleteButton;
|
||||
|
||||
- (IBAction)onAllClick:(id)event;
|
||||
- (IBAction)onMissedClick:(id)event;
|
||||
- (IBAction)onEditClick:(id)event;
|
||||
- (IBAction)onDeleteClick:(id)event;
|
||||
- (IBAction)onEditClick:(id)sender;
|
||||
- (IBAction)onCancelClick:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -58,9 +58,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
if ([_tableController isEditing]) {
|
||||
[_tableController setEditing:FALSE animated:FALSE];
|
||||
}
|
||||
[_deleteButton setHidden:TRUE];
|
||||
[_editButton setOff];
|
||||
[self changeView:History_All];
|
||||
[self updateTopBar];
|
||||
|
||||
// Reset missed call
|
||||
linphone_core_reset_missed_calls_count([LinphoneManager getLc]);
|
||||
|
|
@ -68,26 +67,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneCallUpdate object:self];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
[self hideEditIfNeeded];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self changeView:History_All];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)hideEditIfNeeded {
|
||||
_editButton.hidden = ([_tableController tableView:_tableController.tableView numberOfRowsInSection:0] == 0);
|
||||
if ([_editButton isSelected]) {
|
||||
[_editButton toggle];
|
||||
[self onEditClick:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)changeView:(HistoryView)view {
|
||||
if (view == History_All) {
|
||||
_allButton.selected = TRUE;
|
||||
|
|
@ -102,7 +83,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
} else {
|
||||
_missedButton.selected = FALSE;
|
||||
}
|
||||
[self hideEditIfNeeded];
|
||||
}
|
||||
|
||||
#pragma mark - Action Functions
|
||||
|
|
@ -115,9 +95,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[self changeView:History_Missed];
|
||||
}
|
||||
|
||||
- (IBAction)onEditClick:(id)event {
|
||||
[_tableController setEditing:!_tableController.isEditing animated:TRUE];
|
||||
_deleteButton.hidden = !_tableController.isEditing;
|
||||
- (void)updateTopBar {
|
||||
_allButton.hidden = _missedButton.hidden = self.tableController.isEditing;
|
||||
}
|
||||
|
||||
- (IBAction)onDeleteClick:(id)event {
|
||||
|
|
@ -125,12 +104,22 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[NSString stringWithFormat:NSLocalizedString(@"Are you sure that you want to delete %d history?", nil),
|
||||
_tableController.selectedItems.count];
|
||||
[UIConfirmationDialog ShowWithMessage:msg
|
||||
onCancelClick:nil
|
||||
onConfirmationClick:^() {
|
||||
[_tableController removeSelection];
|
||||
[_tableController loadData];
|
||||
[self hideEditIfNeeded];
|
||||
}];
|
||||
onCancelClick:^() {
|
||||
[self updateTopBar];
|
||||
}
|
||||
onConfirmationClick:^() {
|
||||
[_tableController removeSelection];
|
||||
[_tableController loadData];
|
||||
[self updateTopBar];
|
||||
}];
|
||||
}
|
||||
|
||||
- (IBAction)onEditClick:(id)sender {
|
||||
[self updateTopBar];
|
||||
}
|
||||
|
||||
- (IBAction)onCancelClick:(id)sender {
|
||||
[self updateTopBar];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -867,7 +867,7 @@ static void linphone_iphone_registration_state(LinphoneCore *lc, LinphoneProxyCo
|
|||
static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char *realm, const char *username,
|
||||
const char *domain) {
|
||||
// let the wizard handle its own errors
|
||||
if ([PhoneMainView.instance currentView] != WizardViewController.compositeViewDescription) {
|
||||
if ([PhoneMainView.instance currentView] != AssistantView.compositeViewDescription) {
|
||||
static DTAlertView *alertView = nil;
|
||||
|
||||
// avoid having multiple popups
|
||||
|
|
@ -900,7 +900,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, const char
|
|||
LOGE(@"Could not find auth info associated with %s@%s, going to settings!",
|
||||
username, domain);
|
||||
[[PhoneMainView instance]
|
||||
changeCurrentView:[SettingsViewController compositeViewDescription]];
|
||||
changeCurrentView:SettingsView.compositeViewDescription];
|
||||
}
|
||||
}];
|
||||
[alertView show];
|
||||
|
|
|
|||
|
|
@ -240,7 +240,6 @@ static NSString *const kDisappearAnimation = @"disappear";
|
|||
}
|
||||
|
||||
- (IBAction)onContactsClick:(id)event {
|
||||
[ContactSelection setSelectionMode:ContactSelectionModeNone];
|
||||
[ContactSelection setAddAddress:nil];
|
||||
[ContactSelection setSipFilter:nil];
|
||||
[ContactSelection enableEmailFilter:FALSE];
|
||||
|
|
|
|||
|
|
@ -13,11 +13,15 @@
|
|||
@property(nonatomic, readonly) NSMutableArray *selectedItems;
|
||||
@property(weak, nonatomic) IBOutlet UIButton *deleteButton;
|
||||
@property(weak, nonatomic) IBOutlet UIButton *editButton;
|
||||
@property(weak, nonatomic) IBOutlet UIButton *cancelButton;
|
||||
@property(weak, nonatomic) IBOutlet UIButton *toggleSelectionButton;
|
||||
|
||||
- (void)loadData;
|
||||
- (void)accessoryForCell:(UITableViewCell *)cell atPath:(NSIndexPath *)indexPath;
|
||||
- (void)removeSelection;
|
||||
|
||||
- (IBAction)onSelectionToggle:(id)sender;
|
||||
- (IBAction)onEditClick:(id)sender;
|
||||
- (IBAction)onCancelClick:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#import "UICheckBoxTVTableViewController.h"
|
||||
#import "Utils.h"
|
||||
|
||||
@implementation UICheckBoxTVTableViewController
|
||||
|
||||
|
|
@ -35,6 +36,11 @@
|
|||
|
||||
#pragma mark - UITableViewDelegate Functions
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
_editButton.enabled = [self tableView:self.tableView numberOfRowsInSection:0] != 0;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||
[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:NO];
|
||||
|
|
@ -76,11 +82,15 @@
|
|||
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||
}
|
||||
_deleteButton.enabled = (_selectedItems.count != 0);
|
||||
_editButton.enabled = [self tableView:self.tableView numberOfRowsInSection:0] != 0;
|
||||
}
|
||||
|
||||
- (void)setEditing:(BOOL)editing animated:(BOOL)animated {
|
||||
[super setEditing:editing animated:animated];
|
||||
|
||||
_editButton.hidden = editing;
|
||||
_deleteButton.hidden = _cancelButton.hidden = _toggleSelectionButton.hidden = !editing;
|
||||
|
||||
// when switching editing mode, we must reload all cells to remove/add checkboxes
|
||||
[self loadData];
|
||||
}
|
||||
|
|
@ -104,10 +114,25 @@
|
|||
}
|
||||
|
||||
- (void)onSelectionToggle:(id)sender {
|
||||
if (_selectedItems.count == 0) {
|
||||
[self table]
|
||||
} else {
|
||||
[_selectedItems removeAllObjects];
|
||||
UIButton *button = (UIButton *)sender;
|
||||
for (int i = 0; i < [self numberOfSectionsInTableView:self.tableView]; i++) {
|
||||
for (int j = 0; j < [self tableView:self.tableView numberOfRowsInSection:i]; j++) {
|
||||
NSIndexPath *idx = [NSIndexPath indexPathForRow:j inSection:i];
|
||||
UITableViewCell *cell = [self tableView:self.tableView cellForRowAtIndexPath:idx];
|
||||
cell.accessoryType = (button.state == UIControlStateSelected) ? UITableViewRowAnimationNone
|
||||
: UITableViewCellAccessoryCheckmark;
|
||||
[self accessoryForCell:cell atPath:idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)onEditClick:(id)sender {
|
||||
[self setEditing:YES animated:YES];
|
||||
}
|
||||
|
||||
- (IBAction)onCancelClick:(id)sender {
|
||||
[self setEditing:NO animated:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue