Jelajahi Sumber

1.修改Apex Mobile Detail,增加双击复制。
2.修改Apex Mobile Saved Documents,增加左滑删除。
3.修改Apex Mobile Tab History图标。

Pen Li 8 tahun lalu
induk
melakukan
6ab5870a1a

+ 10 - 0
Apex Mobile/Apex Mobile.xcodeproj/project.pbxproj

@@ -21,6 +21,8 @@
 		426E8AB9202163EC0073BA5D /* JLCustomerAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 426E8AB6202163EC0073BA5D /* JLCustomerAlertController.m */; };
 		426E8ABA202163EC0073BA5D /* JLPresentationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 426E8AB8202163EC0073BA5D /* JLPresentationController.m */; };
 		426E8ABD2021AEC50073BA5D /* JLCustomerNavigationAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = 426E8ABC2021AEC50073BA5D /* JLCustomerNavigationAlertController.m */; };
+		426F397F2033CEE80025C568 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 426F397E2033CEE80025C568 /* AudioToolbox.framework */; };
+		426F39822033D0930025C568 /* ResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 426F39812033D0930025C568 /* ResultCell.m */; };
 		427CF5D02023F5560041472A /* NewImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 427CF5CF2023F5560041472A /* NewImages.xcassets */; };
 		427CF5E0202452460041472A /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 427CF5DF202452450041472A /* Accelerate.framework */; };
 		427CF5E5202454750041472A /* GoogleMaps.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 427CF5E2202454750041472A /* GoogleMaps.framework */; };
@@ -191,6 +193,9 @@
 		426E8AB8202163EC0073BA5D /* JLPresentationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JLPresentationController.m; sourceTree = "<group>"; };
 		426E8ABB2021AEC50073BA5D /* JLCustomerNavigationAlertController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JLCustomerNavigationAlertController.h; sourceTree = "<group>"; };
 		426E8ABC2021AEC50073BA5D /* JLCustomerNavigationAlertController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JLCustomerNavigationAlertController.m; sourceTree = "<group>"; };
+		426F397E2033CEE80025C568 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
+		426F39802033D0930025C568 /* ResultCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ResultCell.h; path = ../../common/customUI/ResultCell.h; sourceTree = "<group>"; };
+		426F39812033D0930025C568 /* ResultCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ResultCell.m; path = ../../common/customUI/ResultCell.m; sourceTree = "<group>"; };
 		427994B120300E7300746EDC /* Apex Mobile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Apex Mobile.entitlements"; sourceTree = "<group>"; };
 		427CF5CF2023F5560041472A /* NewImages.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = NewImages.xcassets; sourceTree = "<group>"; };
 		427CF5DF202452450041472A /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
@@ -428,6 +433,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				426F397F2033CEE80025C568 /* AudioToolbox.framework in Frameworks */,
 				427CF5E5202454750041472A /* GoogleMaps.framework in Frameworks */,
 				427CF5E0202452460041472A /* Accelerate.framework in Frameworks */,
 				71514ED2191B7E2500009C00 /* AddressBookUI.framework in Frameworks */,
@@ -881,6 +887,7 @@
 		719EF8DF18BB839F00EFFF5F /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				426F397E2033CEE80025C568 /* AudioToolbox.framework */,
 				427CF5E1202454750041472A /* GoogleMap */,
 				427CF5DF202452450041472A /* Accelerate.framework */,
 				71514ED1191B7E2500009C00 /* AddressBookUI.framework */,
@@ -1010,6 +1017,8 @@
 				71E0D1D62022AB7E009A08EB /* FullyShowViewController.h */,
 				71E0D1D22022AB7E009A08EB /* FullyShowViewController.m */,
 				71E0D1D52022AB7E009A08EB /* Result.storyboard */,
+				426F39802033D0930025C568 /* ResultCell.h */,
+				426F39812033D0930025C568 /* ResultCell.m */,
 				71E0D1D42022AB7E009A08EB /* ResultViewController.h */,
 				71E0D1D32022AB7E009A08EB /* ResultViewController.m */,
 				71B799992021B22D00F8685E /* AMResultViewController.h */,
@@ -1193,6 +1202,7 @@
 				715643C42019B58400B04267 /* OrderHistoryViewController.m in Sources */,
 				712CBA0318CF38DB00C61394 /* RTLabel.m in Sources */,
 				71CEE3D718CC559B00052C63 /* ApexMobileNavigationController.m in Sources */,
+				426F39822033D0930025C568 /* ResultCell.m in Sources */,
 				715709922021574D00EFE5C5 /* RAConvertor.m in Sources */,
 				71BA50371908F21500D0BD31 /* HistoryData.m in Sources */,
 				71A541D418D151C70017E2BD /* WebViewController.m in Sources */,

+ 8 - 2
Apex Mobile/Apex Mobile/AMResultViewController.m

@@ -164,7 +164,13 @@
     
     if (self.params) {
 
-        self.loadingIndicator.hidden = NO;
+        if (self.loadingIndicator.hidden) {
+            self.loadingIndicator.hidden = NO;
+        }
+        
+        if (![self.loadingIndicator isAnimating]) {
+            [self.loadingIndicator startAnimating];
+        }
         
         NSMutableDictionary *dic = self.params.mutableCopy;
         switch (option) {
@@ -206,7 +212,7 @@
                 if (weakSelf) {
                     __strong typeof(weakSelf) strongSelf = weakSelf;
                     
-                    strongSelf.loadingIndicator.hidden = YES;
+                    [strongSelf.loadingIndicator stopAnimating];
                     
                     if (result == RESULT_TRUE) {
                         strongSelf.content_layout = [contentDic objectForKey:@"layout"];

+ 10 - 0
Apex Mobile/Apex Mobile/DetailCellKVNew.h

@@ -9,10 +9,20 @@
 #import <UIKit/UIKit.h>
 #import "MDHTMLLabel.h"
 #import "LineView.h"
+
+@class DetailCellKVNew;
+@protocol DetailKVCellTapDelegate <NSObject>
+
+@optional
+- (void)detailCell:(DetailCellKVNew *)cell doubleTapedForValue:(NSString *)value;
+
+@end
+
 @interface DetailCellKVNew : UITableViewCell
 
 @property (weak, nonatomic) IBOutlet MDHTMLLabel *keyLabel;
 @property (weak, nonatomic) IBOutlet MDHTMLLabel *valLabel;
 @property (weak, nonatomic) IBOutlet LineView *lineView;
+@property (nonatomic,weak) id<DetailKVCellTapDelegate> tapDelegate;
 
 @end

+ 28 - 0
Apex Mobile/Apex Mobile/DetailCellKVNew.m

@@ -8,6 +8,12 @@
 
 #import "DetailCellKVNew.h"
 
+@interface DetailCellKVNew ()
+
+@property (nonatomic,strong) UITapGestureRecognizer *tapGesture;
+
+@end
+
 @implementation DetailCellKVNew
 
 - (void)awakeFromNib {
@@ -15,10 +21,32 @@
     // Initialization code
 }
 
+- (void)willMoveToSuperview:(UIView *)newSuperview {
+    [super willMoveToSuperview:newSuperview];
+    
+    if (![self.valLabel.gestureRecognizers containsObject:self.tapGesture]) {
+        [self.valLabel addGestureRecognizer:self.tapGesture];
+    }
+}
+
 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
     [super setSelected:selected animated:animated];
 
     // Configure the view for the selected state
 }
 
+- (void)copyTap:(UITapGestureRecognizer *)gesture {
+    if (self.tapDelegate && [self.tapDelegate respondsToSelector:@selector(detailCell:doubleTapedForValue:)]) {
+        [self.tapDelegate detailCell:self doubleTapedForValue:self.valLabel.htmlText];
+    }
+}
+
+- (UITapGestureRecognizer *)tapGesture {
+    if (!_tapGesture) {
+        _tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copyTap:)];
+        _tapGesture.numberOfTapsRequired = 2;
+    }
+    return _tapGesture;
+}
+
 @end

+ 109 - 1
Apex Mobile/Apex Mobile/DetailPageViewController.m

@@ -18,7 +18,89 @@
 #import <QuickLook/QuickLook.h>
 #import "DetailCellKVNew.h"
 
-@interface DetailPageViewController () <QLPreviewControllerDataSource,QLPreviewControllerDelegate>
+@interface DetailHUD : UIView
+
+@property (nonatomic,strong) UILabel *msgLb;
+
+@end
+
+@implementation DetailHUD
+
++ (void)show:(NSString *)msg inView:(UIView *)view {
+    
+    if (!msg) {
+        return;
+    }
+    
+    DetailHUD *hud = [[DetailHUD alloc] initWithFrame:CGRectZero];
+    hud.backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.9];
+    hud.msgLb.text = msg;
+    [hud layoutSize];
+    for (UIView *sub in view.subviews) {
+        if ([sub isKindOfClass:self]) {
+            sub.hidden = YES;
+        }
+    }
+    [view addSubview:hud];
+    
+    [hud performSelector:@selector(hide) withObject:nil afterDelay:3.0f];
+}
+
+- (UILabel *)msgLb {
+    if (!_msgLb) {
+        _msgLb = [[UILabel alloc] initWithFrame:CGRectZero];
+        _msgLb.textColor = [UIColor whiteColor];
+        _msgLb.font = [UIFont systemFontOfSize:14.0f];
+    
+        [self addSubview:_msgLb];
+    }
+    return _msgLb;
+}
+
+- (void)layoutSize {
+    [self.msgLb sizeToFit];
+    CGSize size = self.msgLb.bounds.size;
+    
+    CGFloat height = size.height + 20;
+    CGFloat width = size.width + 20;
+    if (height < 30) {
+        height = 30;
+    }
+    if (width < 30) {
+        width = 30;
+    }
+    
+    self.msgLb.center = CGPointMake(width * 0.5, height * 0.5);
+    self.bounds = CGRectMake(0, 0, width, height);
+    
+    self.layer.cornerRadius = 5.0f;
+    self.layer.masksToBounds = YES;
+    
+}
+
+- (void)willMoveToSuperview:(UIView *)newSuperview {
+    [super willMoveToSuperview:newSuperview];
+    
+    if (newSuperview) {
+        self.center = CGPointMake(newSuperview.bounds.size.width * 0.5, newSuperview.bounds.size.height * 0.5);
+    }
+}
+
+- (void)layoutSubviews {
+    [super layoutSubviews];
+    
+    if (self.superview) {
+        self.center = CGPointMake(self.superview.bounds.size.width * 0.5, self.superview.bounds.size.height * 0.5);
+    }
+}
+
+- (void)hide {
+    [self removeFromSuperview];
+}
+
+@end
+
+@interface DetailPageViewController () <QLPreviewControllerDataSource,QLPreviewControllerDelegate,DetailKVCellTapDelegate>
 
 @property (nonatomic,strong) QLPreviewController *quickLook;
 @property (nonatomic,copy) NSString *documentPath;
@@ -444,6 +526,14 @@
     }
 }
 
+- (void)copyTap:(UITapGestureRecognizer *)tap {
+    UILabel *lb = (UILabel *)tap.view;
+    
+    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
+    pasteboard.string = lb.text;
+    [DetailHUD show:[NSString stringWithFormat:@"%@ Copied",lb.text] inView:self.view];
+}
+
 #pragma mark - Table view data source
 //
 //- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
@@ -717,6 +807,12 @@
         [btn addTarget:self action:@selector(sectionSwitchClick:) forControlEvents:UIControlEventTouchUpInside];
         
         [header addSubview:btn];
+        
+        // Tap Copy
+        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(copyTap:)];
+        tapGesture.numberOfTapsRequired = 2;
+        [titleLb addGestureRecognizer:tapGesture];
+        titleLb.userInteractionEnabled = YES;
     }
     
     return header;
@@ -855,6 +951,8 @@
         
         NSLog(@"key %@ val %@",key,val);
         
+        cell.tapDelegate = self;
+        
 //                UIView * lineview = [[LineView alloc] initWithFrame:cell.contentView.frame];
 //                lineview.userInteractionEnabled = NO;// 不设为NO会屏蔽cell的点击事件
 //                lineview.backgroundColor = [UIColor clearColor];// 设为透明从而使得cell.backgroundColor有效.
@@ -1074,5 +1172,15 @@
     return NO;
 }
 
+#pragma mark - KVDetail Tap Delegate
+
+- (void)detailCell:(DetailCellKVNew *)cell doubleTapedForValue:(NSString *)value {
+    
+//    NSIndexPath *indexPath = [self.table indexPathForCell:cell];
+    UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
+    pasteboard.string = value;
+    [DetailHUD show:[NSString stringWithFormat:@"%@ Copied",cell.keyLabel.text] inView:self.view];
+    
+}
 
 @end

+ 22 - 0
Apex Mobile/Apex Mobile/LocalDocumentsViewController.m

@@ -207,6 +207,28 @@
     
 }
 
+- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
+    
+    __weak typeof(self) weakSelf = self;
+    UITableViewRowAction *delete = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Delete" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
+        
+        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+        NSString *path = [paths objectAtIndex:0];
+        NSString* filename =[weakSelf.toolsinfo[indexPath.row] valueForKey:@"title"];
+        NSString *filePath = [path stringByAppendingPathComponent:filename];
+        
+        NSError *err;
+        [[NSFileManager defaultManager] removeItemAtPath:filePath error:&err];
+        if (!err) {
+            [weakSelf.toolsinfo removeObjectAtIndex:indexPath.row];
+            [tableView reloadData];
+        }
+        
+    }];
+    
+    return @[delete];
+}
+
 
 //-(void)tableView:(UITableView *)tableView1 accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
 //    

TEMPAT SAMPAH
Apex Mobile/Apex Mobile/NewImages.xcassets/tab_history.imageset/tab_history.png


TEMPAT SAMPAH
Apex Mobile/Apex Mobile/NewImages.xcassets/tab_history.imageset/tab_history@2x.png


TEMPAT SAMPAH
Apex Mobile/Apex Mobile/NewImages.xcassets/tab_history.imageset/tab_history@3x.png