Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions EUExControl/EUExControl.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
3C1C09AC1BE060A200571E72 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3C1C09AE1BE060A200571E72 /* Localizable.strings */; };
3CD39C841A78848B00F5BB9D /* CDatePickerViewEx.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CD39C811A78848B00F5BB9D /* CDatePickerViewEx.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
3CD39C851A78848B00F5BB9D /* MonthPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CD39C831A78848B00F5BB9D /* MonthPicker.m */; };
4287467D1C294C9400219CDE /* Public_HIST.m in Sources */ = {isa = PBXBuildFile; fileRef = 4287467C1C294C9400219CDE /* Public_HIST.m */; };
5A38ABCF1889391A00E3CB77 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A38ABCE1889391A00E3CB77 /* Foundation.framework */; };
5A60A96318AB63F800C727A6 /* DatePicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A60A95218AB63F800C727A6 /* DatePicker.m */; };
5A60A96418AB63F800C727A6 /* HeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A60A95418AB63F800C727A6 /* HeaderView.m */; };
Expand Down Expand Up @@ -37,6 +38,8 @@
3CD39C811A78848B00F5BB9D /* CDatePickerViewEx.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDatePickerViewEx.m; sourceTree = "<group>"; };
3CD39C821A78848B00F5BB9D /* MonthPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MonthPicker.h; sourceTree = "<group>"; };
3CD39C831A78848B00F5BB9D /* MonthPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MonthPicker.m; sourceTree = "<group>"; };
4287467B1C294C9400219CDE /* Public_HIST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Public_HIST.h; sourceTree = "<group>"; };
4287467C1C294C9400219CDE /* Public_HIST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Public_HIST.m; sourceTree = "<group>"; };
5A38ABCB1889391A00E3CB77 /* libuexControl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libuexControl.a; sourceTree = BUILT_PRODUCTS_DIR; };
5A38ABCE1889391A00E3CB77 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
5A38ABD21889391A00E3CB77 /* EUExControl-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EUExControl-Prefix.pch"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -169,6 +172,8 @@
5A60A95418AB63F800C727A6 /* HeaderView.m */,
5A60A95518AB63F800C727A6 /* InputDialog.h */,
5A60A95618AB63F800C727A6 /* InputDialog.m */,
4287467B1C294C9400219CDE /* Public_HIST.h */,
4287467C1C294C9400219CDE /* Public_HIST.m */,
5A60A95718AB63F800C727A6 /* JSON */,
5A60A95F18AB63F800C727A6 /* PLGrowingTextView.h */,
5A60A96018AB63F800C727A6 /* PLGrowingTextView.m */,
Expand Down Expand Up @@ -290,6 +295,7 @@
5A60A96918AB63FE00C727A6 /* EUExControl.m in Sources */,
5A60A96518AB63F800C727A6 /* InputDialog.m in Sources */,
3CD39C851A78848B00F5BB9D /* MonthPicker.m in Sources */,
4287467D1C294C9400219CDE /* Public_HIST.m in Sources */,
5A60A96718AB63F800C727A6 /* PLTextViewInternal.m in Sources */,
3CD39C841A78848B00F5BB9D /* CDatePickerViewEx.m in Sources */,
5A60A96618AB63F800C727A6 /* PLGrowingTextView.m in Sources */,
Expand Down
4 changes: 4 additions & 0 deletions EUExControl/EUExControl/EUExControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define UEX_JKHOUR @"hour"
#define UEX_JKMUNUTE @"minute"
#define UEX_JKSECOND @"second"
#define UEX_JKWEEK @"week"


@interface EUExControl : EUExBase <InputDialogDelegate,UITextViewDelegate>{
Expand All @@ -32,6 +33,9 @@
@property (nonatomic, retain)MonthPicker *monthObj;
@property (nonatomic, retain) InputDialog * inputObj;
@property (nonatomic, assign) BOOL isDataPickerDidOpen;
@property(nonatomic,strong)NSString * diaLogColor;
@property(nonatomic,strong)NSString * dialogButBg;
@property(nonatomic,strong)NSString * dialogETBg;


-(void)uexOpenDatePickerWithOpId:(int)inOpId dataType:(int)inDataType data:(NSString*)inData;
Expand Down
116 changes: 49 additions & 67 deletions EUExControl/EUExControl/EUExControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ @implementation EUExControl
@synthesize dateObj;
@synthesize monthObj;
@synthesize inputObj;
@synthesize diaLogColor;
@synthesize dialogButBg;
@synthesize dialogETBg;

-(id)initWithBrwView:(EBrowserView *) eInBrwView {
if (self = [super initWithBrwView:eInBrwView]) {
Expand All @@ -22,79 +25,28 @@ -(id)initWithBrwView:(EBrowserView *) eInBrwView {
return self;
}

- (UIColor *)stringToColor:(NSString *)aString{
if ([aString isKindOfClass:[NSString class]] && aString.length > 0) {
UIColor *color = [EUtility ColorFromString:aString];
return color;
}else{
return nil;
}
}

-(void)setDatePickerConfirmBtnColor:(NSMutableArray *)inArguments{

if ([inArguments count] <= 0) {

return;
}

NSString * jsonStr = [inArguments objectAtIndex:0];
NSMutableDictionary * jsDic = [jsonStr JSONValue];

NSString * titleColor = [jsDic objectForKey:@"leftBtnTitleColor"];
if ([titleColor isKindOfClass:[NSString class]] && [titleColor length]>0) {
self.dateObj.toolView.canLabel.textColor = [self stringToColor:titleColor];
}

titleColor = [jsDic objectForKey:@"rightBtnTitleColor"];
if ([titleColor isKindOfClass:[NSString class]] && [titleColor length]>0) {
self.dateObj.toolView.conLabel.textColor = [self stringToColor:titleColor];
}
}

-(void)setDatePickerWithoutDayConfirmBtnColor:(NSMutableArray *)inArguments{

if ([inArguments count] <= 0) {

return;
}

NSString * jsonStr = [inArguments objectAtIndex:0];
NSMutableDictionary * jsDic = [jsonStr JSONValue];


NSString * titleColor = [jsDic objectForKey:@"leftBtnTitleColor"];
if ([titleColor isKindOfClass:[NSString class]] && [titleColor length]>0) {
self.monthObj.toolView.canLabel.textColor = [self stringToColor:titleColor];
}

titleColor = [jsDic objectForKey:@"rightBtnTitleColor"];
if ([titleColor isKindOfClass:[NSString class]] && [titleColor length]>0) {
self.monthObj.toolView.conLabel.textColor = [self stringToColor:titleColor];
}
}


-(void)clean{
if (dateObj) {
[[NSNotificationCenter defaultCenter] removeObserver:dateObj];
[dateObj release];
dateObj = nil;
self.dateObj = nil;
}
if(monthObj){
[[NSNotificationCenter defaultCenter] removeObserver:monthObj];
[monthObj release];
monthObj = nil;
self.monthObj = nil;
}
if (inputObj) {
[[NSNotificationCenter defaultCenter] removeObserver:inputObj];
[inputObj release];
inputObj = nil;
if (inputObj) {
self.inputObj = nil;
}
}

-(void)dealloc{
[self clean];
if (dateObj) {
self.dateObj = nil;
}
if(monthObj){
self.monthObj = nil;
}
if (inputObj) {
self.inputObj = nil;
}
[super dealloc];
}

Expand All @@ -106,22 +58,46 @@ -(void)openInputDialog:(NSMutableArray *)inArguments{
NSString * inHint = [inArguments objectAtIndex:1];

NSString * btnTitle = [inArguments objectAtIndex:2];

NSInteger a = inArguments.count;
if (inArguments.count==4)
{
NSString * bgParmString = [inArguments objectAtIndex:3];
NSDictionary * dict = [bgParmString JSONValue];
NSLog(@"%@",dict);
diaLogColor = [dict objectForKey:@"dialogBg"];
dialogButBg = [dict objectForKey:@"dialogButBg"];
dialogETBg = [dict objectForKey:@"dialogETBg"];
}


[inputObj release];
inputObj = nil;

CGRect frameOfInputObj = CGRectZero;
float heightOfInputObj = 40;
UIInterfaceOrientation cOrientation = [UIApplication sharedApplication].statusBarOrientation;
if ((cOrientation == UIInterfaceOrientationLandscapeLeft) || (cOrientation == UIInterfaceOrientationLandscapeRight)) {
frameOfInputObj = CGRectMake(0, [EUtility screenWidth] - heightOfInputObj, [EUtility screenHeight], heightOfInputObj);
int width = [EUtility screenWidth];
int height =[EUtility screenHeight];

int realwidth = MAX(width, height);
int realheight = MIN(width, height);
frameOfInputObj = CGRectMake(0, 0, realwidth, heightOfInputObj);
} else {
frameOfInputObj = CGRectMake(0, [EUtility screenHeight] - heightOfInputObj, [EUtility screenWidth], heightOfInputObj);
}
inputObj = [[InputDialog alloc] initWithFrame:frameOfInputObj];
[inputObj openInputWithText:inHint btnText:btnTitle KeyBoardType:inType];
inputObj.backgroundColor = [UIColor clearColor];
// [inputObj openInputWithText:inHint btnText:btnTitle KeyBoardType:inType];
NSString *path = [EUtility getAbsPath:self.meBrwView path:dialogETBg];
NSString * btgPath = [EUtility getAbsPath:self.meBrwView path:dialogButBg];

[inputObj openInputWithText:inHint btnText:(btnTitle) KeyBoardType:inType dialogBg:diaLogColor dialogButBg:btgPath dialogETBg:path count:a];
[inputObj setDelegate:self];
NSLog(@"------->>>%@",NSStringFromCGRect(inputObj.frame));
[EUtility brwView:meBrwView addSubview:inputObj];
[EUtility brwView:meBrwView forbidRotate:YES];
//[EUtility brwView:meBrwView forbidRotate:YES];
inputHasDisplay = YES;
}

Expand Down Expand Up @@ -167,6 +143,8 @@ -(void)openDatePicker:(NSMutableArray *)inArguments{
inDate = [NSDate date];
}
[dateObj showDatePickerWithType:0 date:inDate];


}


Expand All @@ -186,10 +164,13 @@ -(void)openDatePickerWithoutDay:(NSMutableArray *)inArguments{
if ([inYear isEqualToString:@""]||[inMonth isEqualToString:@""]) {
inDate = [NSDate date];
}else {
// NSLog(@"[control opendatePicker");
NSString *dateStr = [NSString stringWithFormat:@"%@-%@",inYear,inMonth];
// NSLog(@"datestr = %@",dateStr);
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM"];
inDate = [df dateFromString:dateStr];
// NSLog(@"inldate = %@",inDate);
[df release];
}
if (inDate == nil) {
Expand Down Expand Up @@ -245,6 +226,7 @@ -(void)uexOpenDatePickerWithOpId:(int)inOpId dataType:(int)inDataType data:(NSSt
-(void)uexOpenMonthPickerWithOpId:(int)inOpId dataType:(int)inDataType data:(NSString*)inData{
inData =[inData stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[self jsSuccessWithName:@"uexControl.cbOpenDatePickerWithoutDay" opId:inOpId dataType:inDataType strData:inData];
NSLog(@"%@",inData);
}
-(void)uexOpenTimerPickerWithOpId:(int)inOpId dataType:(int)inDataType data:(NSString*)inData{
inData =[inData stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
Expand Down
Loading