You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/04/11 13:40:56 UTC

[1/6] incubator-weex git commit: * [ios] bug fix: customMonitorInfo only deal dictionary and string

Repository: incubator-weex
Updated Branches:
  refs/heads/0.12-dev 953c6071b -> c92617a6d


* [ios] bug fix: customMonitorInfo only deal dictionary and string


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/b8bacb13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/b8bacb13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/b8bacb13

Branch: refs/heads/0.12-dev
Commit: b8bacb13e3e765922f217e4c2ce31aa24e841705
Parents: ba19f55
Author: \u9f50\u5c71 <su...@163.com>
Authored: Fri Mar 31 09:59:36 2017 +0800
Committer: \u9f50\u5c71 <su...@163.com>
Committed: Fri Mar 31 09:59:36 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/b8bacb13/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m b/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
index 3a1172a..3b7f6a6 100644
--- a/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
+++ b/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
@@ -94,7 +94,11 @@ static WXThreadSafeMutableDictionary *globalPerformanceDict;
         commitDict[@"requestType"] = instance.userInfo[@"weex_bundlejs_requestType"];
     }
     if (instance.userInfo[WXCUSTOMMONITORINFO]) {
-        commitDict[WXCUSTOMMONITORINFO] = instance.userInfo[WXCUSTOMMONITORINFO];
+        if([instance.userInfo[WXCUSTOMMONITORINFO] isKindOfClass:[NSDictionary class]]) {
+            commitDict[WXCUSTOMMONITORINFO] = [WXUtility JSONString:instance.userInfo[WXCUSTOMMONITORINFO]];
+        }else if([instance.userInfo[WXCUSTOMMONITORINFO] isKindOfClass:[NSString class]]) {
+            commitDict[WXCUSTOMMONITORINFO] = instance.userInfo[WXCUSTOMMONITORINFO];
+        }
     }
     WXPerformBlockOnComponentThread(^{
         commitDict[@"componentCount"] = @([instance numberOfComponents]);


[4/6] incubator-weex git commit: + [ios] delete no use code

Posted by cx...@apache.org.
+ [ios] delete no use code


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/cddebfb7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/cddebfb7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/cddebfb7

Branch: refs/heads/0.12-dev
Commit: cddebfb70fbe149bdfb6d24a68548a280bd3ca95
Parents: 1a4c907
Author: \u9f50\u5c71 <su...@163.com>
Authored: Mon Apr 10 13:33:48 2017 +0800
Committer: \u9f50\u5c71 <su...@163.com>
Committed: Mon Apr 10 13:33:48 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cddebfb7/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m b/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
index fb29d55..2933115 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
@@ -295,7 +295,7 @@ WX_EXPORT_METHOD(@selector(pickTime:callback:))
     self.index = row;
     if(self.selectionColor) {
         UILabel *labelSelected = (UILabel*)[pickerView viewForRow:row forComponent:component];
-        [labelSelected setBackgroundColor:self.selectionColor?self.selectionColor:[UIColor whiteColor]];
+        [labelSelected setBackgroundColor:self.selectionColor];
     }
 }
 


[2/6] incubator-weex git commit: + [ios] picker support custom title title color background color and etc

Posted by cx...@apache.org.
+ [ios] picker support custom title title color background color and etc


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/151b3fdb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/151b3fdb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/151b3fdb

Branch: refs/heads/0.12-dev
Commit: 151b3fdbe5d0e479a5baa17e6d56987588af673a
Parents: c597a05
Author: \u9f50\u5c71 <su...@163.com>
Authored: Fri Apr 7 17:44:20 2017 +0800
Committer: \u9f50\u5c71 <su...@163.com>
Committed: Fri Apr 7 17:44:20 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m | 122 ++++++++++++++++++-
 1 file changed, 116 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/151b3fdb/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m b/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
index a587d4c..c942464 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
@@ -23,6 +23,17 @@
 @property(nonatomic,strong)UIView *backgroundView;
 @property(nonatomic,strong)UIView *pickerView;
 
+//custom
+@property(nonatomic,copy)NSString *title;
+@property(nonatomic,strong)UIColor *titleColor;
+@property(nonatomic,copy)NSString *cancelTitle;
+@property(nonatomic,copy)NSString *confirmTitle;
+@property(nonatomic,strong)UIColor *cancelTitleColor;
+@property(nonatomic,strong)UIColor *confirmTitleColor;
+@property(nonatomic,strong)UIColor *titleBackgroundColor;
+@property(nonatomic)NSInteger height;
+@property(nonatomic,strong)UIColor *textColor;
+@property(nonatomic,strong)UIColor *selectionColor;
 //data
 @property(nonatomic,copy)NSArray *items;
 @property(nonatomic)BOOL isAnimating;
@@ -54,6 +65,36 @@ WX_EXPORT_METHOD(@selector(pickTime:callback:))
     if (options[@"index"]) {
         index = [WXConvert NSInteger:options[@"index"]];
     }
+    if (options[@"title"]) {
+        self.title = [WXConvert NSString:options[@"title"]];
+    }
+    if (options[@"titleColor"]) {
+        self.titleColor = [WXConvert UIColor:options[@"titleColor"]];
+    }
+    if (options[@"cancelTitle"]) {
+        self.cancelTitle = [WXConvert NSString:options[@"cancelTitle"]];
+    }
+    if (options[@"confirmTitle"]) {
+        self.confirmTitle = [WXConvert NSString:options[@"confirmTitle"]];
+    }
+    if (options[@"cancelTitleColor"]) {
+        self.cancelTitleColor = [WXConvert UIColor:options[@"cancelTitleColor"]];
+    }
+    if (options[@"confirmTitleColor"]) {
+        self.confirmTitleColor = [WXConvert UIColor:options[@"confirmTitleColor"]];
+    }
+    if (options[@"titleBackgroundColor"]) {
+        self.titleBackgroundColor = [WXConvert UIColor:options[@"titleBackgroundColor"]];
+    }
+    if (options[@"textColor"]) {
+        self.textColor = [WXConvert UIColor:options[@"textColor"]];
+    }
+    if (options[@"selectionColor"]) {
+        self.selectionColor = [WXConvert UIColor:options[@"selectionColor"]];
+    }
+    if (options[@"height"]) {
+        self.height = [WXConvert CGFloat:options[@"height"]];
+    }
     if (items && [items count]>0 && [self isRightItems:items]) {
         [self createPicker:items index:index];
         self.callback = callback;
@@ -160,17 +201,52 @@ WX_EXPORT_METHOD(@selector(pickTime:callback:))
     [self.backgroundView addGestureRecognizer:tapGesture];
     self.pickerView = [self createPickerView];
     UIToolbar *toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, WXPickerToolBarHeight)];
-    [toolBar setBackgroundColor:[UIColor whiteColor]];
+    toolBar.barTintColor = self.titleBackgroundColor?self.titleBackgroundColor:[UIColor whiteColor];
+    
+    
+    
     UIBarButtonItem* noSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
     noSpace.width=10;
-    UIBarButtonItem* doneBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
-    UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
-    UIBarButtonItem* cancelBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
+    
+    UIBarButtonItem* doneBtn ;
+    if (self.confirmTitle.length >0) {
+        doneBtn = [[UIBarButtonItem alloc] initWithTitle:self.confirmTitle style:UIBarButtonItemStyleBordered target:self action:@selector(done:)];
+    }else {
+       doneBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done:)];
+    }
+    if(self.confirmTitleColor){
+        doneBtn.tintColor = self.confirmTitleColor;
+    }
+    UIBarButtonItem *cancelBtn;
+    if (self.cancelTitle.length >0) {
+        cancelBtn = [[UIBarButtonItem alloc] initWithTitle:self.cancelTitle style:UIBarButtonItemStyleBordered target:self action:@selector(cancel:)];
+    }else {
+        cancelBtn = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancel:)];
+    }
+    if(self.cancelTitleColor){
+        cancelBtn.tintColor = self.cancelTitleColor;
+    }
+    UIBarButtonItem* flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
     [toolBar setItems:[NSArray arrayWithObjects:noSpace,cancelBtn,flexSpace,doneBtn,noSpace, nil]];
+    UILabel *titleLabel = [UILabel new];
+    titleLabel.frame = CGRectMake(0, 0, 200, WXPickerToolBarHeight);
+    titleLabel.center = toolBar.center;
+    titleLabel.textAlignment = NSTextAlignmentCenter;
+    if(self.titleColor){
+        titleLabel.textColor = self.textColor;
+    }
+    if(self.title.length>0){
+        titleLabel.text = self.title;
+        [toolBar addSubview:titleLabel];
+    }
     [self.pickerView addSubview:toolBar];
     self.picker = [[UIPickerView alloc]init];
     self.picker.delegate = self;
-    CGRect pickerFrame = CGRectMake(0, WXPickerToolBarHeight, [UIScreen mainScreen].bounds.size.width, WXPickerHeight-WXPickerToolBarHeight);
+    CGFloat height = WXPickerHeight;
+    if (WXFloatEqual(self.height, 0)){
+        height = self.height>WXPickerToolBarHeight?self.height:WXPickerHeight;
+    }
+    CGRect pickerFrame = CGRectMake(0, WXPickerToolBarHeight, [UIScreen mainScreen].bounds.size.width, height-WXPickerToolBarHeight);
     self.picker.backgroundColor = [UIColor whiteColor];
     self.picker.frame = pickerFrame;
     [self.pickerView addSubview:self.picker];
@@ -180,7 +256,11 @@ WX_EXPORT_METHOD(@selector(pickTime:callback:))
 -(UIView *)createPickerView
 {
     UIView *view = [UIView new];
-    view.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width, WXPickerHeight);
+    CGFloat height = WXPickerHeight;
+    if (WXFloatEqual(self.height, 0)){
+        height = self.height>WXPickerToolBarHeight?self.height:WXPickerHeight;
+    }
+    view.frame = CGRectMake(0, [UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width, height);
     view.backgroundColor = [UIColor whiteColor];
     return view;
 }
@@ -213,8 +293,38 @@ WX_EXPORT_METHOD(@selector(pickTime:callback:))
 - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
 {
     self.index = row;
+    if(self.selectionColor) {
+        UILabel *labelSelected = (UILabel*)[pickerView viewForRow:row forComponent:component];
+        [labelSelected setBackgroundColor:self.selectionColor?self.selectionColor:[UIColor whiteColor]];
+    }
+}
+
+- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component{
+    NSString * reStr = self.items[row];
+    NSMutableAttributedString * attriStr = [[NSMutableAttributedString alloc] initWithString:reStr];
+    UIColor *color = self.textColor?self.textColor:[UIColor blackColor];
+    [attriStr addAttribute:NSForegroundColorAttributeName value:color range:NSMakeRange(0, reStr.length)];
+
+    return attriStr;
 }
 
+-(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
+{
+    
+    UILabel *label = (id)view;
+    
+    if (!label)
+    {
+        
+        label= [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [pickerView rowSizeForComponent:component].width, [pickerView rowSizeForComponent:component].height)];
+        label.textAlignment = NSTextAlignmentCenter;
+        label.text = self.items[row];
+    }
+    
+    return label;
+}
+
+
 #pragma mark -
 #pragma Date & Time Picker
 -(void)pickDate:(NSDictionary *)options callback:(WXModuleCallback)callback


[6/6] incubator-weex git commit: Merge branch 'ios-feature-picker-0.12-dev' of https://github.com/kfeagle/incubator-weex into 0.12-dev

Posted by cx...@apache.org.
Merge branch 'ios-feature-picker-0.12-dev' of https://github.com/kfeagle/incubator-weex into 0.12-dev


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/c92617a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/c92617a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/c92617a6

Branch: refs/heads/0.12-dev
Commit: c92617a6d2790ba8a9231de4a5c59199e7b3f0ed
Parents: 57f395d cddebfb
Author: cxfeng <cx...@apache.org>
Authored: Tue Apr 11 21:40:44 2017 +0800
Committer: cxfeng <cx...@apache.org>
Committed: Tue Apr 11 21:40:44 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m | 122 ++++++++++++++++++-
 1 file changed, 116 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/c92617a6/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
----------------------------------------------------------------------


[5/6] incubator-weex git commit: Merge branch 'ios-bugfix-0.12-dev' of https://github.com/kfeagle/incubator-weex into 0.12-dev

Posted by cx...@apache.org.
Merge branch 'ios-bugfix-0.12-dev' of https://github.com/kfeagle/incubator-weex into 0.12-dev


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/57f395db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/57f395db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/57f395db

Branch: refs/heads/0.12-dev
Commit: 57f395db79073bcdd0415f784b2a80bc2e1ec386
Parents: 953c607 b8bacb1
Author: cxfeng <cx...@apache.org>
Authored: Tue Apr 11 21:40:24 2017 +0800
Committer: cxfeng <cx...@apache.org>
Committed: Tue Apr 11 21:40:24 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/57f395db/ios/sdk/WeexSDK/Sources/Monitor/WXMonitor.m
----------------------------------------------------------------------


[3/6] incubator-weex git commit: + [ios] update height type

Posted by cx...@apache.org.
+ [ios] update height type


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1a4c9079
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1a4c9079
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1a4c9079

Branch: refs/heads/0.12-dev
Commit: 1a4c9079b804f3bb495423926f9b16fac397e589
Parents: 151b3fd
Author: \u9f50\u5c71 <su...@163.com>
Authored: Fri Apr 7 17:47:46 2017 +0800
Committer: \u9f50\u5c71 <su...@163.com>
Committed: Fri Apr 7 17:47:46 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1a4c9079/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m b/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
index c942464..fb29d55 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXPickerModule.m
@@ -31,7 +31,7 @@
 @property(nonatomic,strong)UIColor *cancelTitleColor;
 @property(nonatomic,strong)UIColor *confirmTitleColor;
 @property(nonatomic,strong)UIColor *titleBackgroundColor;
-@property(nonatomic)NSInteger height;
+@property(nonatomic)CGFloat height;
 @property(nonatomic,strong)UIColor *textColor;
 @property(nonatomic,strong)UIColor *selectionColor;
 //data